Skip to content

Commit

Permalink
refactoring in preparation for LAICPMS Kwiki page
Browse files Browse the repository at this point in the history
  • Loading branch information
bowring committed Mar 22, 2015
1 parent b0b63b8 commit cecade7
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/earthtime/ETRedux.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class ETRedux {
/**
*
*/
public static String RELEASE_DATE = "2 March 2015";
public static String RELEASE_DATE = "22 March 2015";

/**
* Creates a new instance of UPbRedux
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.filechooser.FileFilter;
import org.earthtime.UPb_Redux.ReduxConstants;
import org.earthtime.ETReduxFrame;
import org.earthtime.UPb_Redux.ReduxConstants;
import org.earthtime.UPb_Redux.aliquots.Aliquot;
import org.earthtime.UPb_Redux.aliquots.UPbReduxAliquot;
import org.earthtime.UPb_Redux.beans.ValueModelClump;
Expand Down Expand Up @@ -185,8 +185,10 @@ public UPbFractionEditorDialog(
showDates = new boolean[]{true, true, true};

// inAutoUraniumMode = false;
((UPbFraction) myFraction).setInAutoUraniumMode(false);

try {
((UPbFraction) myFraction).setInAutoUraniumMode(false);
} catch (Exception e) {
}
initComponents();

toggleStartStopLiveUpdate_button.setText(((ETReduxFrame) parent).getupdateSample_buttonText());
Expand Down Expand Up @@ -218,7 +220,7 @@ public UPbFractionEditorDialog(
}
// add the not-rejected fractions
for (Fraction f : ((UPbReduxAliquot) aliquot).getAliquotFractions()) {
if (!((UPbFraction) f).isRejected()) {
if (!((UPbFractionI) f).isRejected()) {
fraction_Chooser.addItem(f);
}
}
Expand Down Expand Up @@ -250,9 +252,11 @@ public void actionPerformed(ActionEvent e) {
}

// reset input estimated age for auto uranium mode to date 207/206
((UPbFraction) myFraction).//
setInputDate206_238r(myFraction.getRadiogenicIsotopeDateByName(RadDates.age207_206r).getValue());

try {
((UPbFraction) myFraction).//
setInputDate206_238r(myFraction.getRadiogenicIsotopeDateByName(RadDates.age207_206r).getValue());
} catch (Exception e) {
}
InitializeFractionData(myFraction);
// fraction_Chooser.setSelectedItem( myFraction );

Expand All @@ -278,7 +282,7 @@ public void InitializeFractionData(final Fraction myFraction) {

// if this is an added default fraction, the isdeleted field is true and
// hence we do not need the button active
delete_button.setEnabled(!((UPbFraction) myFraction).isDeleted() && !isCompiled());
delete_button.setEnabled(!((UPbFractionI) myFraction).isDeleted() && !isCompiled());

InitializeTextBoxes(myFraction);
showSavedData(myFraction);
Expand Down Expand Up @@ -1006,15 +1010,13 @@ private void InitializeTextBoxes(final Fraction myFraction) {
// Determine whether the Pb and U data are editable based on presence of source files
// April 2009 decided to make this more restrictive
boolean editablePb
= !((UPbFraction) myFraction).hasXMLPbSourceFile()
&& //(((UPbFraction) myFraction).getMeanAlphaPb().compareTo(BigDecimal.ZERO) == 0) &&
!isCompiled();
= !((UPbFractionI) myFraction).hasXMLPbSourceFile()
&& !isCompiled();
boolean editableU
= !((UPbFraction) myFraction).hasXMLUSourceFile()
&& //(((UPbFraction) myFraction).getMeanAlphaU().compareTo(BigDecimal.ZERO) == 0) &&
!isCompiled();
= !((UPbFractionI) myFraction).hasXMLUSourceFile()
&& !isCompiled();
// Determine whether fraction is a metal or oxide for editing
boolean fractionIsOxide = ((UPbFraction) myFraction).isAnOxide();
boolean fractionIsOxide = ((UPbFractionI) myFraction).isAnOxide();

// set properties of text boxes
// top panel
Expand Down Expand Up @@ -1132,7 +1134,7 @@ private void InitializeTextBoxes(final Fraction myFraction) {

// aug 2010 oxide correction refinements
r18O_16OUsed_textOnUTab.setDocument(new BigDecimalDocument(r18O_16OUsed_textOnUTab, true));
fractionIsMetal_rb.setEnabled(!((UPbFraction) myFraction).hasXMLUSourceFile());
fractionIsMetal_rb.setEnabled(!((UPbFractionI) myFraction).hasXMLUSourceFile());
fractionIsMetal_rb.addActionListener(new ActionListener() {

@Override
Expand Down Expand Up @@ -1165,7 +1167,7 @@ public void actionPerformed(ActionEvent e) {
}
});

if (((UPbFraction) myFraction).isAnOxide()) {
if (((UPbFractionI) myFraction).isAnOxide()) {
fractionIsOxide_rb.setSelected(true);
} else {
fractionIsMetal_rb.setSelected(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,10 @@ public interface UPbFractionI {
public void calculateTeraWasserburgRho();

public boolean isCommonLeadLossCorrected();

public boolean hasXMLUSourceFile ();

public boolean hasXMLPbSourceFile ();

public boolean isAnOxide();
}
Original file line number Diff line number Diff line change
Expand Up @@ -1457,4 +1457,19 @@ public boolean isCorrectedForPbc() {
public void setCorrectedForPbc(boolean correctedForPbc) {
this.correctedForPbc = correctedForPbc;
}

@Override
public boolean hasXMLUSourceFile() {
return false;
}

@Override
public boolean hasXMLPbSourceFile() {
return false;
}

@Override
public boolean isAnOxide(){
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -709,4 +709,19 @@ public void setStandard(boolean standard) {
public boolean isCommonLeadLossCorrected() {
return false; // dec 2014 until we learn that this is the case
}

@Override
public boolean hasXMLUSourceFile() {
return false;
}

@Override
public boolean hasXMLPbSourceFile() {
return false;
}

@Override
public boolean isAnOxide() {
return false;
}
}
4 changes: 3 additions & 1 deletion src/main/java/org/earthtime/UPb_Redux/samples/Sample.java
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,7 @@ private void initializeDefaultUPbFraction(Fraction defFraction)
addUPbFraction(defFraction);
}

//TODO: refactor these edit methods out of sample - MVC !!
/**
* opens aliquot modal editor for the <code>Fraction</code> indicated by
* argument <code>fraction</code> and opened to the editing tab indicated by
Expand Down Expand Up @@ -901,7 +902,8 @@ public void editUPbFraction(Fraction fraction, int selectedTab) {
selectedTab,
false);
} else if (sampleAnalysisType.equalsIgnoreCase(SampleAnalysisTypesEnum.IDTIMS.getName())
|| (sampleType.equalsIgnoreCase(SampleTypesEnum.COMPILATION.getName()))) {
|| (sampleType.equalsIgnoreCase(SampleTypesEnum.COMPILATION.getName()))){
// TODO: Need kwiki page for LAICPMS || (sampleType.equalsIgnoreCase(SampleTypesEnum.PROJECT.getName()))) {

myFractionEditor
= new UPbFractionEditorDialog(
Expand Down

0 comments on commit cecade7

Please sign in to comment.