Project info dialog

More wrapping of nilus objects to make a general project info tab in
PAMGuard. This is global and can share basic project informatin with the
Tethys module.
This commit is contained in:
Douglas Gillespie 2023-12-07 15:10:45 +00:00
parent 7721d7f1c0
commit 9c86b41027
19 changed files with 302 additions and 446 deletions

View File

@ -74,6 +74,7 @@ import javax.swing.event.MenuListener;
import Acquisition.DaqSystemInterface;
import annotation.tasks.AnnotationManager;
import metadata.MetaDataContol;
import performanceTests.PerformanceDialog;
import tipOfTheDay.TipOfTheDayManager;
import Array.ArrayManager;
@ -760,6 +761,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings {
//for changing "hydrophones" to "microphone" and vice versa if medium changes.
menu.addMenuListener(new SettingsMenuListener());
menu.add(MetaDataContol.getMetaDataControl().createMenu(frame));
menu.addSeparator();

View File

@ -1,5 +1,7 @@
package metadata;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;
import javax.swing.JFrame;
@ -10,9 +12,7 @@ import PamController.PamControlledUnitSettings;
import PamController.PamController;
import PamController.PamSettingManager;
import PamController.PamSettings;
import PamModel.parametermanager.ParameterSetManager;
import generalDatabase.parameterstore.ParameterDatabaseStore;
import metadata.deployment.DeploymentData;
import metadata.swing.MetaDataDialog;
/**
* Class to handle Project MetaData. Am making this a PAMControlledUnit, but may never
@ -89,10 +89,25 @@ public class MetaDataContol extends PamControlledUnit implements PamSettings {
}
// @Override
// public JMenuItem createFileMenu(JFrame parentFrame) {
// return deploymentSetManager.getMenuItem(parentFrame);
//// return null;
// }
public JMenuItem createMenu(JFrame parentFrame) {
JMenuItem menuItem = new JMenuItem("Project information ...");
menuItem.setToolTipText("General project objectives, region, etc.");
menuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
showDialog(parentFrame);
}
});
return menuItem;
}
protected void showDialog(JFrame parentFrame) {
PamguardMetaData newData = MetaDataDialog.showDialog(parentFrame, pamguardMetaData);
if (newData != null) {
this.pamguardMetaData = newData;
// send around a notification ?
}
}

View File

@ -3,8 +3,12 @@ package metadata;
import java.io.Serializable;
import PamUtils.LatLong;
import nilus.ContactInfo;
import nilus.Deployment;
import nilus.DescriptionType;
import nilus.Helper;
import nilus.MetadataInfo;
import nilus.ResponsibleParty;
import tethys.niluswraps.NilusSettingsWrapper;
/**
@ -43,12 +47,24 @@ public class PamguardMetaData implements Serializable {
try {
Helper.createRequiredElements(deployment);
} catch (IllegalArgumentException | IllegalAccessException | InstantiationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
deploymentWrapper.setNilusObject(deployment);
}
return deploymentWrapper.getNilusObject(Deployment.class);
// check some fields we know we'll need that the Helper may not have managed.
if (deployment.getDescription() == null) {
deployment.setDescription(new DescriptionType());
}
if (deployment.getMetadataInfo() == null) {
deployment.setMetadataInfo(new MetadataInfo());
}
if (deployment.getMetadataInfo().getContact() == null) {
deployment.getMetadataInfo().setContact(new ResponsibleParty());
}
if (deployment.getMetadataInfo().getContact().getContactInfo() == null) {
deployment.getMetadataInfo().getContact().setContactInfo(new ContactInfo());
}
return deployment;
}
/**

View File

@ -1,327 +0,0 @@
package metadata.deployment;
import java.io.Serializable;
import PamModel.parametermanager.FieldNotFoundException;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
import PamUtils.LatLong;
/**
* Class to hold Deployment data in a form consistent with the ANSI PAM
* Standard. This has been keep separate from the Tethys Interface to keep it
* easy to benefit from these data without using Tethys itself. Is also serilaisable
* which is important for storage into PAMGuard settings.
*
* @author dg50
*
*/
public class DeploymentData implements Serializable, Cloneable, ManagedParameters {
public static final long serialVersionUID = 1L;
/**
* String that uniquely identifies this deployment.
*/
private String id;
/**
* Name of project associated with this deployment. Can be related to a
* geographic region, funding source, etc
*/
private String project;
/**
* Deployment identifier, a number related to either the Nth deployment
* operation in a series of deployments or the Nth deployment at a specific
* site. This is different from Id which is unique across all deployments
*/
private int deploymentId;
/**
* Alternative deployment description.
*/
private String deploymentAlias;
/**
* Name for current location.
*/
private String site;
/**
* Alternative names for the deployment location
*/
private String siteAliases;
/**
* Name of deployment cruise.
*/
private String cruise;
// /**
// * On what platform is the instrument deployed? (e.g. mooring, tag)
// */
// private String platform = "Unknown";
/**
* Name of geographic region.
*/
private String region;
/**
* time of instrument deployment (different to recording start);
*/
private Long deploymentMillis;
/**
* time of actual recovery (different to recording end);
*/
private Long recoveryMillis;
private LatLong recoverLatLong;
/**
* @return the deploymentMillis
*/
public Long getDeploymentMillis() {
return deploymentMillis;
}
/**
* @param deploymentMillis the deploymentMillis to set
*/
public void setDeploymentMillis(Long deploymentMillis) {
this.deploymentMillis = deploymentMillis;
}
/**
* @return the recoveryMillis
*/
public Long getRecoveryMillis() {
return recoveryMillis;
}
/**
* @param recoveryMillis the recoveryMillis to set
*/
public void setRecoveryMillis(Long recoveryMillis) {
this.recoveryMillis = recoveryMillis;
}
/**
* Set data from a nilus deployment class
* @param nilusDeployment
*/
public void setData(nilus.Deployment nilusDeployment) {
}
public void getData(nilus.Deployment nilusDeployment) {
}
public DeploymentData() {
}
@Override
protected DeploymentData clone() {
try {
return (DeploymentData) super.clone();
} catch (CloneNotSupportedException e) {
e.printStackTrace();
return null;
}
}
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
try {
ps.findParameterData("id").setInfo("Unique Id", null, "String that uniquely identifies this deployment", 128);
// ps.setOrder("id", 0);
ps.findParameterData("project").setInfo("Project Name", null, "Name of project associated with this deployment. Can be related to a geographic region, funding source, etc", 200);
ps.findParameterData("deploymentId").setInfo("Deployment Identifier", null, "Deployment identifier, a number related to either the Nth deployment operation in a series of deployments or the Nth deployment at a specific site. This is different from Id which is unique across all deployments");
ps.findParameterData("deploymentAlias").setInfo("Alternative deployment description", null, "Alternative deployment description", 20);
ps.findParameterData("site").setInfo("Site name", null, "Name for current location", 40);
ps.findParameterData("siteAliases").setInfo("Alternative site name", null, "Alternative site description", 40);
ps.findParameterData("cruise").setInfo("Deployment cruise", null, "Name of deployment cruise");
ps.findParameterData("platform").setInfo("Platform type", null, "On what platform is the instrument deployed? (e.g. mooring, tag)", 20);
ps.findParameterData("region").setInfo("Geographic Region", "", "Name of geographic region", 40);
} catch (FieldNotFoundException e) {
e.printStackTrace();
}
return ps;
}
// /**
// * @return the id
// */
// public String getId() {
// return id;
// }
//
// /**
// * @param id the id to set
// */
// public void setId(String id) {
// this.id = id;
// }
//
// /**
// * @return the project
// */
// public String getProject() {
// return project;
// }
//
// /**
// * @param project the project to set
// */
// public void setProject(String project) {
// this.project = project;
// }
//
// /**
// * @return the deploymentId
// */
// public int getDeploymentId() {
// return deploymentId;
// }
//
// /**
// * @param deploymentId the deploymentId to set
// */
// public void setDeploymentId(int deploymentId) {
// this.deploymentId = deploymentId;
// }
//
// /**
// * @return the deplomentAlias
// */
// public String getDeploymentAlias() {
// return deploymentAlias;
// }
//
// /**
// * @param deplomentAlias the deplomentAlias to set
// */
// public void setDeploymentAlias(String deplomentAlias) {
// this.deploymentAlias = deplomentAlias;
// }
//
// /**
// * @return the site
// */
// public String getSite() {
// return site;
// }
//
// /**
// * @param site the site to set
// */
// public void setSite(String site) {
// this.site = site;
// }
//
// /**
// * @return the siteAliases
// */
// public String getSiteAliases() {
// return siteAliases;
// }
//
// /**
// * @param siteAliases the siteAliases to set
// */
// public void setSiteAliases(String siteAliases) {
// this.siteAliases = siteAliases;
// }
//
// /**
// * @return the cruise
// */
// public String getCruise() {
// return cruise;
// }
//
// /**
// * @param cruise the cruise to set
// */
// public void setCruise(String cruise) {
// this.cruise = cruise;
// }
// /**
// * @return the platform
// */
// public String getPlatform() {
// return platform;
// }
//
// /**
// * @param platform the platform to set
// */
// public void setPlatform(String platform) {
// this.platform = platform;
// }
/**
* @return the region
*/
public String getRegion() {
return region;
}
/**
* @param region the region to set
*/
public void setRegion(String region) {
this.region = region;
}
/**
* Set the recovery position latlong for a static recorder.
* Deployment lat long is in the hydrophone array data.
* @param recoverLatLong
*/
public void setRecoveryLatLong(LatLong recoverLatLong) {
this.recoverLatLong = recoverLatLong;
}
/**
* @return the recoverLatLong (may often be null)
*/
public LatLong getRecoverLatLong() {
return recoverLatLong;
}
// /**
// * @return the instrumentType
// */
// public String getInstrumentType() {
// return instrumentType;
// }
//
// /**
// * @param instrumentType the instrumentType to set
// */
// public void setInstrumentType(String instrumentType) {
// this.instrumentType = instrumentType;
// }
//
// /**
// * @return the instrumentId
// */
// public String getInstrumentId() {
// return instrumentId;
// }
//
// /**
// * @param instrumentId the instrumentId to set
// */
// public void setInstrumentId(String instrumentId) {
// this.instrumentId = instrumentId;
// }
}

