## org.autoplot.AppManager

Count the number of open applications and call exit when there are zero.

addApplication( Object app ) → void [view source]

## addCloseCallback

addCloseCallback( Object app, String id, org.autoplot.AppManager.CloseCallback c ) → void

add a close callback which can prevent a close. The callback can open a dialog requesting that the user save a file, for example.

### Parameters

app - to associate the callback.
id - a String
c - an AppManager.CloseCallback

### Returns:

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

## closeApplication

closeApplication( Object app ) → boolean

see if everyone agrees that this application can be closed. If so, the application this will return true. If one of the callbacks doesn't allow it, then return false.

### Parameters

app - an Object

### Returns:

a boolean
[search for examples] [view on GitHub] [view on old javadoc] [view source]
getApplication( int i ) → Object [view source]

## getApplicationCount

getApplicationCount( ) → int

return the number of running applications this AppManager is managing.

### Returns:

an int
[search for examples] [view on GitHub] [view on old javadoc] [view source]
getInstance( ) → org.autoplot.AppManager [view source]
getWindowListener( Object app, javax.swing.Action closeAction ) → java.awt.event.WindowListener [view source]
getWindowListener( Object app ) → java.awt.event.WindowListener [view source]

## isAllowExit

isAllowExit( ) → boolean

if true, then the ApplicationManager may explicitly call System.exit.

### Returns:

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

## isRunningApplication

isRunningApplication( Object app ) → boolean

return true if the application is registered. This was introduced so that ScriptContext could check that it hasn't been closed. (This listens to window closing events.)

### Parameters

app - an Object

### Returns:

true if the app is still registered.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## quit

quit( ) → void

quit with the exit status of 0.

### Returns:

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

## quit

quit( int status ) → void

quit with the exit status. By convention, 0 means okay, and non-0 means something wrong.

### Parameters

status - an int

### Returns:

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

## requestClose

requestClose( Object app ) → boolean

returns true if close can be called, exiting the program. If the callback throws an exception, then a warning is displayed. I expect this will often occur in scripts.

### Parameters

app - the app that is closing.

### Returns:

true if the callback okays the close.
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## requestQuit

requestQuit( ) → boolean

returns true if quit can be called, exiting the program. If the callback throws an exception, then a warning is displayed. I expect this will often occur in scripts.

### Returns:

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

## setAllowExit

setAllowExit( boolean allowExit ) → void

some applications, like web applications and using Autoplot within Python, need to disable quitting so that System.exit is not called. Note that once an application does not allow quitting, it can not be turned back on.

### Parameters

allowExit - a boolean

### Returns:

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