return status;
}
public void saveJob() {
// Save job data
PortJob newPortJob = new PortJob();
newPortJob.setPortMethod((PortMethod) portMethodComboBox
.getSelectedItem());
newPortJob.setSourceSiteDomain(sourceSiteDomainTextField.getText());
newPortJob.setSourceSetID(sourceSetIDTextField.getText());
newPortJob.setSinkSiteDomain(sinkSiteDomainTextField.getText());
newPortJob.setSinkSetID(sinkSetIDTextField.getText());
newPortJob.setPublishMethod((PublishMethod) publishMethodComboBox
.getSelectedItem());
newPortJob.setPublishDataset((PublishDataset) publishDatasetComboBox
.getSelectedItem());
newPortJob.setPathToSavedFile(jobFileLocation);
// TODO If an existing file was selected WARN user of overwriting
// if first time saving this job: Open dialog box to select "Save as..."
// location
// otherwise save to existing file
String selectedJobFileLocation = jobFileLocation;
if (selectedJobFileLocation.equals("")) {
JFileChooser savedJobFileChooser = new JFileChooser();
FileNameExtensionFilter filter = new FileNameExtensionFilter(
JOB_FILE_NAME + " (*." + JOB_FILE_EXTENSION + ")",
JOB_FILE_EXTENSION);
savedJobFileChooser.setFileFilter(filter);
int returnVal = savedJobFileChooser.showSaveDialog(mainFrame);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = savedJobFileChooser.getSelectedFile();
selectedJobFileLocation = file.getAbsolutePath();
if (!selectedJobFileLocation.endsWith("." + JOB_FILE_EXTENSION)) {
selectedJobFileLocation += "." + JOB_FILE_EXTENSION;
}
jobFileLocation = selectedJobFileLocation;
newPortJob.setPathToSavedFile(selectedJobFileLocation);
jobTabTitleLabel.setText(newPortJob.getJobFilename());
}
}
// actually save the job file (may overwrite)
try {
newPortJob.writeToFile(selectedJobFileLocation);
// Update job tab title label
jobTabTitleLabel.setText(newPortJob.getJobFilename());
} catch (IOException e) {
JOptionPane.showMessageDialog(mainFrame,
"Error saving " + selectedJobFileLocation + ": " + e.getMessage());
}
}