View File

@ -1,41 +0,0 @@
package metadata.deployment;
import java.io.Serializable;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PamParameterSet.ParameterSetType;
/**
* Largely the content of the Tethys QualityAssurance schema
* @author dg50
*
*/
public class QAData implements Serializable, Cloneable, ManagedParameters {
public static final long serialVersionUID = 1L;
private String objectives;
private String qaAbstract;
private String method;
private String responsibleName;
private String responsibleOrganisation;
private String responsiblePosition;
private String responsiblePhone;
private String responsibleAddress;
private String responsibleEmail;
public QAData() {
// TODO Auto-generated constructor stub
}
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DETECTOR);
return ps;
}
}

View File

@ -0,0 +1,131 @@
package metadata.swing;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Window;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import PamView.dialog.PamDialog;
import PamView.dialog.PamGridBagContraints;
import PamView.panel.WestAlignedPanel;
import metadata.PamguardMetaData;
import nilus.Deployment;
import tethys.swing.export.DescriptionTypePanel;
import tethys.swing.export.ResponsiblePartyPanel;
public class MetaDataDialog extends PamDialog {
private static MetaDataDialog singleInstance;
private PamguardMetaData pamguardMetaData;
private DescriptionTypePanel descriptionPanel;
private JTextField project, site, cruise, region;
private ResponsiblePartyPanel responsiblePanel;
private MetaDataDialog(Window parentFrame) {
super(parentFrame, "Project information", false);
JPanel mainPanel = new JPanel();
mainPanel.setLayout(new BorderLayout());
JTabbedPane tabbedPane = new JTabbedPane();
descriptionPanel = new DescriptionTypePanel(null, false, false, false);
descriptionPanel.getMainPanel().setPreferredSize(new Dimension(400,300));
JPanel projectPanel = new JPanel(new GridBagLayout());
GridBagConstraints c = new PamGridBagContraints();
projectPanel.add(new JLabel("Project Name ", JLabel.RIGHT), c);
c.gridx++;
projectPanel.add(project = new JTextField(40), c);
c.gridx = 0;
c.gridy++;
projectPanel.add(new JLabel("Region ", JLabel.RIGHT), c);
c.gridx++;
projectPanel.add(region = new JTextField(20), c);
c.gridx = 0;
c.gridy++;
projectPanel.add(new JLabel("Cruise name ", JLabel.RIGHT), c);
c.gridx++;
projectPanel.add(cruise = new JTextField(20), c);
c.gridx = 0;
c.gridy++;
projectPanel.add(new JLabel("Site ", JLabel.RIGHT), c);
c.gridx++;
projectPanel.add(site = new JTextField(20), c);
c.gridx = 0;
c.gridy++;
responsiblePanel = new ResponsiblePartyPanel();
JPanel northPanel = new JPanel();
WestAlignedPanel wp;
northPanel.setLayout(new BoxLayout(northPanel, BoxLayout.Y_AXIS));
northPanel.add(wp = new WestAlignedPanel(projectPanel));
wp.setBorder(new TitledBorder("General project information"));
northPanel.add(wp = new WestAlignedPanel(responsiblePanel.getMainPanel()));
wp.setBorder(new TitledBorder("Contact information"));
// mainPanel.add(BorderLayout.CENTER, descriptionPanel.getMainPanel());
// mainPanel.add(BorderLayout.NORTH, northPanel);
mainPanel.add(tabbedPane, BorderLayout.CENTER);
tabbedPane.add(northPanel, "General");
tabbedPane.add(descriptionPanel.getMainPanel(), "Description");
setResizable(true);
setDialogComponent(mainPanel);
}
public static PamguardMetaData showDialog(Window frame, PamguardMetaData pamguardMetaData) {
singleInstance = new MetaDataDialog(frame);
singleInstance.setParams(pamguardMetaData);
singleInstance.setVisible(true);
return singleInstance.pamguardMetaData;
}
private void setParams(PamguardMetaData pamguardMetaData) {
this.pamguardMetaData = pamguardMetaData;
Deployment deployment = pamguardMetaData.getDeployment();
descriptionPanel.setParams(deployment.getDescription());
responsiblePanel.setParams(deployment.getMetadataInfo().getContact());
cruise.setText(deployment.getCruise());
region.setText(deployment.getRegion());
site.setText(deployment.getSite());
project.setText(deployment.getProject());
}
@Override
public boolean getParams() {
Deployment deployment = pamguardMetaData.getDeployment();
boolean ok = descriptionPanel.getParams(deployment.getDescription());
ok &= responsiblePanel.getParams(deployment.getMetadataInfo().getContact());
deployment.setCruise(cruise.getText());
deployment.setRegion(region.getText());
deployment.setSite(site.getText());
deployment.setProject(project.getText());
return ok;
}
@Override
public void cancelButtonPressed() {
pamguardMetaData = null;
}
@Override
public void restoreDefaultSettings() {
}
}

