public class PuffinApp
extends java.lang.Object
PuffinApp
starts the PuffinPlot desktop application. It
starts with no visible windows; a call to show()
will open
the main window. PuffinApp
's main responsibility is connecting the
GUI classes 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
. The most significant data classes used in
PuffinApp
are Suite
, Site
, and Sample
.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 |
clearAmsCalcs()
Clears the results of any AMS calculations for the current suite.
|
void |
clearPreferences()
Shows a confirmation dialog.
|
void |
clearSiteCalculations()
Clears any previously calculated Fisherian or great-circle site
directions.
|
void |
closeCurrentSuite()
Closes the suite whose data is currently being displayed.
|
void |
copyStepSelection()
Copies the current pattern of selected treatment steps to a clipboard.
|
static PuffinApp |
create()
Create and return a new PuffinApp object.
|
void |
createNewSuite()
Creates a new, empty suite and adds it to the suite list.
|
void |
doAmsCalc(AmsCalculationType 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
treatment steps by principal component analysis.
|
void |
errorDialog(java.lang.String title,
java.lang.String message)
Displays a dialog box reporting an error over this PuffinApp's main
window.
|
static void |
errorDialog(java.lang.String title,
java.lang.String message,
java.awt.Component parent)
Displays a dialog box reporting an error.
|
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 treatment
steps.
|
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.
|
Sample |
getCurrentSample()
Gets the currently displayed Sample
|
Site |
getCurrentSite()
Returns the site for which data is currently being displayed.
|
Suite |
getCurrentSuite()
Returns the currently displayed Suite.
|
MainWindow |
getMainWindow()
Returns this PuffinApp's main window
|
PlotParams |
getPlotParams() |
PuffinPrefs |
getPrefs()
Returns the preferences for this PuffinApp.
|
RecentFileList |
getRecentFiles()
Returns the list of recently used files.
|
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.
|
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.
|
Version |
getVersion()
Returns the version of this PuffinPlot build.
|
void |
modifySelectedSamples(java.util.function.Consumer<Sample> function)
Applies the supplied function to each of the currently selected samples,
then redoes any existing calculations for the selected samples and any
sites that contain them.
|
java.util.List<java.io.File> |
openFileDialog(java.lang.String title)
Show an "open file" dialog.
|
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 |
pasteStepSelection()
For each selected sample, selects the treatment steps corresponding to
those last copied to the clipboard.
|
void |
quit()
Terminates this instance of PuffinApp immediately.
|
void |
recalculateSamplesAndSites(java.util.Collection<Sample> samples)
Redo existing sample and site calculations affected by specified samples.
|
void |
redoCalculationsForAllSuites()
Recalculates all sample and site calculations in all currently open
suites.
|
void |
runJavascriptScript(java.lang.String scriptPath)
Runs a specified script written in JavaScript
|
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 |
setCurrentSuite(int index)
Sets the currently displayed Suite.
|
void |
setRecentFiles(RecentFileList recentFiles)
Sets the list of recently used files (allowing it to be restored after
restarting the application).
|
void |
show()
Shows the main window of this PuffinApp.
|
void |
showCalculateRpiDialog()
Calculates RPI using two loaded suites.
|
void |
showCreateBundleDialog()
Shows the dialog for creating and exporting a data and code bundle.
|
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()
Shows the dialog for a discrete to continuous sample conversion.
|
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()
Show the "Open folder" dialog on Mac OS X.
|
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 |
showRescaleMagSusDialog()
Scales all magnetic susceptibility values in the current suite by
a user-specified factor.
|
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 static PuffinApp create()
public void show()
public PlotParams getPlotParams()
public void redoCalculationsForAllSuites()
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 recalculateSamplesAndSites(java.util.Collection<Sample> samples)
Any existing PCA calculations or great-circle fits will be done for the specified samples, and any existing great-circle or Fisherian calculations will be done for any site containing one of the specified samples. Site calculations will not be done for sites that don't have them already.
This method does not update the display.
samples
- samples which have changedpublic void fitGreatCirclesToSelection()
public void doPcaOnSelection()
Any affected Fisherian site means or great-circle directions will be recalculated automatically. These directions will not be calculated for any sites that don't have them already.
public PuffinPrefs getPrefs()
public MainWindow getMainWindow()
public Correction getCorrection()
public final 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 static void errorDialog(java.lang.String title, java.lang.String message, java.awt.Component parent)
<p>
element to allow it to word-wrap.title
- the title for the dialog boxmessage
- the message to be displayedparent
- the dialog will be displayed in this component's Framepublic void errorDialog(java.lang.String title, java.lang.String message)
errorDialog(java.lang.String, java.lang.String, java.awt.Component)
method.title
- the title for the dialog boxmessage
- the message to be displayedpublic java.util.List<Suite> getSuites()
public Suite getCurrentSuite()
public void setCurrentSuite(int index)
index
- the index of the suite to be displayed within PuffinApp's
list of suitespublic Sample getCurrentSample()
null
if there is no current
sample.public java.util.List<Sample> getSelectedSamples()
public void modifySelectedSamples(java.util.function.Consumer<Sample> function)
function
- function to apply to the currently selected samplespublic Site getCurrentSite()
null
if there is no current sitepublic 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 RecentFileList getRecentFiles()
public void setRecentFiles(RecentFileList recentFiles)
recentFiles
- the list of recently used filespublic void showCustomFlagsWindow()
public void showCustomNotesWindow()
public void doAmsCalc(AmsCalculationType calcType, java.lang.String scriptName)
calcType
- the type of calculation to performscriptName
- the external script which will perform the calculationspublic java.util.List<java.io.File> openFileDialog(java.lang.String title)
title
- title for the dialogpublic 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()
public void showImportPreferencesDialog()
public void clearPreferences()
public void copyStepSelection()
pasteStepSelection()
public void pasteStepSelection()
copyStepSelection()
public void flipSelectedSamples(MeasurementAxis axis)
axis
- the axis around which to flip the selected samplespublic void showRescaleMagSusDialog()
public void clearSiteCalculations()
public void clearAmsCalcs()
public void exportPdfItext(java.io.File pdfFile) throws java.io.FileNotFoundException, com.itextpdf.text.DocumentException
pdfFile
- the PDF file to which to write the plotscom.itextpdf.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 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)
scriptPath
- the path to the JavaScript scriptpublic void showRunJavascriptScriptDialog()
public Version getVersion()
public void openWebPage(java.lang.String uriString)
uriString
- the URI to openpublic void save()
If the suite has no current filename, one will be requested from the user using a standard file dialog.
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 showCalculateRpiDialog()
public void showDiscreteToContinuousDialog()
public void showCreateBundleDialog()