## org.autoplot.AutoplotUtil

Utility functions for Autoplot and other related applications. Note this has no reference to the specific app AutoplotUI, because this is also used in the applet which doesn't use AutoplotUI.

## AutoplotUtil( )

## SERIES_SIZE_LIMIT

## DS_LENGTH_LIMIT

absolute length limit for plots. This is used to limit the elements used in autoranging, etc.

## is32bit

## javaVersionWarning

## autoRange

autoRange( QDataSet hist, QDataSet ds, java.util.Map properties ) → org.autoplot.AutoRangeUtil.AutoRangeDescriptor

this is a copy of the other autorange, lacking some of its hacks. TODO: why? This is not used.

### Parameters

hist - a QDataSet
ds - a QDataSet
properties - a java.util.Map

### Returns:

an org.autoplot.AutoRangeUtil.AutoRangeDescriptor

### See Also:

autoRange(QDataSet, java.util.Map, boolean)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## autoRange

autoRange( QDataSet ds, java.util.Map properties ) → org.autoplot.AutoRangeUtil.AutoRangeDescriptor

Autorange using the dataset properties

### Parameters

ds - the dataset, a non-bundle, to be autoranged.
properties - Additional constraints for properties, such as SCALE_TYPE

### Returns:

the range.

### See Also:

AutoRangeUtil#autoRange(QDataSet, java.util.Map)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## autoRange

Deprecated:

## bounds

bounds( QDataSet dataSet, org.autoplot.RenderType renderType ) → QDataSet

return the bounding qube for the given render type. This was stolen from Test022.

### Parameters

dataSet - a QDataSet
renderType - a RenderType

### Returns:

bounding cube[3,2]
[search for examples] [view on GitHub] [view on old javadoc] [view source]
cancelIcon( ) → javax.swing.Icon [view source]

## createImage

createImage( QDataSet ds, int width, int height ) → java.awt.image.BufferedImage

experiment to see if we can get an image of a dataset. This must be called from off of the event thread.

### Parameters

ds - a QDataSet
width - an int
height - an int

### Returns:

the image TODO: test me!
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## createPlot

createPlot( org.das2.graph.DasCanvas c, QDataSet ds, org.das2.graph.DasPlot recyclable, org.das2.graph.DasColorBar cb ) → org.das2.graph.DasPlot

Create a dasPlot that can be useful to scripts.

### Parameters

c - the canvas for the plot, or null.
ds - the dataset
recyclable - the recyclable dasPlot, or null.
cb - the colorbar, or null.

### Returns:

the DasPlot.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## disableCertificates

disableCertificates( ) → void

disable certificate checking. A TrustManager and HostnameVerifier which trusts all names and certs is installed.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## extractProperties

extractProperties( QDataSet ds ) → java.util.Map

extract the properties from the dataset into the same format as metadata model returns.

### Parameters

ds - a QDataSet

### Returns:

a java.util.Map
[search for examples] [view on GitHub] [view on old javadoc] [view source]
formatDevicePosition( org.das2.graph.DasDevicePosition pos ) → String [view source]

## getAboutAutoplotHtml

getAboutAutoplotHtml( org.autoplot.ApplicationModel model ) → String

return an HTML page showing the current system environment.

### Parameters

model - an ApplicationModel

### Returns:

string containing HTML
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getAutoplotIcon

getAutoplotIcon( ) → java.awt.Image

return 64x64 pixel Autoplot Icon.

### Returns:

a java.awt.Image
[search for examples] [view on GitHub] [view on old javadoc] [view source]
getNoIcon( ) → java.awt.Image [view source]

## getProcessId

getProcessId( String fallback ) → String

return the processID (pid), or the fallback if the pid cannot be found.

### Parameters

fallback - the string (null is okay) to return when the pid cannot be found.

### Returns:

the process id or the fallback provided by the caller. //TODO: Java9 has method for accessing process ID.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getProperty

getProperty( String name, String deft ) → String

support restricted security environment by checking permissions before checking property.

### Parameters

name - a String
deft - a String

### Returns:

a String
[search for examples] [view on GitHub] [view on old javadoc] [view source]
getUrls( java.util.List recent ) → java.util.List [view source]
guessRenderType( QDataSet fillds ) → org.autoplot.RenderType [view source]

## isParsableDouble

isParsableDouble( String myString ) → boolean

The Double.parseDouble contains this javadoc describing how to test for a valid double.

### Parameters

myString - a String

### Returns:

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

## maybeCreateRenderer

maybeCreateRenderer( org.autoplot.RenderType renderType, org.das2.graph.Renderer recyclable, org.das2.graph.DasColorBar colorbar, boolean justRenderType ) → org.das2.graph.Renderer

return a renderer that is configured for this renderType.

### Parameters

renderType - a RenderType
recyclable - a Renderer
colorbar - a DasColorBar
justRenderType - if true, then just set the render type, other code will configure it. If true, presumably bindings will set the state.

### Returns:

an org.das2.graph.Renderer
[search for examples] [view on GitHub] [view on old javadoc] [view source]
maybeInitializeEditorColors( ) → void [view source]

