Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 0 additions & 35 deletions festc_core/src/gov/epa/festc/core/FestcApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ public class FestcApplication implements ListSelectionListener,
private String epicHome;
private String workdir;

private String sSimYear;
private String sFertYear;
private String sMinAcre;

private boolean allowDiffCheck;

private enum ProjectEvent {CREATED, OPENED, SAVE, SAVED};
Expand Down Expand Up @@ -133,37 +129,6 @@ public void setCurrentDir(File curdir) {
* Gets the modeling year associated with the app
*/

public String getSSimYear() {
return this.sSimYear;
}

public void setSSimYear(String year) {
this.sSimYear = year;
}

/***
* Sets the fertilizer year associated with the app
*/

public String getSFertYear() {
return this.sFertYear;
}

public void setSFertYear(String year) {
this.sFertYear = year;
}

/***
* Sets the minimum crop acres associated with the app
*/

public String getSMinAcre() {
return this.sMinAcre;
}

public void setSMinAcre(String minAcre) {
this.sMinAcre = minAcre;
}

/**
* Exits the application.
Expand Down
14 changes: 7 additions & 7 deletions festc_core/src/gov/epa/festc/core/proj/Beld4DataGenFields.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@XmlRootElement(name = "gov.epa.festc.core.proj.Beld4DataGenFields")

public class Beld4DataGenFields extends PageFields{
public class Beld4DataGenFields extends DomainFields{
private String nlcdYear;
private String nlcdFile;
private boolean nlcdDataSelected;
Expand All @@ -15,12 +15,12 @@ public Beld4DataGenFields() {
//NOTE: no-op
}

public void setNLCDyear(String nlcdYear) {
this.nlcdYear = nlcdYear;
}
public String getNLCDyear() {
return nlcdYear;
}
// public void setNLCDyear(String nlcdYear) {
// this.nlcdYear = nlcdYear;
// }
// public String getNLCDyear() {
// return nlcdYear;
// }
public void setNLCDfile(String nlcdFile) {
this.nlcdFile = nlcdFile;
}
Expand Down
71 changes: 69 additions & 2 deletions festc_core/src/gov/epa/festc/core/proj/DomainFields.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
package gov.epa.festc.core.proj;

import javax.swing.event.ListDataEvent;
import javax.swing.event.ListSelectionEvent;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "gov.epa.festc.core.proj.DomainFields")
public class DomainFields extends PageFields {

private String simYear;
private String nlcdYear;
protected String simYear;
protected String nlcdYear;
protected String fertYear;
protected String minAcre;

protected String sSimYear;
protected String sFertYear;
protected String sMinAcre;

public String getSimYear() {
return simYear;
Expand All @@ -15,6 +23,17 @@ public String getSimYear() {
public String getNlcdYear() {
return nlcdYear;
}

public String defaultNlcdYear() {
Integer intSimYear = Integer.parseInt(simYear);
if (intSimYear == null ) nlcdYear = "2006";
else {
if (intSimYear >= 2011 ) nlcdYear = "2011";
if (intSimYear < 2011 || intSimYear > 2005 ) nlcdYear = "2006";
if (intSimYear < 2006 ) nlcdYear = "2001";
}
return nlcdYear;
}

public void setSimYear(String year) {
this.simYear = year;
Expand All @@ -23,7 +42,55 @@ public void setSimYear(String year) {
public void setNlcdYear(String year) {
this.nlcdYear = year;
}

public String getSSimYear() {
return this.sSimYear;
}

public void setSSimYear(String year) {
this.sSimYear = year;
}

/***
* Sets the fertilizer year associated with the app
*/

public String getSFertYear() {
return this.sFertYear;
}

public void setSFertYear(String year) {
this.sFertYear = year;
}

public String getFertYear() {
return this.fertYear;
}

public void setFertYear(String year) {
this.fertYear = year;
}

/***
* Sets the minimum crop acres associated with the app
*/

public String getSMinAcre() {
return this.sMinAcre;
}

public void setSMinAcre(String minAcre) {
this.sMinAcre = minAcre;
}

public String getMinAcre() {
return this.minAcre;
}

public void setMinAcre(String minAcre) {
this.minAcre = minAcre;
}

@Override
public String getName() {
// TODO Auto-generated method stub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import gov.epa.festc.gui.Epic2CMAQPanel;

@XmlRootElement(name = "gov.epa.festc.core.proj.Epic2CMAQFields")
public class Epic2CMAQFields extends PageFields{
public class Epic2CMAQFields extends DomainFields{

private String startdate;
private String enddate;
Expand Down
4 changes: 2 additions & 2 deletions festc_core/src/gov/epa/festc/core/proj/EpicAppFields.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "gov.epa.festc.core.proj.EpicAppFields")
public class EpicAppFields extends PageFields {
public class EpicAppFields extends DomainFields {

private String finishedCrops;
private String simYear;
//private String simYear;
private String nDepDir;
private String co2Fac;
private String runTiledrain;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "gov.epa.festc.core.proj.EpicSpinupFields")
public class EpicSpinupFields extends PageFields {
public class EpicSpinupFields extends DomainFields {

private String finishedCrops;
private String nDepDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "gov.epa.festc.core.proj.EpicYearlyAverage2CMAQFields")
public class EpicYearlyAverage2CMAQFields extends PageFields{
public class EpicYearlyAverage2CMAQFields extends DomainFields{

private String beld4ncf;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "gov.epa.festc.core.proj.ManFileModFields")
public class ManFileModFields extends PageFields{
public class ManFileModFields extends DomainFields{

public ManFileModFields() {
//NOTE: no-op
Expand Down
12 changes: 3 additions & 9 deletions festc_core/src/gov/epa/festc/core/proj/ManageAppFields.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,15 @@
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "gov.epa.festc.core.proj.ManageAppFields")
public class ManageAppFields extends PageFields {
public class ManageAppFields extends DomainFields {

private String fertYear;

public ManageAppFields() {
//NOTE: no-op
}

public String getFertYear() {
return fertYear;
}

public void setFertYear(String fertYear) {
this.fertYear = fertYear;
}


@Override
public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "gov.epa.festc.core.proj.ManageSpinupFields")
public class ManageSpinupFields extends PageFields {
public class ManageSpinupFields extends DomainFields {

private String fertYear;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "gov.epa.festc.core.proj.Mcip2EpicFields")
public class Mcip2EpicFields extends PageFields{
public class Mcip2EpicFields extends DomainFields{

private String startdate;
private String enddate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "gov.epa.festc.core.proj.SiteFilesFields")
public class SiteFilesFields extends PageFields {
public class SiteFilesFields extends DomainFields {

private String minAcres;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "gov.epa.festc.core.proj.SiteInfoGenFields")
public class SiteInfoGenFields extends PageFields{
public class SiteInfoGenFields extends DomainFields{

private String beld4ncf;
private String minAcres;

public SiteInfoGenFields() {
//NOTE: no-op
Expand All @@ -19,12 +18,6 @@ public String getBeld4ncf() {
return beld4ncf;
}

public void setMinAcres(String acres) {
this.minAcres = acres;
}
public String getMinAcres() {
return minAcres;
}

@Override
public String getName() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "gov.epa.festc.core.proj.SoilFilesFields")
public class SoilFilesFields extends PageFields {
public class SoilFilesFields extends DomainFields {

private String finishedCrops;

Expand Down
27 changes: 15 additions & 12 deletions festc_core/src/gov/epa/festc/gui/Beld4DataGenPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class Beld4DataGenPanel extends UtilFieldsPanel implements PlotEventListe
private Beld4DataGenFields fields;
private JCheckBox nlcdBox;
private JCheckBox modisBox;
private JTextField nlcdYear;
private JComboBox nlcdYearBox;
private JTextField inputDir;
private JButton inputDirBrowser;

Expand Down Expand Up @@ -114,9 +114,9 @@ private JPanel getCenterPanel() {
dataPanel.add(this.modisBox);

JPanel yearPanel = new JPanel( );
nlcdYear = new JTextField(40);
nlcdYear.setEditable(false);
yearPanel.add(nlcdYear);
nlcdYearBox = new JComboBox(Constants.FERTYEARS);
//nlcdYear.setEditable(false);
yearPanel.add(nlcdYearBox);

JPanel inputDirPanel = new JPanel();
inputDir = new JTextField(40);
Expand Down Expand Up @@ -181,7 +181,7 @@ private void generateRunScript() throws Exception {
validateGrids();


String dYear = this.nlcdYear.getText();
String dYear = (String)this.nlcdYearBox.getSelectedItem();
if ( dYear.trim().isEmpty() )
throw new Exception("NLCD/MODIS data year is empty!");

Expand Down Expand Up @@ -353,7 +353,7 @@ private void runScript(final String file) {

@Override
public void newProjectCreated() {
DomainFields domain = (DomainFields) app.getProject().getPage(DomainFields.class.getCanonicalName());
domain = (DomainFields) app.getProject().getPage(DomainFields.class.getCanonicalName());
rows.setValue(domain.getRows());
cols.setValue(domain.getCols());
xmin.setValue(domain.getXmin());
Expand All @@ -363,8 +363,9 @@ public void newProjectCreated() {
proj4proj.setText(domain.getProj());
gridName.setText(domain.getGridName());
scenarioDir.setText(domain.getScenarioDir());
String nlcdY = domain.getNlcdYear()==null? "2006":domain.getNlcdYear();
nlcdYear.setText(nlcdY);
String nlcdY = domain.getNlcdYear()==null? domain.defaultNlcdYear():domain.getNlcdYear();
// Integer index = nlcdYear.getItemCount();
// nlcdYear.setSelectedItem(index);
String sahome = Constants.getProperty(Constants.SA_HOME, msg);
inputDir.setText(sahome.trim() + "/data/nlcd_modis_files_" + nlcdY + ".txt");

Expand All @@ -377,6 +378,7 @@ public void newProjectCreated() {

@Override
public void projectLoaded() {
//domain = (DomainFields) app.getProject().getPage(DomainFields.class.getCanonicalName());
fields = (Beld4DataGenFields) app.getProject().getPage(fields.getName());
if( fields != null ) {
this.scenarioDir.setText(fields.getScenarioDir());
Expand All @@ -390,7 +392,8 @@ public void projectLoaded() {
ySize.setValue(fields.getYcellSize());
proj4proj.setText(fields.getProj());
gridName.setText(fields.getGridName());
nlcdYear.setText(fields.getNLCDyear());
nlcdYearBox.setSelectedItem(fields.getNlcdYear()==null? fields.defaultNlcdYear():fields.getNlcdYear());

inputDir.setText(fields.getNLCDfile());
nlcdBox.setSelected(fields.isNlcdDataSelected());
modisBox.setSelected(fields.isModisDataSelected());
Expand All @@ -416,9 +419,9 @@ public void saveProjectRequested() {
if ( nlcdBox != null ) fields.setNlcdDataSelected(nlcdBox.isSelected());
if ( modisBox != null ) fields.setModisDataSelected(modisBox.isSelected());

if ( nlcdYear != null ) {
String dYear = this.nlcdYear.getText();
fields.setNLCDyear(dYear);
if ( nlcdYearBox != null ) {
String dYear = (String) this.nlcdYearBox.getSelectedItem();
fields.setNlcdYear(dYear);
}
if ( inputDir != null ) fields.setNLCDfile(inputDir.getText().trim());

Expand Down
Loading