From ca80dcd76b6529b2cab82027f80a179be39f720c Mon Sep 17 00:00:00 2001 From: Jim Bowring Date: Thu, 11 Nov 2021 12:20:50 -0800 Subject: [PATCH] Updated to run on Java 8, 11, 17. (#204) * Updated Xstream and httpclient and new version * Upgraded to run on Java 8,11, and 17 * updated open screen to provide for github issue creator --- nb-configuration.xml | 1 - pom.xml | 38 +- src/main/java/org/earthtime/ETRedux.java | 2 +- src/main/java/org/earthtime/ETReduxFrame.form | 14 +- src/main/java/org/earthtime/ETReduxFrame.java | 95 ++- .../UPb_Redux/aliquots/UPbReduxAliquot.java | 2 - .../UPb_Redux/fractions/AnalysisFraction.java | 2 - .../UPbReduxFractions/UPbFraction.java | 2 - .../MineralStandardModel.java | 2 - .../earthtime/UPb_Redux/pbBlanks/PbBlank.java | 2 - .../samples/SESARSampleMetadata.java | 2 - .../UPb_Redux/samples/SampleMetaData.java | 2 - .../earthtime/UPb_Redux/tracers/Tracer.java | 714 +++++++----------- .../UPb_Redux/utilities/BrowserControl.java | 60 +- .../utilities/MacOSAboutHandler.java | 106 --- .../UPb_Redux/valueModels/ValueModel.java | 2 - .../UTh_Redux/aliquots/UThReduxAliquot.java | 2 - .../archivingTools/forSESAR/SesarSample.java | 2 - .../forSESAR/SesarSampleManager.form | 8 +- .../forSESAR/SesarSampleManager.java | 4 +- .../java/org/earthtime/dialogs/AboutBox.form | 4 +- .../java/org/earthtime/dialogs/AboutBox.java | 4 +- .../physicalConstants/PhysicalConstants.java | 2 - .../AbstractRatiosDataModel.java | 2 - .../reports/ReportSettingsInterface.java | 2 - 25 files changed, 430 insertions(+), 646 deletions(-) delete mode 100644 src/main/java/org/earthtime/UPb_Redux/utilities/MacOSAboutHandler.java diff --git a/nb-configuration.xml b/nb-configuration.xml index 80c97dd0..5b0f1f83 100644 --- a/nb-configuration.xml +++ b/nb-configuration.xml @@ -14,6 +14,5 @@ That way multiple projects can share the same settings (useful for formatting ru Any value defined here will override the pom.xml file value but is only applicable to the current project. --> true - JDK_1.8 diff --git a/pom.xml b/pom.xml index 2828425a..ce5b610e 100644 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ + + com.sun.activation + javax.activation + 1.2.0 + + + + javax.xml.bind + jaxb-api + 2.3.1 + + + + com.sun.xml.bind + jaxb-core + 3.0.2 + + + + com.sun.xml.bind + jaxb-impl + 2.3.1 + + + @@ -271,7 +298,7 @@ org.apache.maven.plugins maven-surefire-plugin - 2.20.1 + 3.0.0-M5 false @@ -290,6 +317,7 @@ 1.8 1.8 + true diff --git a/src/main/java/org/earthtime/ETRedux.java b/src/main/java/org/earthtime/ETRedux.java index 32083940..318df65e 100644 --- a/src/main/java/org/earthtime/ETRedux.java +++ b/src/main/java/org/earthtime/ETRedux.java @@ -88,7 +88,7 @@ public ETRedux(File reduxFile) //throws3 IOException, InvalidPreferencesFormatEx if (MAC_OS_X) { //http://www.developer.com/java/other/article.php/1577161 - System.setProperty("apple.laf.useScreenMenuBar", "true"); + System.setProperty("apple.laf.useScreenMenuBar", "false"); } // removed feb 2014 to support linux diff --git a/src/main/java/org/earthtime/ETReduxFrame.form b/src/main/java/org/earthtime/ETReduxFrame.form index 3a1eef3f..bd9395a2 100644 --- a/src/main/java/org/earthtime/ETReduxFrame.form +++ b/src/main/java/org/earthtime/ETReduxFrame.form @@ -913,8 +913,8 @@ - + @@ -952,6 +952,14 @@ + + + + + + + + @@ -1009,8 +1017,8 @@ - - + + diff --git a/src/main/java/org/earthtime/ETReduxFrame.java b/src/main/java/org/earthtime/ETReduxFrame.java index 7a1be7ae..c0b35458 100644 --- a/src/main/java/org/earthtime/ETReduxFrame.java +++ b/src/main/java/org/earthtime/ETReduxFrame.java @@ -109,9 +109,9 @@ import org.earthtime.UPb_Redux.user.ReduxPersistentState; import org.earthtime.UPb_Redux.utilities.AnnouncementPane; import org.earthtime.UPb_Redux.utilities.BrowserControl; +import static org.earthtime.UPb_Redux.utilities.BrowserControl.urlEncode; import org.earthtime.UPb_Redux.utilities.CustomIcon; import org.earthtime.UPb_Redux.utilities.ETSerializer; -import org.earthtime.UPb_Redux.utilities.MacOSAboutHandler; import org.earthtime.plots.evolution.TopsoilEvolutionPlot; import org.earthtime.XMLExceptions.BadOrMissingXMLSchemaException; import org.earthtime.aliquots.AliquotInterface; @@ -352,7 +352,7 @@ public ETReduxFrame( MAC_OS_X = lcOSName.startsWith("mac os x"); if (MAC_OS_X) { - new MacOSAboutHandler(this); +// new MacOSAboutHandler(this); } /** @@ -406,10 +406,16 @@ private void changeContentOfTopPanel(ReduxConstants.TOP_PANEL_CONTENTS contents) visitCIRDLESbutton.setBounds(FRAME_WIDTH / 2 - 175, 130, 350, 25); visitCIRDLESbutton.addActionListener(new ActionListenerForGotoCirdles()); announcementPane.add(visitCIRDLESbutton); + + JButton gitubIssuebutton = new ET_JButton("Create an Issue at GitHub.com"); + gitubIssuebutton.setFont(ReduxConstants.sansSerif_12_Bold); + gitubIssuebutton.setBounds(FRAME_WIDTH / 2 - 175, 160, 350, 25); + gitubIssuebutton.addActionListener(new ActionListenerForCreateIssueAtGithub()); + announcementPane.add(gitubIssuebutton); JTextArea announce = new JTextArea(// "ANNOUNCEMENT: We are looking forward to a productive 2016. "// - + "ET_Redux, for EARTHTIME Redux, will complete LA-CIP MS functionality for Laserchronbin preparation for additional isotope systems, such as U-series. "// + + "ET_Redux, for EARTHTIME Redux, will complete LA-CIP MS functionality for Laserchron in preparation for additional isotope systems, such as U-series. "// + "We are moving the project to a GitHub repository in the near future to make collaboration easier and more transparent. " + "We are seeking a new logo for ET_Redux and invite your submissions."); announce.setFont(ReduxConstants.sansSerif_12_Bold); @@ -462,6 +468,17 @@ public void actionPerformed(ActionEvent e) { BrowserControl.displayURL("https://github.com/CIRDLES/ET_Redux");// 25 Mar 2015 updated https://cirdles.org"); } } + + private static class ActionListenerForCreateIssueAtGithub implements ActionListener { + + public ActionListenerForCreateIssueAtGithub() { + } + + @Override + public void actionPerformed(ActionEvent e) { + contributeIssueOnGitHubAction(); + } + } // serialize to persistent state /** @@ -1907,6 +1924,20 @@ public void produceExcelReport(boolean isNumeric) { ExcelResultsTable.produceExcelResultsTable(// theSample.getSampleName(), reportFractions, isNumeric); } + + public static void contributeIssueOnGitHubAction() { + String version = "ET_Redux Version: " + ETRedux.VERSION; + String javaVersion = "Java Version: " + System.getProperties().getProperty("java.version"); + String operatingSystem = "OS: " + System.getProperties().getProperty("os.name") + " " + System.getProperties().getProperty("os.version"); + + StringBuilder issueBody = new StringBuilder(); + issueBody.append(urlEncode(version + "\n")); + issueBody.append(urlEncode(javaVersion + "\n")); + issueBody.append(urlEncode(operatingSystem + "\n")); + issueBody.append(urlEncode("\nIssue details:\n")); + + BrowserControl.displayURL("https://github.com/CIRDLES/ET_Redux/issues/new?body=" + issueBody); + } /** * @@ -2161,6 +2192,7 @@ private void initComponents() { changeLogMenuItem = new javax.swing.JMenuItem(); aboutMenuItem = new javax.swing.JMenuItem(); credits_menuItem = new javax.swing.JMenuItem(); + createGithubIssue = new javax.swing.JMenuItem(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("EARTHTIME Redux"); @@ -2178,7 +2210,7 @@ public void windowClosing(java.awt.event.WindowEvent evt) { }); buttonBar_panel.setBackground(new java.awt.Color(235, 255, 255)); - buttonBar_panel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); + buttonBar_panel.setBorder(javax.swing.BorderFactory.createLineBorder(null)); buttonBar_panel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); saveAndQuit_button.setBackground(new java.awt.Color(204, 204, 204)); @@ -2383,12 +2415,12 @@ public void componentResized(java.awt.event.ComponentEvent evt) { project_menu.setText("Project"); project_menu.addMenuListener(new javax.swing.event.MenuListener() { - public void menuSelected(javax.swing.event.MenuEvent evt) { - project_menuMenuSelected(evt); + public void menuCanceled(javax.swing.event.MenuEvent evt) { } public void menuDeselected(javax.swing.event.MenuEvent evt) { } - public void menuCanceled(javax.swing.event.MenuEvent evt) { + public void menuSelected(javax.swing.event.MenuEvent evt) { + project_menuMenuSelected(evt); } }); @@ -2581,13 +2613,13 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { sampleFileMenu.setToolTipText("UPb Redux Sample files are saved as [sample name].redux."); sampleFileMenu.setActionCommand("Redux File"); sampleFileMenu.addMenuListener(new javax.swing.event.MenuListener() { - public void menuSelected(javax.swing.event.MenuEvent evt) { - sampleFileMenuMenuSelected(evt); + public void menuCanceled(javax.swing.event.MenuEvent evt) { } public void menuDeselected(javax.swing.event.MenuEvent evt) { sampleFileMenuMenuDeselected(evt); } - public void menuCanceled(javax.swing.event.MenuEvent evt) { + public void menuSelected(javax.swing.event.MenuEvent evt) { + sampleFileMenuMenuSelected(evt); } }); sampleFileMenu.addActionListener(new java.awt.event.ActionListener() { @@ -2784,12 +2816,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { labDataMenu.setText("Lab Data"); labDataMenu.addMenuListener(new javax.swing.event.MenuListener() { - public void menuSelected(javax.swing.event.MenuEvent evt) { + public void menuCanceled(javax.swing.event.MenuEvent evt) { } public void menuDeselected(javax.swing.event.MenuEvent evt) { labDataMenuMenuDeselected(evt); } - public void menuCanceled(javax.swing.event.MenuEvent evt) { + public void menuSelected(javax.swing.event.MenuEvent evt) { } }); @@ -2901,12 +2933,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { reportMenu.setText("Reports"); reportMenu.addMenuListener(new javax.swing.event.MenuListener() { - public void menuSelected(javax.swing.event.MenuEvent evt) { + public void menuCanceled(javax.swing.event.MenuEvent evt) { } public void menuDeselected(javax.swing.event.MenuEvent evt) { reportMenuMenuDeselected(evt); } - public void menuCanceled(javax.swing.event.MenuEvent evt) { + public void menuSelected(javax.swing.event.MenuEvent evt) { } }); @@ -3031,12 +3063,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { referencesMenu.setText("References"); referencesMenu.addMenuListener(new javax.swing.event.MenuListener() { - public void menuSelected(javax.swing.event.MenuEvent evt) { + public void menuCanceled(javax.swing.event.MenuEvent evt) { } public void menuDeselected(javax.swing.event.MenuEvent evt) { referencesMenuMenuDeselected(evt); } - public void menuCanceled(javax.swing.event.MenuEvent evt) { + public void menuSelected(javax.swing.event.MenuEvent evt) { } }); @@ -3086,12 +3118,12 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { earthTimeWebSiteMenu.setText("Web Resources"); earthTimeWebSiteMenu.addMenuListener(new javax.swing.event.MenuListener() { - public void menuSelected(javax.swing.event.MenuEvent evt) { + public void menuCanceled(javax.swing.event.MenuEvent evt) { } public void menuDeselected(javax.swing.event.MenuEvent evt) { earthTimeWebSiteMenuMenuDeselected(evt); } - public void menuCanceled(javax.swing.event.MenuEvent evt) { + public void menuSelected(javax.swing.event.MenuEvent evt) { } }); @@ -3222,18 +3254,18 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { mainMenuBar.add(toolsMenu); helpMenu.setText("Help"); - helpMenu.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - helpMenuMouseClicked(evt); - } - }); helpMenu.addMenuListener(new javax.swing.event.MenuListener() { - public void menuSelected(javax.swing.event.MenuEvent evt) { + public void menuCanceled(javax.swing.event.MenuEvent evt) { } public void menuDeselected(javax.swing.event.MenuEvent evt) { helpMenuMenuDeselected(evt); } - public void menuCanceled(javax.swing.event.MenuEvent evt) { + public void menuSelected(javax.swing.event.MenuEvent evt) { + } + }); + helpMenu.addMouseListener(new java.awt.event.MouseAdapter() { + public void mouseClicked(java.awt.event.MouseEvent evt) { + helpMenuMouseClicked(evt); } }); @@ -3270,6 +3302,14 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { }); helpMenu.add(credits_menuItem); + createGithubIssue.setText("Create Github Issue"); + createGithubIssue.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + createGithubIssueActionPerformed(evt); + } + }); + helpMenu.add(createGithubIssue); + mainMenuBar.add(helpMenu); setJMenuBar(mainMenuBar); @@ -4500,6 +4540,10 @@ private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FI } }//GEN-LAST:event_jMenuItem1ActionPerformed + private void createGithubIssueActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createGithubIssueActionPerformed + contributeIssueOnGitHubAction(); + }//GEN-LAST:event_createGithubIssueActionPerformed + private void helpMenuItemActionPerformed(java.awt.event.ActionEvent evt) { BrowserControl.displayURL("http://cirdles.org/projects/et_redux/"); } @@ -4522,6 +4566,7 @@ private void helpMenuItemActionPerformed(java.awt.event.ActionEvent evt) { private javax.swing.JMenuItem changeLogMenuItem; private javax.swing.JMenuItem closeProjectFile_menuItem; private javax.swing.JMenuItem closeSampleFile; + private javax.swing.JMenuItem createGithubIssue; private javax.swing.JMenuItem credits_menuItem; private javax.swing.JMenuItem customizeSampleMetadata_menuItem; private javax.swing.JMenuItem deSelectAllFractions_menuItem; diff --git a/src/main/java/org/earthtime/UPb_Redux/aliquots/UPbReduxAliquot.java b/src/main/java/org/earthtime/UPb_Redux/aliquots/UPbReduxAliquot.java index 5a19eab3..a64e8e9a 100644 --- a/src/main/java/org/earthtime/UPb_Redux/aliquots/UPbReduxAliquot.java +++ b/src/main/java/org/earthtime/UPb_Redux/aliquots/UPbReduxAliquot.java @@ -540,8 +540,6 @@ public XStream getXStreamReader() { customizeXstream(xstream); - // http://x-stream.github.io/security.html - XStream.setupDefaultSecurity(xstream); // clear out existing permissions and set own ones xstream.addPermission(NoTypePermission.NONE); // allow some basics diff --git a/src/main/java/org/earthtime/UPb_Redux/fractions/AnalysisFraction.java b/src/main/java/org/earthtime/UPb_Redux/fractions/AnalysisFraction.java index 05c5f383..ce75b386 100644 --- a/src/main/java/org/earthtime/UPb_Redux/fractions/AnalysisFraction.java +++ b/src/main/java/org/earthtime/UPb_Redux/fractions/AnalysisFraction.java @@ -259,8 +259,6 @@ public XStream getXStreamReader() { customizeXstream(xstream); - // http://x-stream.github.io/security.html - XStream.setupDefaultSecurity(xstream); // clear out existing permissions and set own ones xstream.addPermission(NoTypePermission.NONE); // allow some basics diff --git a/src/main/java/org/earthtime/UPb_Redux/fractions/UPbReduxFractions/UPbFraction.java b/src/main/java/org/earthtime/UPb_Redux/fractions/UPbReduxFractions/UPbFraction.java index 0fd22c3c..93565d33 100644 --- a/src/main/java/org/earthtime/UPb_Redux/fractions/UPbReduxFractions/UPbFraction.java +++ b/src/main/java/org/earthtime/UPb_Redux/fractions/UPbReduxFractions/UPbFraction.java @@ -1529,8 +1529,6 @@ private XStream getXStreamReader() { customizeXstream(xstream); - // http://x-stream.github.io/security.html - XStream.setupDefaultSecurity(xstream); // clear out existing permissions and set own ones xstream.addPermission(NoTypePermission.NONE); // allow some basics diff --git a/src/main/java/org/earthtime/UPb_Redux/mineralStandardModels/MineralStandardModel.java b/src/main/java/org/earthtime/UPb_Redux/mineralStandardModels/MineralStandardModel.java index cd4af8dd..4cf0830e 100644 --- a/src/main/java/org/earthtime/UPb_Redux/mineralStandardModels/MineralStandardModel.java +++ b/src/main/java/org/earthtime/UPb_Redux/mineralStandardModels/MineralStandardModel.java @@ -306,8 +306,6 @@ private XStream getXStreamReader() { customizeXstream(xstream); - // http://x-stream.github.io/security.html - XStream.setupDefaultSecurity(xstream); // clear out existing permissions and set own ones xstream.addPermission(NoTypePermission.NONE); // allow some basics diff --git a/src/main/java/org/earthtime/UPb_Redux/pbBlanks/PbBlank.java b/src/main/java/org/earthtime/UPb_Redux/pbBlanks/PbBlank.java index b5695ad1..2282ce3c 100644 --- a/src/main/java/org/earthtime/UPb_Redux/pbBlanks/PbBlank.java +++ b/src/main/java/org/earthtime/UPb_Redux/pbBlanks/PbBlank.java @@ -454,8 +454,6 @@ public XStream getXStreamReader() { customizeXstream(xstream); - // http://x-stream.github.io/security.html - XStream.setupDefaultSecurity(xstream); // clear out existing permissions and set own ones xstream.addPermission(NoTypePermission.NONE); // allow some basics diff --git a/src/main/java/org/earthtime/UPb_Redux/samples/SESARSampleMetadata.java b/src/main/java/org/earthtime/UPb_Redux/samples/SESARSampleMetadata.java index 1f2cb014..a3ae2d7e 100644 --- a/src/main/java/org/earthtime/UPb_Redux/samples/SESARSampleMetadata.java +++ b/src/main/java/org/earthtime/UPb_Redux/samples/SESARSampleMetadata.java @@ -185,8 +185,6 @@ public XStream getXStreamReader() { customizeXstream(xstream); - // http://x-stream.github.io/security.html - XStream.setupDefaultSecurity(xstream); // clear out existing permissions and set own ones xstream.addPermission(NoTypePermission.NONE); // allow some basics diff --git a/src/main/java/org/earthtime/UPb_Redux/samples/SampleMetaData.java b/src/main/java/org/earthtime/UPb_Redux/samples/SampleMetaData.java index dd9f7eab..050d9d00 100644 --- a/src/main/java/org/earthtime/UPb_Redux/samples/SampleMetaData.java +++ b/src/main/java/org/earthtime/UPb_Redux/samples/SampleMetaData.java @@ -152,8 +152,6 @@ public XStream getXStreamReader() { customizeXstream(xstream); - // http://x-stream.github.io/security.html - XStream.setupDefaultSecurity(xstream); // clear out existing permissions and set own ones xstream.addPermission(NoTypePermission.NONE); // allow some basics diff --git a/src/main/java/org/earthtime/UPb_Redux/tracers/Tracer.java b/src/main/java/org/earthtime/UPb_Redux/tracers/Tracer.java index 3657c391..cbe791a9 100644 --- a/src/main/java/org/earthtime/UPb_Redux/tracers/Tracer.java +++ b/src/main/java/org/earthtime/UPb_Redux/tracers/Tracer.java @@ -52,8 +52,9 @@ import org.earthtime.xmlUtilities.XMLSerializationI; /** - * Deprecated June 2012. Needed for compatibility with legacy serializations (archives). - * Replaced with TracerUPbModel. + * Deprecated June 2012. Needed for compatibility with legacy serializations + * (archives). Replaced with TracerUPbModel. + * * @author James F. Bowring, javaDocs by Stan Gasque */ public class Tracer implements @@ -72,7 +73,7 @@ public class Tracer implements /** * @return the serialVersionUID */ - public static long getSerialVersionUID () { + public static long getSerialVersionUID() { return serialVersionUID; } /** @@ -81,38 +82,31 @@ public static long getSerialVersionUID () { private transient String tracerXMLSchemaURL; // Instance variables /** - * name of this - * Tracer + * name of this Tracer */ private String tracerName; /** - * version number of this - * Tracer + * version number of this Tracer */ private int versionNumber; /** - * type of this - * Tracer + * type of this Tracer */ private String tracerType; /** - * lab name for this - * Tracer + * lab name for this Tracer */ private String labName; /** - * date that this - * Tracer was certified + * date that this Tracer was certified */ private String dateCertified; /** - * collection of ratios for this - * Tracer + * collection of ratios for this Tracer */ private ValueModel[] ratios; /** - * collection of isotope concentrations for this - * Tracer + * collection of isotope concentrations for this Tracer */ private ValueModel[] isotopeConcentrations; @@ -120,7 +114,7 @@ public static long getSerialVersionUID () { /** * creates a new instance of Tracer with blank fields. */ - public Tracer () { + public Tracer() { this.tracerName = ReduxConstants.DEFAULT_OBJECT_NAME; this.versionNumber = 0; this.tracerType = DataDictionary.TracerType[0].trim(); @@ -129,33 +123,32 @@ public Tracer () { this.dateCertified = DateHelpers.defaultEarthTimeDateString(); ratios = new ValueModel[TracerRatiosEnum.getNames().length]; - for (int ratioIndex = 0; ratioIndex < TracerRatiosEnum.getNames().length; ratioIndex ++) { - ratios[ratioIndex] = new ValueModel( TracerRatiosEnum.getNames()[ratioIndex], "PCT" ); + for (int ratioIndex = 0; ratioIndex < TracerRatiosEnum.getNames().length; ratioIndex++) { + ratios[ratioIndex] = new ValueModel(TracerRatiosEnum.getNames()[ratioIndex], "PCT"); } - Arrays.sort( ratios ); + Arrays.sort(ratios); - this.isotopeConcentrations = // + this.isotopeConcentrations + = // new ValueModel[TracerIsotopes.getNames().length]; //DataDictionary.isotopeNames.length]; - for (int isotopeIndex = 0; isotopeIndex < TracerIsotopes.getNames().length; isotopeIndex ++) { - isotopeConcentrations[isotopeIndex] = - new ValueModel( TracerIsotopes.getNames()[isotopeIndex], "PCT" ); + for (int isotopeIndex = 0; isotopeIndex < TracerIsotopes.getNames().length; isotopeIndex++) { + isotopeConcentrations[isotopeIndex] + = new ValueModel(TracerIsotopes.getNames()[isotopeIndex], "PCT"); } - Arrays.sort( isotopeConcentrations ); + Arrays.sort(isotopeConcentrations); } /** - * creates a new instance of Tracer with its - * tracerName set to argument - * tracerName and all other fields initialized to default - * values. + * creates a new instance of Tracer with its tracerName set to + * argument tracerName and all other fields initialized to + * default values. * - * @param tracerName value to set this new - * Tracer's + * @param tracerName value to set this new Tracer's * tracerName to */ - public Tracer ( String tracerName ) { + public Tracer(String tracerName) { this(); this.tracerName = tracerName.trim(); } @@ -165,19 +158,18 @@ public Tracer ( String tracerName ) { * * @return */ - protected Object readResolve () { + protected Object readResolve() { // march 2012 conversion to new TracerUPbModel AbstractRatiosDataModel tracerUPbModel; - if ( (this.tracerName.equalsIgnoreCase( "" )) ) { + if ((this.tracerName.equalsIgnoreCase(""))) { tracerUPbModel = TracerUPbModel.getNoneInstance(); } else { - tracerUPbModel = convertModel( this ); + tracerUPbModel = convertModel(this); } - return tracerUPbModel; } @@ -186,296 +178,219 @@ protected Object readResolve () { * @param model * @return */ - public static AbstractRatiosDataModel convertModel ( Tracer model ) { + public static AbstractRatiosDataModel convertModel(Tracer model) { // add isotope concentrations into ratios ArrayList tracerRatios = new ArrayList(); - tracerRatios.addAll( Arrays.asList( model.ratios ) ); - tracerRatios.addAll( Arrays.asList( model.isotopeConcentrations ) ); - ValueModel[] tracerRatiosArray = tracerRatios.toArray( new ValueModel[tracerRatios.size()] ); + tracerRatios.addAll(Arrays.asList(model.ratios)); + tracerRatios.addAll(Arrays.asList(model.isotopeConcentrations)); + ValueModel[] tracerRatiosArray = tracerRatios.toArray(new ValueModel[tracerRatios.size()]); return// TracerUPbModel.createInstance( // - model.tracerName, // - model.versionNumber, // - 0, // - model.tracerType,// - model.labName,// - model.dateCertified,// - "No reference", // - "No comment", // - tracerRatiosArray, // - null ); - } - - /** - * compares this - * Tracer to argument - * tracer by their - * name and - * version. - * - * @pre argument - * tracer is a valid - * Tracer @post returns an - * int representing the comparison between this - * Tracer and argument - * tracer - * - * @param tracer - * Tracer to compare this - * Tracer to - * @return - * int - 0 if this - * Tracer's - * name and - * version is the same as argument + model.tracerName, // + model.versionNumber, // + 0, // + model.tracerType,// + model.labName,// + model.dateCertified,// + "No reference", // + "No comment", // + tracerRatiosArray, // + null); + } + + /** + * compares this Tracer to argument tracer by + * their name and version. + * + * @pre argument tracer is a valid Tracer @post + * returns an int representing the comparison between this + * Tracer and argument tracer + * + * @param tracer Tracer to compare this Tracer to + * @return int - 0 if this Tracer's + * name and version is the same as argument * tracer's, -1 if they are lexicographically less than - * argument - * tracer's, and 1 if they are greater than argument + * argument tracer's, and 1 if they are greater than argument * tracer's * @throws java.lang.ClassCastException a ClassCastException */ @Override - public int compareTo ( Tracer tracer ) throws ClassCastException { - String tracerID =// + public int compareTo(Tracer tracer) throws ClassCastException { + String tracerID + =// ((Tracer) tracer).getNameAndVersion().trim() // + ((Tracer) tracer).getTracerType().trim(); return (this.getNameAndVersion().trim() // - + this.getTracerType().trim()).compareToIgnoreCase( tracerID ); + + this.getTracerType().trim()).compareToIgnoreCase(tracerID); } /** - * compares this - * Tracer to argument - * tracer by - * their - * name and - * version. + * compares this Tracer to argument tracer by + * their name and version. * - * @pre argument - * tracer is a valid - * Tracer @post returns a - * boolean representing the equality of this - * Tracer and argument - * tracer based on their - * name and - * version + * @pre argument tracer is a valid Tracer @post + * returns a boolean representing the equality of this + * Tracer and argument tracer based on their + * name and version * - * @param tracer - * Tracer to compare this - * Tracer to - * @return - * boolean - - * true if argument - * - * tracer is this - * Tracer or their - * name and - * version are identical, else - * false + * @param tracer Tracer to compare this Tracer to + * @return boolean - true if argument + * tracer is this Tracer or their name and + * version are identical, else false */ @Override - public boolean equals ( Object tracer ) { + public boolean equals(Object tracer) { //check for self-comparison - if ( this == tracer ) { + if (this == tracer) { return true; } - if ( ! (tracer instanceof Tracer) ) { + if (!(tracer instanceof Tracer)) { return false; } Tracer myTracer = (Tracer) tracer; - return (this.getNameAndVersion().trim().compareToIgnoreCase( myTracer.getNameAndVersion().trim() ) == 0); + return (this.getNameAndVersion().trim().compareToIgnoreCase(myTracer.getNameAndVersion().trim()) == 0); } /** - * returns 0 as the hashcode for this - * Tracer. Implemented to meet equivalency requirements as - * documented by + * returns 0 as the hashcode for this Tracer. Implemented to + * meet equivalency requirements as documented by * java.lang.Object * - * @pre this - * Tracer exists @post hashcode of 0 is returned for this - * Tracer + * @pre this Tracer exists @post hashcode of 0 is returned for + * this Tracer * - * @return - * int - 0 + * @return int - 0 */ // http://www.javaworld.com/javaworld/jw-01-1999/jw-01-object.html?page=4 @Override - public int hashCode () { + public int hashCode() { return 0; } /** - * gets the - * tracerName of this - * Tracer. + * gets the tracerName of this Tracer. * - * @pre this - * Tracer exists @post returns this - * Tracer's - * tracerName + * @pre this Tracer exists @post returns this + * Tracer's tracerName * - * @return - * String - this - * Tracer's + * @return String - this Tracer's * tracerName */ @Override - public String getTracerName () { + public String getTracerName() { return tracerName; } /** - * gets the - * versionNumber of this - * Tracer. + * gets the versionNumber of this Tracer. * - * @pre this - * Tracer exists @post returns this - * Tracer's - * versionNumber + * @pre this Tracer exists @post returns this + * Tracer's versionNumber * - * @return - * int - this - * Tracer's + * @return int - this Tracer's * versionNumber */ @Override - public int getVersionNumber () { + public int getVersionNumber() { return versionNumber; } /** - * gets the - * labName of this - * Tracer. + * gets the labName of this Tracer. * - * @pre this - * Tracer exists @post returns this - * Tracer's - * labName + * @pre this Tracer exists @post returns this + * Tracer's labName * - * @return - * String - this - * Tracer's + * @return String - this Tracer's * labName */ @Override - public String getLabName () { + public String getLabName() { return labName; } /** - * gets the - * dateCertified of this - * Tracer. + * gets the dateCertified of this Tracer. * - * @pre this - * Tracer exists @post returns this - * Tracer's - * dateCertified + * @pre this Tracer exists @post returns this + * Tracer's dateCertified * - * @return - * String - this - * Tracer's + * @return String - this Tracer's * dateCertified */ @Override - public String getDateCertified () { + public String getDateCertified() { return dateCertified; } /** - * sets this - * Tracer's - * tracerName to argument + * sets this Tracer's tracerName to argument * tracerName. * - * @pre argument - * tracerName is a valid - * String @post this - * Tracer's - * tracerName is set to argument - * tracerName + * @pre argument tracerName is a valid String + * @post this Tracer's tracerName is set to + * argument tracerName * - * @param tracerName value to set this - * Tracer's + * @param tracerName value to set this Tracer's * tracerName to */ @Override - public void setTracerName ( String tracerName ) { + public void setTracerName(String tracerName) { this.tracerName = tracerName.trim(); } /** - * sets this - * Tracer's versionNumber to argument + * sets this Tracer's versionNumber to argument * versionNumber. * - * @pre argument - * versionNumber is a valid - * int @post this - * Tracer's - * versionNumber is set to argument - * versionNumber + * @pre argument versionNumber is a valid int + * @post this Tracer's versionNumber is set to + * argument versionNumber * - * @param versionNumber value to set this - * Tracer's + * @param versionNumber value to set this Tracer's * versionNumber to */ @Override - public void setVersionNumber ( int versionNumber ) { + public void setVersionNumber(int versionNumber) { this.versionNumber = versionNumber; } /** - * sets this - * Tracer's - * labName to argument + * sets this Tracer's labName to argument * labName. * - * @pre argument - * labName is a valid - * String @post this - * Tracer's - * labName is set to argument + * @pre argument labName is a valid String @post + * this Tracer's labName is set to argument * labName * - * @param labName value to set this - * Tracer's + * @param labName value to set this Tracer's * labName to */ @Override - public void setLabName ( String labName ) { + public void setLabName(String labName) { this.labName = labName.trim(); } /** - * sets this - * Tracer's - * dateCertified to argument + * sets this Tracer's dateCertified to argument * dateCertified. * - * @pre argument - * dateCertified is a valid - * String @post this - * Tracer's - * dateCertified is set to argument - * dateCertified + * @pre argument dateCertified is a valid String + * @post this Tracer's dateCertified is set to + * argument dateCertified * - * @param dateCertified value to set this - * Tracer's + * @param dateCertified value to set this Tracer's * dateCertified to */ @Override - public void setDateCertified ( String dateCertified ) { - DateFormat df = new SimpleDateFormat( "yyyy-MM-dd" ); + public void setDateCertified(String dateCertified) { + DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); try { - Date testDate = df.parse( dateCertified.trim() ); + Date testDate = df.parse(dateCertified.trim()); } catch (ParseException parseException) { this.dateCertified = DateHelpers.defaultEarthTimeDateString(); } @@ -484,46 +399,34 @@ public void setDateCertified ( String dateCertified ) { } /** - * gets the - * tracerType of this - * Tracer. + * gets the tracerType of this Tracer. * - * @pre this - * Tracer exists @post returns the this - * Tracer's - * tracerType + * @pre this Tracer exists @post returns the this + * Tracer's tracerType * - * @return - * String - this - * Tracer's + * @return String - this Tracer's * tracerType */ @Override - public String getTracerType () { + public String getTracerType() { return tracerType; } /** - * sets this - * Tracer's - * tracerType to argument + * sets this Tracer's tracerType to argument * tracerType. * - * @pre argument - * tracerType is a valid - * String @post this - * Tracer's - * tracerType is set to argument - * tracerType + * @pre argument tracerType is a valid String + * @post this Tracer's tracerType is set to + * argument tracerType * - * @param tracerType value to set this - * Tracer's + * @param tracerType value to set this Tracer's * tracerType to */ @Override - public void setTracerType ( String tracerType ) { + public void setTracerType(String tracerType) { String temp = tracerType.trim(); - if ( DataDictionary.legalTracerType( temp ) ) { + if (DataDictionary.legalTracerType(temp)) { this.tracerType = temp; } else { this.tracerType = "NONE"; @@ -531,182 +434,131 @@ public void setTracerType ( String tracerType ) { } /** - * gets a - * String containing this - * Tracer's - * tracerName and - * versionNumber. + * gets a String containing this Tracer's + * tracerName and versionNumber. * - * @pre this - * Tracer exists @post returns a - * String containing this - * Tracer's - * tracerName and + * @pre this Tracer exists @post returns a String + * containing this Tracer's tracerName and * versionNumber * - * @return - * String - this - * Tracer's - * tracerName and - * versionNumber + * @return String - this Tracer's + * tracerName and versionNumber */ @Override - public String getNameAndVersion () { + public String getNameAndVersion() { return getTracerName().trim()// + " v." + getVersionNumber(); } /** - * gets the - * ratios of this - * Tracer. + * gets the ratios of this Tracer. * - * @pre this - * Tracer exists @post returns this - * Tracer's - * ratios + * @pre this Tracer exists @post returns this + * Tracer's ratios * - * @return - * ValueModel[] - collection of this - * Tracer's - * ratios + * @return ValueModel[] - collection of this + * Tracer's ratios */ @Override - public ValueModel[] getRatios () { + public ValueModel[] getRatios() { return ratios; } /** - * sets this - * Tracer's - * ratios to argument + * sets this Tracer's ratios to argument * ratios. * - * @pre argument - * ratios is a valid collection of - * ValueModel @post this - * Tracer's - * ratios is set to argument - * ratios + * @pre argument ratios is a valid collection of + * ValueModel @post this Tracer's + * ratios is set to argument ratios * - * @param ratios collection of values to set this - * Tracer's + * @param ratios collection of values to set this Tracer's * ratios to */ @Override - public void setRatios ( ValueModel[] ratios ) { - this.ratios = ValueModel.cullNullsFromArray( ratios ); + public void setRatios(ValueModel[] ratios) { + this.ratios = ValueModel.cullNullsFromArray(ratios); } /** - * gets the - * isotopeConcentrations of this - * Tracer. + * gets the isotopeConcentrations of this Tracer. * - * @pre this - * Tracer exists @post returns this - * Tracer's - * isotopeConcentrations + * @pre this Tracer exists @post returns this + * Tracer's isotopeConcentrations * - * @return - * ValueModel[] - collection of this - * Tracer's - * isotopeConcentrations + * @return ValueModel[] - collection of this + * Tracer's isotopeConcentrations */ @Override - public ValueModel[] getIsotopeConcentrations () { + public ValueModel[] getIsotopeConcentrations() { return isotopeConcentrations; } /** - * sets this - * Tracer's - * isotopeConcentrations to argument - * isotopeConcentrations. + * sets this Tracer's isotopeConcentrations to + * argument isotopeConcentrations. * - * @pre argument - * isotopeConcentrations is a valid collection of - * ValueModel @post this - * Tracer's + * @pre argument isotopeConcentrations is a valid collection of + * ValueModel @post this Tracer's * isotopeConcentrations is set to argument * isotopeConcentrations * * @param isotopeConcentrations collection of values to set this - * Tracer's - * + * Tracer's * isotopeConcentration to */ @Override - public void setIsotopeConcentrations ( ValueModel[] isotopeConcentrations ) { - this.isotopeConcentrations = ValueModel.cullNullsFromArray( isotopeConcentrations ); + public void setIsotopeConcentrations(ValueModel[] isotopeConcentrations) { + this.isotopeConcentrations = ValueModel.cullNullsFromArray(isotopeConcentrations); } /** - * gets the - * tracerName and - * versionNumber of this + * gets the tracerName and versionNumber of this * Tracer via {@link #getNameAndVersion getNameAndVersion}. * - * @pre this - * Tracer exists @post returns a - * String containing this - * Tracer's - * tracerName and + * @pre this Tracer exists @post returns a String + * containing this Tracer's tracerName and * versionNumber * - * @return - * String - this - * Tracer's - * - * tracerName and - * versionNumber + * @return String - this Tracer's + * tracerName and versionNumber */ @Override - public String getReduxLabDataElementName () { + public String getReduxLabDataElementName() { return getNameAndVersion(); } /** - * gets a single ratio from this - * Tracer's - * ratios specified by argument - * ratioName. Returns a new, empty - * + * gets a single ratio from this Tracer's ratios + * specified by argument ratioName. Returns a new, empty * ValueModel if no matching ratio is found. * - * @pre argument - * ratioName is a valid - * String @post returns the - * ValueModel found in this - * Tracer's - * ratios whose name matches argument - * ratioName + * @pre argument ratioName is a valid String @post + * returns the ValueModel found in this Tracer's + * ratios whose name matches argument ratioName * * @param ratioName name of the ratio to search for - * @return - * ValueModel - ratio found in - * ratios whose name matches argument - * ratioName or a new - * + * @return ValueModel - ratio found in ratios + * whose name matches argument ratioName or a new * ValueModel if no match is found */ @Override - public ValueModel getRatioByName ( String ratioName ) { + public ValueModel getRatioByName(String ratioName) { ValueModel retVal = null; - for (int i = 0; i < ratios.length; i ++) { - if ( ratios[i].getName().equals( ratioName ) ) { + for (int i = 0; i < ratios.length; i++) { + if (ratios[i].getName().equals(ratioName)) { retVal = ratios[i]; } } - if ( retVal == null ) { + if (retVal == null) { // not found // jan 2011 make more robust to handle changing specs for tracers - retVal = new ValueModel( ratioName, "PCT" ); + retVal = new ValueModel(ratioName, "PCT"); ValueModel[] temp = new ValueModel[ratios.length + 1]; - System.arraycopy( ratios, 0, temp, 0, ratios.length ); + System.arraycopy(ratios, 0, temp, 0, ratios.length); temp[temp.length - 1] = retVal; ratios = temp; @@ -716,45 +568,41 @@ public ValueModel getRatioByName ( String ratioName ) { } /** - * gets the isotope concentration found in this - * Tracer's + * gets the isotope concentration found in this Tracer's * isotopeConcentrations whose name matches argument - * isotopeConc. Returns a new, empty - * ValueModel if no match is found. + * isotopeConc. Returns a new, empty ValueModel if + * no match is found. * - * @pre argument isotopeConc is a valid - * String @post returns the - * ValueModel found in - * + * @pre argument isotopeConc is a valid String @post returns + * the ValueModel found in * isotopeConcentrations whose name matches argument * isotopeConc * * @param isotopeConc name of the isotope concentration to search for - * @return - * ValueModel - isotope concentration found in + * @return ValueModel - isotope concentration found in * isotopeConcentrations whose name matches argument - * isotopeConc or a new - * ValueModel if no match is found + * isotopeConc or a new ValueModel if no match is + * found */ @Override - public ValueModel getIsotopeConcByName ( String isotopeConc ) { + public ValueModel getIsotopeConcByName(String isotopeConc) { ValueModel retVal = null; - for (int i = 0; i < getIsotopeConcentrations().length; i ++) { - if ( getIsotopeConcentrations()[i].getName().equals( isotopeConc ) ) { + for (int i = 0; i < getIsotopeConcentrations().length; i++) { + if (getIsotopeConcentrations()[i].getName().equals(isotopeConc)) { retVal = getIsotopeConcentrations()[i]; } } - if ( retVal == null ) { + if (retVal == null) { // not found // jan 2011 make more robust to handle changing specs for tracers - retVal = new ValueModel( isotopeConc, "PCT" ); + retVal = new ValueModel(isotopeConc, "PCT"); ValueModel[] temp = new ValueModel[getIsotopeConcentrations().length + 1]; - System.arraycopy( getIsotopeConcentrations(), 0, temp, 0, getIsotopeConcentrations().length ); + System.arraycopy(getIsotopeConcentrations(), 0, temp, 0, getIsotopeConcentrations().length); temp[temp.length - 1] = retVal; - setIsotopeConcentrations( temp ); + setIsotopeConcentrations(temp); } return retVal; @@ -765,119 +613,104 @@ public ValueModel getIsotopeConcByName ( String isotopeConc ) { * * @return @pre @post */ - public static String[] getListOfEarthTimeTracers () { + public static String[] getListOfEarthTimeTracers() { UPbReduxConfigurator myConfigurator = new UPbReduxConfigurator(); - String tracers = - URIHelper.getTextFromURI( - myConfigurator.getResourceURI( "URI_EARTHTIME_XMLTracers" )// - + ".tracerList.txt" ); + String tracers + = URIHelper.getTextFromURI( + myConfigurator.getResourceURI("URI_EARTHTIME_XMLTracers")// + + ".tracerList.txt"); - String[] retVal = tracers.split( "\n" ); + String[] retVal = tracers.split("\n"); return retVal; } // XML Serialization /** - * gets an - * XStream writer. Creates, customizes, and returns + * gets an XStream writer. Creates, customizes, and returns * XStream for XML serialization * - * @pre - * XStream package is available @post - * XStream for XML encoding is returned + * @pre XStream package is available @post XStream + * for XML encoding is returned * - * @return - * XStream - for XML serialization encoding + * @return XStream - for XML serialization encoding */ - private XStream getXStreamWriter () { - XStream xstream = new XStream( new DomDriver() ); + private XStream getXStreamWriter() { + XStream xstream = new XStream(new DomDriver()); - customizeXstream( xstream ); + customizeXstream(xstream); return xstream; } /** - * gets an - * XStream reader. Creates, customizes, and returns + * gets an XStream reader. Creates, customizes, and returns * XStream for XML serialization * - * @pre - * XStream package is available @post - * XStream for XML decoding is returned + * @pre XStream package is available @post XStream + * for XML decoding is returned * - * @return - * XStream - for XML serialization decoding + * @return XStream - for XML serialization decoding */ - private XStream getXStreamReader () { + private XStream getXStreamReader() { - XStream xstream = new XStream( new DomDriver() ); + XStream xstream = new XStream(new DomDriver()); - customizeXstream( xstream ); + customizeXstream(xstream); return xstream; } /** - * registers converter for argument - * xstream and sets aliases to make the XML file more - * human-readable + * registers converter for argument xstream and sets aliases to + * make the XML file more human-readable * - * @pre argument - * xstream is a valid - * XStream @post argument - * xstream is customized to produce a cleaner output + * @pre argument xstream is a valid XStream @post + * argument xstream is customized to produce a cleaner output * file * - * @param xstream - * XStream to be customized + * @param xstream XStream to be customized */ - private void customizeXstream ( XStream xstream ) { + private void customizeXstream(XStream xstream) { - xstream.registerConverter( new ValueModelXMLConverter() ); - xstream.registerConverter( new TracerXMLConverter() ); + xstream.registerConverter(new ValueModelXMLConverter()); + xstream.registerConverter(new TracerXMLConverter()); - xstream.alias( "Tracer", Tracer.class ); - xstream.alias( "ValueModel", ValueModel.class ); + xstream.alias("Tracer", Tracer.class); + xstream.alias("ValueModel", ValueModel.class); setClassXMLSchemaURL(); } /** - * sets the XML schema. Initializes - * UPbReduxConfigurator and sets the location of the XML Schema + * sets the XML schema. Initializes UPbReduxConfigurator and + * sets the location of the XML Schema * - * @pre - * UPbReduxConfigurator class is available @post + * @pre UPbReduxConfigurator class is available @post * TracerXMLSchemaURL will be set */ - private void setClassXMLSchemaURL () { + private void setClassXMLSchemaURL() { UPbReduxConfigurator myConfigurator = new UPbReduxConfigurator(); - tracerXMLSchemaURL = - myConfigurator.getResourceURI( "URI_TracerXMLSchema" ); + tracerXMLSchemaURL + = myConfigurator.getResourceURI("URI_TracerXMLSchema"); } /** - * encodes this - * Tracer to the - * file specified by the argument - * filename + * encodes this Tracer to the file specified by + * the argument filename * - * @pre this - * Tracer exists @post this - * Tracer is stored in the specified XML - * file + * @pre this Tracer exists @post this Tracer is + * stored in the specified XML file * * @param filename location to store data to */ @Override - public void serializeXMLObject ( String filename ) { + public void serializeXMLObject(String filename) { XStream xstream = getXStreamWriter(); - String xml = xstream.toXML( this ); + String xml = xstream.toXML(this); xml = ReduxConstants.XML_Header + xml; @@ -885,15 +718,14 @@ public void serializeXMLObject ( String filename ) { "Tracer "// + ReduxConstants.XML_ResourceHeader// + tracerXMLSchemaURL// - + "\"" ); - + + "\""); try { - FileWriter outFile = new FileWriter( filename ); - PrintWriter out = new PrintWriter( outFile ); + FileWriter outFile = new FileWriter(filename); + PrintWriter out = new PrintWriter(outFile); // Write xml to file - out.println( xml ); + out.println(xml); out.flush(); out.close(); outFile.close(); @@ -904,58 +736,53 @@ public void serializeXMLObject ( String filename ) { } /** - * decodes - * Tracer from - * file specified by argument + * decodes Tracer from file specified by argument * filename * * @param filename location to read data from * @param doValidate the value of doValidate - * @return - * Object - the - * Tracer created from the specified XML - * file + * @return Object - the Tracer created from the + * specified XML file * @throws java.io.FileNotFoundException * @throws org.earthtime.XMLExceptions.ETException * @throws org.earthtime.XMLExceptions.BadOrMissingXMLSchemaException @pre - * filename references an XML - * file @post - * Tracer stored in - * filename is returned + * filename references an XML file @post + * Tracer stored in filename is returned */ @Override - public Object readXMLObject ( String filename, boolean doValidate ) + public Object readXMLObject(String filename, boolean doValidate) throws FileNotFoundException, ETException, BadOrMissingXMLSchemaException { Tracer myTracer = null; - BufferedReader reader = URIHelper.getBufferedReader( filename ); + BufferedReader reader = URIHelper.getBufferedReader(filename); - if ( reader != null ) { + if (reader != null) { XStream xstream = getXStreamReader(); + xstream.allowTypesByWildcard(new String[]{ + "org.earthtime.UPb_Redux.tracers.**", + }); - boolean temp = URIHelper.validateXML( reader, filename, tracerXMLSchemaURL ); + boolean temp = URIHelper.validateXML(reader, filename, tracerXMLSchemaURL); - if ( temp ) { + if (temp) { // re-create reader - reader = URIHelper.getBufferedReader( filename ); + reader = URIHelper.getBufferedReader(filename); try { - myTracer = (Tracer) xstream.fromXML( reader ); + myTracer = (Tracer) xstream.fromXML(reader); } catch (ConversionException e) { - throw new ETException( null, e.getMessage() ); + throw new ETException(null, e.getMessage()); } // System.out.println( "This is your Tracer that was just read successfully:\n" ); - // String xml2 = getXStreamWriter().toXML( myTracer ); // // System.out.println( xml2 ); // System.out.flush(); - } else { - throw new ETException( null, "Badly formed XML data file." ); + throw new ETException(null, "Badly formed XML data file."); } } else { - throw new FileNotFoundException( "Missing XML data file." ); + throw new FileNotFoundException("Missing XML data file."); } return myTracer; @@ -988,12 +815,11 @@ public Object readXMLObject ( String filename, boolean doValidate ) // System.out.flush(); // } // } - /** * */ @Override - public void removeSelf () { + public void removeSelf() { // throw new UnsupportedOperationException( "Not supported yet." ); } } diff --git a/src/main/java/org/earthtime/UPb_Redux/utilities/BrowserControl.java b/src/main/java/org/earthtime/UPb_Redux/utilities/BrowserControl.java index a13605c5..f02064e6 100644 --- a/src/main/java/org/earthtime/UPb_Redux/utilities/BrowserControl.java +++ b/src/main/java/org/earthtime/UPb_Redux/utilities/BrowserControl.java @@ -21,6 +21,8 @@ package org.earthtime.UPb_Redux.utilities; import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; /** * @@ -28,34 +30,33 @@ * * * A simple, static class to display a URL in the system browser. - - * - * Under Unix, the system browser is hard-coded to be 'netscape'. - * Netscape must be in your PATH for this to work. This has been - * tested with the following platforms: AIX, HP-UX and Solaris. - - * - * Under Windows, this will bring up the default browser under windows, - * usually either Netscape or Microsoft IE. The default browser is - * determined by the OS. This has been tested under Windows 95/98/NT. - - + * + * Under Unix, the system browser is hard-coded to be 'netscape'. Netscape must + * be in your PATH for this to work. This has been tested with the following + * platforms: AIX, HP-UX and Solaris. + * + * + * + * Under Windows, this will bring up the default browser under windows, usually + * either Netscape or Microsoft IE. The default browser is determined by the OS. + * This has been tested under Windows 95/98/NT. + * + * * * Examples: - - * -BrowserControl.displayURL("http://www.javaworld.com") * -BrowserControl.displayURL("file://c:\\docs\\index.html") * -BrowserContorl.displayURL("file:///user/joe/index.html"); + * BrowserControl.displayURL("http://www.javaworld.com") * - - * Note - you must include the url type -- either "http://" or - * "file://". + * BrowserControl.displayURL("file://c:\\docs\\index.html") + * + * BrowserContorl.displayURL("file:///user/joe/index.html"); + * + * + * Note - you must include the url type -- either "http://" or "file://". */ public class BrowserControl { // Used to identify the windows platform. @@ -72,7 +73,7 @@ public class BrowserControl { private static final String MAC_ID = "mac os x"; /** - * + * * @param url */ public static void displayURL(String url) { @@ -107,8 +108,8 @@ public static void displayURL(String url) { } /** - * Try to determine whether this application is running under Windows - * or some other platform by examing the "os.name" property. + * Try to determine whether this application is running under Windows or + * some other platform by examing the "os.name" property. * * @return true if this application is running under a Windows OS */ @@ -123,7 +124,7 @@ public static boolean isWindowsPlatform() { } /** - * + * * @return */ public static boolean isMacOS() { @@ -138,9 +139,18 @@ public static boolean isMacOS() { /** * Simple example. - * @param args + * + * @param args */ public static void main(String[] args) { displayURL("http://www.javaworld.com"); } + + public static String urlEncode(String text) { + try { + return URLEncoder.encode(text, "UTF-8"); + } catch (UnsupportedEncodingException ex) { + throw new RuntimeException(ex); + } + } } diff --git a/src/main/java/org/earthtime/UPb_Redux/utilities/MacOSAboutHandler.java b/src/main/java/org/earthtime/UPb_Redux/utilities/MacOSAboutHandler.java deleted file mode 100644 index 7aea9b7c..00000000 --- a/src/main/java/org/earthtime/UPb_Redux/utilities/MacOSAboutHandler.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * MacOSAboutHandler.java - * - * Created on April 28, 2007, 7:50 AM - * - * - * Copyright 2006-2018 James F. Bowring, CIRDLES.org, and Earth-Time.org - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.earthtime.UPb_Redux.utilities; - -import com.apple.eawt.Application; -import com.apple.eawt.ApplicationAdapter; -import com.apple.eawt.ApplicationEvent; -import java.awt.Component; -import javax.swing.AbstractButton; -import javax.swing.JFrame; -import org.earthtime.ETReduxFrame; -import org.earthtime.dialogs.AboutBox; -import org.earthtime.dialogs.PreferencesEditorDialog; - -//http://www.java2s.com/ExampleCode/Development-Class/MacOSApplicationAdapter.htm - -// http://developer.apple.com/documentation/Java/Reference/1.4.2/appledoc/api/com/apple/eawt/Application.html - -/** - * - * @author samuelbowring - */ -public class MacOSAboutHandler extends Application { - - JFrame parent; - //ShutdownHandler shutter; - - /** - * - * @param theParent - */ - public MacOSAboutHandler(JFrame theParent) { - parent = theParent; - - addApplicationListener(new AboutBoxHandler()); - - setEnabledPreferencesMenu(true); - addPreferencesMenuItem(); - } - - class AboutBoxHandler extends ApplicationAdapter { - - @Override - public void handleAbout(ApplicationEvent event) { - AboutBox myBox = new AboutBox(parent, true); - //myBox.setSize(290, 310); - myBox.setVisible(true); - - event.setHandled(true); - } - - @Override - public void handlePreferences(ApplicationEvent event) { - PreferencesEditorDialog myPrefs = - new PreferencesEditorDialog( - parent, - true, - ((ETReduxFrame)parent).getMyState().getReduxPreferences()); - myPrefs.setSize(375, 540); - myPrefs.setVisible(true); - - ((ETReduxFrame)parent) - .getTheSample() - .setFractionDataOverriddenOnImport( - myPrefs.getReduxPreferences().isFractionDataOverriddenOnImport()); - - event.setHandled(true); - } - - /** This is called when the user does Application->Quit */ - @Override - public void handleQuit(ApplicationEvent event) { - // TODO this should not be hardcoded --> look up by menuitem name - - Component[] sampleFile = parent.getJMenuBar().getMenu(0).getMenuComponents(); - for (Component sampleFile1 : sampleFile) { - if (sampleFile1.getClass().getName().equalsIgnoreCase("javax.swing.JMenuItem")) { - if (((AbstractButton) sampleFile1).getText().equalsIgnoreCase("Exit")) { - ((AbstractButton) sampleFile1).doClick(); - event.setHandled(true); - } - } - } - - } - } -} \ No newline at end of file diff --git a/src/main/java/org/earthtime/UPb_Redux/valueModels/ValueModel.java b/src/main/java/org/earthtime/UPb_Redux/valueModels/ValueModel.java index 0368fa8d..a8bcc40c 100644 --- a/src/main/java/org/earthtime/UPb_Redux/valueModels/ValueModel.java +++ b/src/main/java/org/earthtime/UPb_Redux/valueModels/ValueModel.java @@ -973,8 +973,6 @@ public XStream getXStreamReader() { customizeXstream(xstream); - // http://x-stream.github.io/security.html - XStream.setupDefaultSecurity(xstream); // clear out existing permissions and set own ones xstream.addPermission(NoTypePermission.NONE); // allow some basics diff --git a/src/main/java/org/earthtime/UTh_Redux/aliquots/UThReduxAliquot.java b/src/main/java/org/earthtime/UTh_Redux/aliquots/UThReduxAliquot.java index e3d894c1..fe83a7ea 100644 --- a/src/main/java/org/earthtime/UTh_Redux/aliquots/UThReduxAliquot.java +++ b/src/main/java/org/earthtime/UTh_Redux/aliquots/UThReduxAliquot.java @@ -525,8 +525,6 @@ public XStream getXStreamReader() { customizeXstream(xstream); - // http://x-stream.github.io/security.html - XStream.setupDefaultSecurity(xstream); // clear out existing permissions and set own ones xstream.addPermission(NoTypePermission.NONE); // allow some basics diff --git a/src/main/java/org/earthtime/archivingTools/forSESAR/SesarSample.java b/src/main/java/org/earthtime/archivingTools/forSESAR/SesarSample.java index d613510d..8ceaf764 100644 --- a/src/main/java/org/earthtime/archivingTools/forSESAR/SesarSample.java +++ b/src/main/java/org/earthtime/archivingTools/forSESAR/SesarSample.java @@ -356,8 +356,6 @@ public static XStream getXStreamReader() { customizeXstream(xstream); - // http://x-stream.github.io/security.html - XStream.setupDefaultSecurity(xstream); // clear out existing permissions and set own ones xstream.addPermission(NoTypePermission.NONE); // allow some basics diff --git a/src/main/java/org/earthtime/archivingTools/forSESAR/SesarSampleManager.form b/src/main/java/org/earthtime/archivingTools/forSESAR/SesarSampleManager.form index 2f65c18f..5c138acd 100644 --- a/src/main/java/org/earthtime/archivingTools/forSESAR/SesarSampleManager.form +++ b/src/main/java/org/earthtime/archivingTools/forSESAR/SesarSampleManager.form @@ -37,8 +37,8 @@ - - + + @@ -91,8 +91,8 @@ - - + + diff --git a/src/main/java/org/earthtime/archivingTools/forSESAR/SesarSampleManager.java b/src/main/java/org/earthtime/archivingTools/forSESAR/SesarSampleManager.java index 2f40403f..34bb1ac1 100644 --- a/src/main/java/org/earthtime/archivingTools/forSESAR/SesarSampleManager.java +++ b/src/main/java/org/earthtime/archivingTools/forSESAR/SesarSampleManager.java @@ -337,7 +337,7 @@ private void initComponents() { getContentPane().setLayout(null); buttonBar_panel.setBackground(new java.awt.Color(235, 255, 255)); - buttonBar_panel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED)); + buttonBar_panel.setBorder(javax.swing.BorderFactory.createLineBorder(null)); buttonBar_panel.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); close_button.setBackground(new java.awt.Color(204, 204, 204)); @@ -357,7 +357,7 @@ public void actionPerformed(java.awt.event.ActionEvent evt) { buttonBar_panel.setBounds(0, 300, 450, 28); sesarSampleDetailsLayeredPane.setBackground(new java.awt.Color(255, 255, 255)); - sesarSampleDetailsLayeredPane.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)); + sesarSampleDetailsLayeredPane.setBorder(javax.swing.BorderFactory.createLineBorder(null)); sesarSampleDetailsLayeredPane.setOpaque(true); getContentPane().add(sesarSampleDetailsLayeredPane); sesarSampleDetailsLayeredPane.setBounds(0, 0, 450, 300); diff --git a/src/main/java/org/earthtime/dialogs/AboutBox.form b/src/main/java/org/earthtime/dialogs/AboutBox.form index c4a54c15..28b200fe 100644 --- a/src/main/java/org/earthtime/dialogs/AboutBox.form +++ b/src/main/java/org/earthtime/dialogs/AboutBox.form @@ -86,7 +86,7 @@ - + @@ -124,7 +124,7 @@ - + diff --git a/src/main/java/org/earthtime/dialogs/AboutBox.java b/src/main/java/org/earthtime/dialogs/AboutBox.java index 88b46b73..9366ecbe 100644 --- a/src/main/java/org/earthtime/dialogs/AboutBox.java +++ b/src/main/java/org/earthtime/dialogs/AboutBox.java @@ -142,7 +142,7 @@ private void initComponents() { jLabel4.setFont(new java.awt.Font("Helvetica", 1, 12)); // NOI18N jLabel4.setForeground(new java.awt.Color(255, 255, 255)); jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - jLabel4.setText(" Copyright 2006-2017 James F. Bowring and www.Earth-Time.org

Licensed under the Apache License, Version 2.0 (the \"License\");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at



Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an \"AS IS\" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied.

See the License for the specific language governing permissions and
limitations under the License. "); + jLabel4.setText(" Copyright 2006-2022 James F. Bowring and www.Earth-Time.org

Licensed under the Apache License, Version 2.0 (the \"License\");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at



Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an \"AS IS\" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied.

See the License for the specific language governing permissions and
limitations under the License. "); jPanel1.add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 208, 415, 225)); releaseDate_text.setFont(new java.awt.Font("Helvetica", 3, 14)); // NOI18N @@ -156,7 +156,7 @@ private void initComponents() { jLabel1.setFont(new java.awt.Font("Helvetica", 1, 12)); // NOI18N jLabel1.setForeground(new java.awt.Color(255, 255, 255)); jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); - jLabel1.setText("Funding:

Development of ET_Redux is currently supported by NSF Award #0930223: Collaborative Research: Analytical Techniques and Software: Development of Cyber Infrastructure to Support Laser-Ablation ICP Mass Spectrometry

Development is also supported by the College of Charleston Department of Computer Science through its Cyber Infrastructure Research and Development Lab for the Earth Sciences (CIRDLES)."); + jLabel1.setText("Funding:

Development of ET_Redux is currently supported by NSF Award #0930223: Collaborative Research: Analytical Techniques and Software: Development of Cyber Infrastructure to Support Laser-Ablation ICP Mass Spectrometry

Development is also supported by the College of Charleston Department of Computer Science through its Cyber Infrastructure Research and Development Lab for the Earth Sciences (CIRDLES.org)."); jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(41, 439, 359, -1)); org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); diff --git a/src/main/java/org/earthtime/physicalConstants/PhysicalConstants.java b/src/main/java/org/earthtime/physicalConstants/PhysicalConstants.java index 0925fb7d..26967c46 100644 --- a/src/main/java/org/earthtime/physicalConstants/PhysicalConstants.java +++ b/src/main/java/org/earthtime/physicalConstants/PhysicalConstants.java @@ -437,8 +437,6 @@ private XStream getXStreamReader() { customizeXstream(xstream); - // http://x-stream.github.io/security.html - XStream.setupDefaultSecurity(xstream); // clear out existing permissions and set own ones xstream.addPermission(NoTypePermission.NONE); // allow some basics diff --git a/src/main/java/org/earthtime/ratioDataModels/AbstractRatiosDataModel.java b/src/main/java/org/earthtime/ratioDataModels/AbstractRatiosDataModel.java index bc6d95db..a25b15fc 100644 --- a/src/main/java/org/earthtime/ratioDataModels/AbstractRatiosDataModel.java +++ b/src/main/java/org/earthtime/ratioDataModels/AbstractRatiosDataModel.java @@ -1040,8 +1040,6 @@ protected XStream getXStream() { customizeXstream(xstream); - // http://x-stream.github.io/security.html - XStream.setupDefaultSecurity(xstream); // clear out existing permissions and set own ones xstream.addPermission(NoTypePermission.NONE); // allow some basics diff --git a/src/main/java/org/earthtime/reports/ReportSettingsInterface.java b/src/main/java/org/earthtime/reports/ReportSettingsInterface.java index d87dd64a..8dcf3fcc 100644 --- a/src/main/java/org/earthtime/reports/ReportSettingsInterface.java +++ b/src/main/java/org/earthtime/reports/ReportSettingsInterface.java @@ -135,8 +135,6 @@ public default XStream getXStreamReader() { customizeXstream(xstream); - // http://x-stream.github.io/security.html - XStream.setupDefaultSecurity(xstream); // clear out existing permissions and set own ones xstream.addPermission(NoTypePermission.NONE); // allow some basics