## maybeLoadSystemProperties

maybeLoadSystemProperties( ) → void

check to see if the user has the file HOME/autoplot_data/system.properties, which if found will cause System.setProperty for each one. This was introduced to facilitate Craig with his testing of enableReferenceCache=true, and should make it easier to provide generic extensions.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## mergeProperties

mergeProperties( java.util.Map properties, java.util.Map deflt ) → java.util.Map

combine the two properties trees, using values from the first when both contain the same property.

### Parameters

properties - a java.util.Map
deflt - a java.util.Map

### Returns:

a java.util.Map
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## openBrowser

openBrowser( String url ) → void

open the URL in a browser. Borrowed from http://www.centerkey.com/java/browser/.

### Parameters

url - the URL.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]
readDoc( java.io.InputStream is ) → org.w3c.dom.Document [view source]

## reloadAll

reloadAll( org.autoplot.dom.Application dom ) → void

reload all the data. This should not be called on the event thread.

### Parameters

dom - an Application

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## replaceFile

replaceFile( java.awt.Component parent, org.autoplot.dom.Application dom ) → void

Replace filename references within the DOM, and reset xrange. This was the often-used ReplaceFile script. This now follows focus.

### Parameters

parent - focus for response dialogs.
dom - the application

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]
resetZoomX( org.autoplot.dom.Application dom ) → boolean [view source]
resetZoomX( org.autoplot.dom.Application dom, org.autoplot.dom.Plot plot ) → boolean [view source]
resetZoomY( org.autoplot.dom.Application dom ) → boolean [view source]
resetZoomY( org.autoplot.dom.Application dom, org.autoplot.dom.Plot plot ) → boolean [view source]
resetZoomZ( org.autoplot.dom.Application dom ) → boolean [view source]
resetZoomZ( org.autoplot.dom.Application dom, org.autoplot.dom.Plot plot ) → boolean [view source]

## scaleIcon

scaleIcon( javax.swing.ImageIcon icon, int w, int h ) → javax.swing.ImageIcon

create a new Icon that is a scaled instance of the first. The image should be a BufferedImage.

### Parameters

icon - an ImageIcon
w - an int
h - an int

### Returns:

a javax.swing.ImageIcon
[search for examples] [view on GitHub] [view on old javadoc] [view source]
scaleImage( java.awt.image.BufferedImage image, int w, int h ) → java.awt.image.BufferedImage [view source]

## setDevicePosition

setDevicePosition( org.das2.graph.DasDevicePosition row, String spec ) → void

set the device position, using spec string like "+5em,80%-5em"

### Parameters

row - the row/column to modify
spec - the spec

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## showConfirmDialog

showConfirmDialog( java.awt.Component parentComponent, Object message, String title, int optionType ) → int

Wrapper for displaying ok,cancel dialogs. If the message is a component, then the dialog will be resizeable.

### Parameters

parentComponent - determines the Frame in which the dialog is displayed; if null, or if the parentComponent has no Frame, a default Frame is used
message - the String or GUI component to display
title - the title string for the dialog
optionType - an int designating the options available on the dialog: YES_NO_OPTION, YES_NO_CANCEL_OPTION, or OK_CANCEL_OPTION

### Returns:

JOptionPane.OK_OPTION, JOptionPane.CANCEL_OPTION, etc.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## showConfirmDialog2

showConfirmDialog2( java.awt.Component parent, Object omessage, String title, int optionType ) → int

new okay/cancel dialog that is resizable and is made with a simple dialog.

### Parameters

parent - a Component
omessage - String or Component.
title - a String
optionType - an int

### Returns:

JOptionPane.OK_OPTION, JOptionPane.CANCEL_OPTION.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## showMessageDialog

showMessageDialog( java.awt.Component parentComponent, Object message, String title, int messageType ) → void

wrapper for displaying messages. This will eventually use the Autoplot icon, etc. This should be called, not JOptionPane.showMessageDialog(...)

### Parameters

parentComponent - a Component
message - an Object
title - a String
messageType - an int

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## showMessageDialog

showMessageDialog( java.awt.Component parentComponent, Object message ) → void

Show message with OK option.

### Parameters

parentComponent - the parent
message - the message

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## showUserExceptionDialog

showUserExceptionDialog( java.awt.Component parent, String string, java.lang.Exception ex, org.das2.util.ExceptionHandler exh ) → void

put in a place to call where the message is shown assuming the problem is on the user's end, but provide a button to inspect the exception.

### Parameters

parent - parent component to center the dialog.
string - the message, a string or html code.
ex - the wrapped exception
exh - an exception handler to show the exception.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## toDataSet

toDataSet( org.autoplot.AutoRangeUtil.AutoRangeDescriptor ard ) → QDataSet

convert the legacy AutoRangeDescriptor to a QDataSet bounding cube. The bounding cube is a rank 1, 2-element dataset with min and max as the elements, and SCALE_TYPE="log" if the AutoRangeDescriptor log property was true.

### Parameters

ard - AutoRangeDescriptor.

### Returns:

a rank 1 bounding cube.
[search for examples] [view on GitHub] [view on old javadoc] [view source]