View File

@ -37,7 +37,6 @@ import PamView.dialog.warn.WarnOnce;
import PamguardMVC.PamDataBlock;
import metadata.MetaDataContol;
import metadata.PamguardMetaData;
import metadata.deployment.DeploymentData;
import nilus.Deployment;
import tethys.TethysState.StateType;
import tethys.calibration.CalibrationHandler;
@ -427,15 +426,6 @@ public class TethysControl extends PamControlledUnit implements PamSettings, Tet
// return deploymentData;
}
/**
* Gets a copy of Deployment data stored with other Tethys params when the more
* general meta data provider is not present.
* @return
*/
private DeploymentData getTethysProjectData() {
return tethysExportParams.getProjectData();
}
/**
* Add a new state observer.
* @param stateObserver

View File

@ -37,7 +37,6 @@ import dataMap.OfflineDataMapPoint;
import generalDatabase.DBControlUnit;
import metadata.MetaDataContol;
import metadata.PamguardMetaData;
import metadata.deployment.DeploymentData;
import nilus.Audio;
import nilus.ChannelInfo;
import nilus.ChannelInfo.DutyCycle;

View File

@ -39,6 +39,20 @@ import tethys.TethysTimeFuncs;
*/
public class NilusUnpacker {
private boolean verbose = false;
/**
* @param verbose
*/
public NilusUnpacker(boolean verbose) {
this.verbose = verbose;
}
public NilusUnpacker() {
super();
}
public Object unpackDocument(Document doc, Class nilusClass) throws SecurityException {
Object nilusObject = null;
@ -155,7 +169,7 @@ public class NilusUnpacker {
* it's possible that they are simply not there.
*/
if (child == null) {
if (required) {
if (required & verbose) {
System.out.printf("Field %s in class %s is required but cannot be found\n", fieldName, nilusClass.getName());
}
continue;
@ -171,7 +185,7 @@ public class NilusUnpacker {
// find a setter for it.
Method setter = findSetter(nilusClass, fieldName);
// System.out.printf("Field %s with element %s and setter %s\n", fieldName, childName, setter);
if (setter == null) {
if (setter == null & verbose) {
System.out.printf("No setter available for field %s and element %s\n", fieldName, elementName);
continue; // eventually do something more intelligent here.
}

View File

@ -8,19 +8,14 @@ import nilus.DescriptionType;
* Because we want to save DescriptionType objects in serialised
* psfx files and because Nilus description types are not serialised
* these have to be wrapped in a total bodge way with reasonably convenient
* constructors and getters for converting back and forth from the nilus object.
* constructors and getters for converting back and forth from the nilus object.
* this is now slightly more rationalised in NilusSettingsWrapper.
* @author dg50
*
*/
public class PDescriptionType implements Serializable {
public class WrappedDescriptionType extends NilusSettingsWrapper<DescriptionType> implements Serializable {
private static final long serialVersionUID = 1L;
protected String objectives;
protected String _abstract;
protected String method;
/**
* Constructor from a set of strings
@ -28,74 +23,70 @@ public class PDescriptionType implements Serializable {
* @param _abstract
* @param method
*/
public PDescriptionType(String objectives, String _abstract, String method) {
public WrappedDescriptionType(String objectives, String _abstract, String method) {
super();
this.objectives = objectives;
this._abstract = _abstract;
this.method = method;
DescriptionType description = getDescription();
description.setObjectives(objectives);
description.setAbstract(_abstract);
description.setMethod(method);
}
public DescriptionType getDescription() {
return getNilusObject(DescriptionType.class);
}
public void setDescription(DescriptionType description) {
setNilusObject(description);
}
/**
* Construct from a nilus object
* @param descriptionType
*/
public PDescriptionType(DescriptionType descriptionType) {
this.objectives = descriptionType.getObjectives();
this._abstract = descriptionType.getAbstract();
this.method = descriptionType.getMethod();
public WrappedDescriptionType(DescriptionType descriptionType) {
this.setNilusObject(descriptionType);
}
public PDescriptionType() {
public WrappedDescriptionType() {
}
public String getObjectives() {
return objectives;
return getDescription().getObjectives();
}
/**
* @return the _abstract
*/
public String getAbstract() {
return _abstract;
return getDescription().getAbstract();
}
/**
* @param _abstract the _abstract to set
*/
public void setAbstract(String _abstract) {
this._abstract = _abstract;
getDescription().setAbstract(_abstract);
}
/**
* @return the method
*/
public String getMethod() {
return method;
return getDescription().getMethod();
}
/**
* @param method the method to set
*/
public void setMethod(String method) {
this.method = method;
getDescription().setMethod(method);
}
/**
* @param objectives the objectives to set
*/
public void setObjectives(String objectives) {
this.objectives = objectives;
getDescription().setObjectives(objectives);;
}
/**
* convert into a nilus object for output.
* @return
*/
public DescriptionType getDescription() {
DescriptionType descriptionType = new DescriptionType();
descriptionType.setAbstract(_abstract);
descriptionType.setObjectives(objectives);
descriptionType.setMethod(method);
return descriptionType;
}
}

View File

@ -8,7 +8,7 @@ import PamguardMVC.PamDataBlock;
import nilus.DescriptionType;
import nilus.GranularityEnumType;
import tethys.TethysControl;
import tethys.niluswraps.PDescriptionType;
import tethys.niluswraps.WrappedDescriptionType;
import tethys.pamdata.TethysDataProvider;
/**
@ -65,11 +65,11 @@ public class StreamExportParams implements Serializable {
/*
* Can't have this here since it isn't serializable.
*/
public PDescriptionType detectionDescription;
public WrappedDescriptionType detectionDescription;
public PDescriptionType getDetectionDescription() {
public WrappedDescriptionType getDetectionDescription() {
if (detectionDescription == null) {
detectionDescription = new PDescriptionType();
detectionDescription = new WrappedDescriptionType();
}
return detectionDescription;
}
@ -89,7 +89,7 @@ public class StreamExportParams implements Serializable {
private void autoFill(TethysControl tethysControl, PamDataBlock dataBlock) {
// there should always be a data provider or we'd never have got this far.
TethysDataProvider dataProvider = dataBlock.getTethysDataProvider(tethysControl);
PDescriptionType desc = getDetectionDescription();
WrappedDescriptionType desc = getDetectionDescription();
desc.setMethod(dataProvider.getDetectionsMethod());
}

View File

@ -4,7 +4,6 @@ import java.io.Serializable;
import java.util.HashMap;
import PamguardMVC.PamDataBlock;
import generalDatabase.DBControlUnit;
import metadata.deployment.DeploymentData;
/**
@ -30,7 +29,6 @@ public class TethysExportParams implements Serializable, Cloneable{
private HashMap<String, StreamExportParams> streamParamsMap = new HashMap();
private DeploymentData deploymentData;
/**
* PAMGuard HAS to have a dataset name to link to data in Tethys, or it all gets
@ -114,11 +112,6 @@ public class TethysExportParams implements Serializable, Cloneable{
return streamParamsMap.get(longDataName);
}
public DeploymentData getProjectData() {
if (deploymentData == null) {
deploymentData = new DeploymentData();
}
return deploymentData;
}
}

View File

@ -12,7 +12,6 @@ import PamController.PamController;
import PamUtils.PamCalendar;
import PamguardMVC.PamDataBlock;
import metadata.MetaDataContol;
import metadata.deployment.DeploymentData;
import nilus.Deployment;
import tethys.TethysControl;
import tethys.dbxml.DBXMLConnect;

View File

@ -27,7 +27,6 @@ import PamView.panel.PamAlignmentPanel;
import PamView.panel.WestAlignedPanel;
import binaryFileStorage.BinaryStore;
import generalDatabase.DBControlUnit;
import metadata.deployment.DeploymentData;
import nilus.Deployment;
import nilus.Deployment.Data;
import tethys.TethysControl;

View File

@ -11,7 +11,6 @@ import javax.swing.border.TitledBorder;
import PamView.dialog.PamGridBagContraints;
import metadata.PamguardMetaData;
import metadata.deployment.DeploymentData;
import nilus.Deployment;
import tethys.TethysControl;

View File

@ -24,7 +24,6 @@ import PamView.panel.PamPanel;
import PamView.panel.WestAlignedPanel;
import metadata.MetaDataContol;
import metadata.PamguardMetaData;
import metadata.deployment.DeploymentData;
import nilus.Deployment;
import pamViewFX.fxNodes.PamComboBox;
import tethys.TethysControl;

View File

@ -19,12 +19,12 @@ public class DescriptionCard extends ExportWizardCard {
@Override
public boolean getParams(StreamExportParams streamExportParams) {
return descriptionPanel.getParams(streamExportParams.getDetectionDescription());
return descriptionPanel.getParams(streamExportParams.getDetectionDescription().getDescription());
}
@Override
public void setParams(StreamExportParams streamExportParams) {
descriptionPanel.setParams(streamExportParams.getDetectionDescription());
descriptionPanel.setParams(streamExportParams.getDetectionDescription().getDescription());
}
}

View File

@ -18,7 +18,7 @@ import javax.swing.border.TitledBorder;
import PamView.PamGui;
import PamView.dialog.PamDialog;
import nilus.DescriptionType;
import tethys.niluswraps.PDescriptionType;
import tethys.niluswraps.WrappedDescriptionType;
/**
* Panel containing the three test entry fields for nilus.DescriptionType
@ -89,7 +89,7 @@ public class DescriptionTypePanel {
return mainPanel;
}
public void setParams(PDescriptionType description) {
public void setParams(DescriptionType description) {
if (description == null) {
tObjectives.setText(null);
tAbstract.setText(null);
@ -102,7 +102,7 @@ public class DescriptionTypePanel {
}
}
public boolean getParams(PDescriptionType description) {
public boolean getParams(DescriptionType description) {
Window f = PamGui.findComponentWindow(mainPanel);
if (checkField(requireObjective, tObjectives) == false) {
return PamDialog.showWarning(f, "Objectives", "The objectives field must be completed");

View File

@ -0,0 +1,77 @@
package tethys.swing.export;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import PamView.dialog.PamGridBagContraints;
import nilus.ResponsibleParty;
/**
* Simple Swing panel for responsibleparty fields.
* @author dg50
*
*/
public class ResponsiblePartyPanel {
private JTextField name, organisation, position, email;
private JPanel mainPanel;
/**
*
*/
public ResponsiblePartyPanel() {
super();
mainPanel = new JPanel(new GridBagLayout());
// mainPanel.setBorder(new TitledBorder("Responsible party"));
GridBagConstraints c = new PamGridBagContraints();
mainPanel.add(new JLabel("Name ", JLabel.RIGHT), c);
c.gridx++;
mainPanel.add(name = new JTextField(40), c);
c.gridx = 0;
c.gridy++;
mainPanel.add(new JLabel("Organisation ", JLabel.RIGHT), c);
c.gridx++;
mainPanel.add(organisation = new JTextField(30), c);
c.gridx = 0;
c.gridy++;
mainPanel.add(new JLabel("Position ", JLabel.RIGHT), c);
c.gridx++;
mainPanel.add(position = new JTextField(30), c);
c.gridx = 0;
c.gridy++;
mainPanel.add(new JLabel("Email ", JLabel.RIGHT), c);
c.gridx++;
mainPanel.add(email = new JTextField(30), c);
c.gridx = 0;
c.gridy++;
}
public JPanel getMainPanel() {
return mainPanel;
}
public void setParams(ResponsibleParty responsibleParty) {
if (responsibleParty == null) {
return;
}
name.setText(responsibleParty.getIndividualName());
organisation.setText(responsibleParty.getOrganizationName());
position.setText(responsibleParty.getPositionName());
email.setText(responsibleParty.getContactInfo().getContactInstructions());
}
public boolean getParams(ResponsibleParty responsibleParty) {
responsibleParty.setIndividualName(name.getText());
responsibleParty.setOrganizationName(organisation.getText());
responsibleParty.setPositionName(position.getText());
responsibleParty.getContactInfo().setContactInstructions(email.getText());
return true;
}
}