public final class PuffinApp
extends java.lang.Object
PuffinApp
's
functionality involves interfacing the user interface to the classes
which handle the actual data. Most of the actions defined in
PuffinActions
act as thin wrappers around one or a few calls
to PuffinApp
. Most of PuffinApp
's interaction with the
data is via the Suite
, Site
, and Sample
classes.Modifier and Type | Class and Description |
---|---|
class |
PuffinApp.Version
A class containing information about PuffinPlot's version.
|
Constructor and Description |
---|
PuffinApp()
Instantiates a new PuffinPlot application object.
|
Modifier and Type | Method and Description |
---|---|
void |
about()
Shows the application's ‘About’ dialog box, giving brief information
about PuffinPlot.
|
void |
calculateGreatCirclesDirections()
For all selected sites, calculates the site mean direction by
best-fit intersection of great circles fitted to that
site's samples.
|
void |
calculateMultiSuiteMeans()
Calculate means across all currently loaded suites.
|
void |
calculateRpi()
Calculate RPI using two loaded suites.
|
void |
clearAmsCalcs()
Clears the results of any AMS calculations for the current suite.
|
void |
clearPreferences()
Shows a confirmation dialog.
|
void |
clearSelectedSampleCalculations()
Clear selected points and stored calculations for selected samples.
|
void |
clearSelectedSampleGcs()
Clear great circle fits for selected samples.
|
void |
clearSelectedSamplePcas()
Clear PCA calculations for selected samples.
|
void |
clearSiteCalculations()
Clears any previously calculated Fisherian or great-circle site directions.
|
void |
closeCurrentSuite()
Closes the suite whose data is currently being displayed.
|
void |
copyPointSelection()
Copies the current pattern of selected points to a clipboard.
|
void |
createNewSuite()
Creates a new, empty suite and adds it to the suite list.
|
void |
doAmsCalc(Suite.AmsCalcType calcType,
java.lang.String scriptName)
Performs statistical calculations on AMS data using a script from
Lisa Tauxe's pmagpy software suite.
|
void |
doPcaOnSelection()
For all selected samples, determine a best-fit line to the selected
points by principal component analysis.
|
void |
errorDialog(java.lang.String title,
PuffinUserException ex)
Displays a dialog box reporting an error.
|
void |
errorDialog(java.lang.String title,
java.lang.String message)
Displays a dialog box reporting an error.
|
void |
exportGraphics() |
void |
exportPdfFreehep(java.io.File pdfFile)
Writes a PDF file containing data plots with the current layout
for all selected samples.
|
void |
exportPdfItext(java.io.File pdfFile)
Writes a PDF file containing data plots with the current layout
for all selected samples.
|
void |
fitGreatCirclesToSelection()
For all selected samples, fit a great circle to the selected points.
|
void |
flipSelectedSamples(MeasurementAxis axis)
For all selected samples, rotates magnetization data 180° around
the specified axis.
|
PuffinActions |
getActions()
Returns the actions associated with this PuffinApp.
|
java.util.List<Sample> |
getAllSamplesInSelectedSites()
Gets all the samples in all the sites having at least one selected sample.
|
java.lang.String |
getBuildProperty(java.lang.String key)
Reads values from the
build.properties file. |
Correction |
getCorrection()
Returns the correction currently being applied to the data displayed
by this PuffinApp.
|
java.awt.print.PageFormat |
getCurrentPageFormat()
Returns the current page format.
|
Site |
getCurrentSite()
Returns the site for which data is currently being displayed.
|
EditSampleParametersWindow |
getEditSampleParametersWindow()
Returns the window for user editing of correction data.
|
static PuffinApp |
getInstance()
Returns the single instance of PuffinApp.
|
MainWindow |
getMainWindow()
Returns this PuffinApp's main window
|
PuffinPrefs |
getPrefs()
Returns the preferences for this PuffinApp.
|
RecentFileList |
getRecentFiles()
Returns the list of recently used files.
|
Sample |
getSample()
Gets the current Sample
|
java.util.List<Sample> |
getSelectedSamples()
Gets all the currently selected samples.
|
java.util.List<Site> |
getSelectedSites()
Gets all the sites containing any of the currently selected samples.
|
SiteMeanWindow |
getSiteEqAreaWindow()
Returns the great-circle statistics window.
|
Suite |
getSuite()
Returns the current Suite.
|
SuiteEqAreaWindow |
getSuiteEqAreaWindow()
Returns the suite equal-area plot window.
|
java.util.List<Suite> |
getSuites()
Returns all the Suites currently open within this PuffinApp.
|
TableWindow |
getTableWindow()
Returns the data table window.
|
TreatmentWindow |
getTreatmentWindow()
Returns a window allowing the user to set the treatment type.
|
PuffinApp.Version |
getVersion()
Returns the version of this PuffinPlot build.
|
boolean |
isEmptyCorrectionActive()
Reports whether the empty-slot correction is currently active.
|
boolean |
isOnOsX()
Reports whether this PuffinApp is running on Mac OS X.
|
static void |
main(java.lang.String[] args)
Instantiates and starts a new PuffinApp.
|
void |
openFiles(java.util.List<java.io.File> files,
boolean createNewSuite)
Reads data into the current suite, or a new suite,
from the specified files.
|
void |
openWebPage(java.lang.String uriString)
Opens the specified URI in the default system browser.
|
void |
pastePointSelection()
For each selected sample, selects the points corresponding to those
last copied to the clipboard.
|
void |
quit()
Terminates this instance of PuffinApp immediately.
|
void |
redoCalculations()
Recalculates all sample and site calculations in all currently open
suites; intended to be called when the correction (none/sample/formation)
has changed.
|
void |
rescaleMagSus()
Scales all magnetic susceptibility values in the current suite by
a user-specified factor.
|
void |
runJavascriptScript(java.lang.String scriptPath) |
void |
runPythonScriptInGui(java.lang.String scriptPath)
Runs a specified Python script, first downloading Jython if required.
|
void |
save()
Saves the current suite under its current filename.
|
void |
save(Suite suite)
Saves the specified suite under its current filename.
|
void |
setCorrection(Correction correction)
Sets the correction to apply to the displayed data.
|
void |
setEmptyCorrectionActive(boolean b)
Activates or deactivates the empty-slot correction.
|
void |
setRecentFiles(RecentFileList recentFiles)
Sets the list of recently used files (allowing it to be restored
after restarting the application).
|
void |
setSuite(int index)
Sets the currently displayed Suite.
|
void |
showCiteWindow()
Shows this PuffinApp's citation window
|
void |
showCreateBundleDialog() |
void |
showCustomFlagsWindow()
Shows the window for editing the titles of the custom flags.
|
void |
showCustomNotesWindow()
Shows the window for editing the titles of the custom notes.
|
void |
showDiscreteToContinuousDialog() |
void |
showImportAmsDialog()
Shows an ‘open files’ dialog box; if the user selects
any files, AMS data will be imported from them.
|
void |
showImportPreferencesDialog()
Shows an ‘open file’ dialog box; if the user selects a file,
the current preferences will be overwritten with preferences data
from that file.
|
void |
showMacOpenFolderDialog() |
void |
showOpenFilesDialog(boolean createNewSuite)
Shows an ‘open files’ dialog box.
|
void |
showPageSetupDialog()
Opens the page setup dialog box.
|
void |
showPreferences()
Opens the preferences window.
|
void |
showPrintDialog(java.lang.String window)
Shows a print dialog.
|
void |
showRunJavascriptScriptDialog()
Opens a file selection dialog and runs the Javascript script
(if any) which the user selects from that dialog.
|
void |
showRunPythonScriptDialog()
Opens a file selection dialog and runs the Python script
(if any) which the user selects from that dialog.
|
void |
updateDisplay()
Updates the main window and table window to reflect any changes in
the currently displayed data.
|
public PuffinApp()
public static void main(java.lang.String[] args)
args
- command-line arguments for the applicationpublic boolean isOnOsX()
true
if this PuffinApp is running on Mac OS Xpublic static PuffinApp getInstance()
public boolean isEmptyCorrectionActive()
public void setEmptyCorrectionActive(boolean b)
b
- true
to activate the empty-slot correction;
false
to deactivate it.public void redoCalculations()
public java.lang.String getBuildProperty(java.lang.String key)
build.properties
file. This is a
properties file written into the PuffinPlot jar at build time,
and currently contains the keys build.date
and
build.year
.key
- the property key to readpublic void calculateGreatCirclesDirections()
public void fitGreatCirclesToSelection()
public void doPcaOnSelection()
public void clearSelectedSamplePcas()
public void clearSelectedSampleGcs()
public void clearSelectedSampleCalculations()
public PuffinPrefs getPrefs()
public MainWindow getMainWindow()
public void showCiteWindow()
public Correction getCorrection()
public void setCorrection(Correction correction)
correction
- the correction to apply to the displayed datapublic void updateDisplay()
public void closeCurrentSuite()
public void createNewSuite()
public void openFiles(java.util.List<java.io.File> files, boolean createNewSuite)
files
- the files from which to read datacreateNewSuite
- whether to create a new suite; if this parameter
is true
or if there is no current suite, a new suite will be
created for the data.public void errorDialog(java.lang.String title, java.lang.String message)
title
- the title for the dialog boxmessage
- the message to be displayedpublic void errorDialog(java.lang.String title, PuffinUserException ex)
title
- the title for the dialog boxex
- the exception from which to take the message textpublic java.util.List<Suite> getSuites()
public Suite getSuite()
public void setSuite(int index)
index
- the index of the suite to be displayed within
PuffinApp's list of suitespublic Sample getSample()
public java.util.List<Sample> getSelectedSamples()
public Site getCurrentSite()
public java.util.List<Site> getSelectedSites()
public java.util.List<Sample> getAllSamplesInSelectedSites()
public void quit()
public void about()
public void showPreferences()
public void showPageSetupDialog()
public java.awt.print.PageFormat getCurrentPageFormat()
public TableWindow getTableWindow()
public PuffinActions getActions()
public SuiteEqAreaWindow getSuiteEqAreaWindow()
public SiteMeanWindow getSiteEqAreaWindow()
public EditSampleParametersWindow getEditSampleParametersWindow()
public TreatmentWindow getTreatmentWindow()
public RecentFileList getRecentFiles()
public void setRecentFiles(RecentFileList recentFiles)
recentFiles
- the list of recently used filespublic void showCustomFlagsWindow()
public void showCustomNotesWindow()
public void doAmsCalc(Suite.AmsCalcType calcType, java.lang.String scriptName)
calcType
- the type of calculation to performscriptName
- the external script which will perform the calculationspublic void showMacOpenFolderDialog()
public void showOpenFilesDialog(boolean createNewSuite)
createNewSuite
- If true
, or if there is no current suite,
a new suite will be created for the data from the files; otherwise,
the data will be added to the current suite.public void showImportAmsDialog()
Shows an ‘open files’ dialog box; if the user selects any files, AMS data will be imported from them. The files are expected to be in Agico ASC format, as produced by the SAFYR and SUSAR programs.
public void showImportPreferencesDialog()
Shows an ‘open file’ dialog box; if the user selects a file, the current preferences will be overwritten with preferences data from that file. The file is expected to contain Java Preferences data in XML format.
public void clearPreferences()
public void copyPointSelection()
pastePointSelection()
public void pastePointSelection()
copyPointSelection()
public void flipSelectedSamples(MeasurementAxis axis)
axis
- the axis around which to flip the selected samplespublic void rescaleMagSus()
public void clearSiteCalculations()
public void clearAmsCalcs()
public void exportPdfItext(java.io.File pdfFile) throws java.io.FileNotFoundException, com.lowagie.text.DocumentException
pdfFile
- the PDF file to which to write the plotscom.lowagie.text.DocumentException
- if an error occurred while writing the PDFjava.io.FileNotFoundException
- if the file exists but is a directory
rather than a regular file, does not exist but cannot be created,
or cannot be opened for any other reasonpublic void exportPdfFreehep(java.io.File pdfFile) throws java.io.IOException
pdfFile
- the PDF file to which to write the plotsjava.io.IOException
- if there was an error during file writingpublic void exportGraphics()
public void calculateMultiSuiteMeans()
public void runPythonScriptInGui(java.lang.String scriptPath) throws java.io.IOException, javax.script.ScriptException
scriptPath
- the path to the scriptjava.io.IOException
- if an IO error occurred while running the scriptjavax.script.ScriptException
- if a scripting error occurredpublic void showRunPythonScriptDialog()
public void runJavascriptScript(java.lang.String scriptPath) throws java.lang.Exception
java.lang.Exception
public void showRunJavascriptScriptDialog()
public PuffinApp.Version getVersion()
public void openWebPage(java.lang.String uriString)
uriString
- the URI to openpublic void save()
public void showPrintDialog(java.lang.String window)
window
- An identifier specifying the window to print;
valid values are MAIN, SITE, and SUITE.public void save(Suite suite)
suite
- the suite to savepublic void calculateRpi()
public void showDiscreteToContinuousDialog()
public void showCreateBundleDialog()