diff --git a/.classpath b/.classpath index c623317c..576b210a 100644 --- a/.classpath +++ b/.classpath @@ -6,7 +6,7 @@ - + diff --git a/src/PamModel/PamModel.java b/src/PamModel/PamModel.java index fdaa98ce..2ff3b92e 100644 --- a/src/PamModel/PamModel.java +++ b/src/PamModel/PamModel.java @@ -877,7 +877,7 @@ final public class PamModel implements PamSettings { mi.setModulesMenuGroup(displaysGroup); mi.addGUICompatabilityFlag(PamGUIManager.FX); - mi = PamModuleInfo.registerControlledUnit("detectionPlotFX.DetectionDisplayControl", "Detection Display" ); + mi = PamModuleInfo.registerControlledUnit("detectionPlotFX.DetectionDisplayControl2", "Detection Display" ); mi.setToolTipText("Display detection data"); mi.setModulesMenuGroup(displaysGroup); mi.addGUICompatabilityFlag(PamGUIManager.FX); diff --git a/src/PamView/PamGui.java b/src/PamView/PamGui.java index 759a9956..e8384059 100644 --- a/src/PamView/PamGui.java +++ b/src/PamView/PamGui.java @@ -74,7 +74,7 @@ import javax.swing.event.MenuListener; import Acquisition.DaqSystemInterface; import annotation.tasks.AnnotationManager; -import export.layoutFX.ExportOptions; +import export.ExportOptions; import metadata.MetaDataContol; import pamViewFX.fxNodes.pamDialogFX.PamDialogFX2AWT; import performanceTests.PerformanceDialog; diff --git a/src/dataModelFX/DataModelPaneFX.java b/src/dataModelFX/DataModelPaneFX.java index 4ee15e8b..05312b5f 100644 --- a/src/dataModelFX/DataModelPaneFX.java +++ b/src/dataModelFX/DataModelPaneFX.java @@ -313,7 +313,7 @@ public class DataModelPaneFX extends PamBorderPane { * data is changed in external dialogs. */ protected void dataModeltoPamModel() { - // System.out.println("************DATAMODELTOPAMMODEL*************"); + System.out.println("************DATAMODELTOPAMMODEL*************"); if (disableNotification) return; @@ -328,8 +328,8 @@ public class DataModelPaneFX extends PamBorderPane { childNode = (ModuleConnectionNode) dataModelPane.getConnectionNodes().get(i); if (childNode.getPamControlledUnit() == null) continue; - // System.out.println("Children of " + ((ModuleConnectionNode) - // dataModelPane.getConnectionNodes().get(i)).getPamControlledUnit().getUnitType()); + System.out.println("Children of " + ((ModuleConnectionNode) + dataModelPane.getConnectionNodes().get(i)).getPamControlledUnit().getUnitType()); checkParentChildConnections(childNode, true); } enableConectionListerner(true); @@ -356,7 +356,7 @@ public class DataModelPaneFX extends PamBorderPane { * modules with dependencies are added. */ protected void pamModeltoDataModel(boolean disconnect) { - // System.out.println("************PAMMODELTODATAMODEL*************"); + System.out.println("************PAMMODELTODATAMODEL*************"); if (disableNotification) return; disableNotification = true; @@ -367,10 +367,13 @@ public class DataModelPaneFX extends PamBorderPane { */ for (int i = 0; i < this.dataModelPane.getConnectionNodes().size(); i++) { childNode = (ModuleConnectionNode) dataModelPane.getConnectionNodes().get(i); + System.out.println("Node " + i); + if (childNode.getPamControlledUnit() == null) continue; - // System.out.println("Children of " + ((ModuleConnectionNode) - // dataModelPane.getConnectionNodes().get(i)).getPamControlledUnit().getUnitType()); + System.out.println("Children of " + ((ModuleConnectionNode) + dataModelPane.getConnectionNodes().get(i)).getPamControlledUnit().getUnitType()); + checkModuleConnection(childNode); checkParentChildConnections(childNode, !disconnect); } @@ -396,7 +399,7 @@ public class DataModelPaneFX extends PamBorderPane { * error. */ private boolean checkModuleConnection(ModuleConnectionNode childNode) { - + // find all parent nodes. ArrayList parentNodesS = dataModelPane.getParentConnectionNodes(childNode); @@ -413,13 +416,13 @@ public class DataModelPaneFX extends PamBorderPane { } else { - // System.out.println(" CHILD NODE: " - // +childNode.getPamControlledUnit().getUnitName()); - // for (int i=0; i{ - if (this.pamControlledUnit.getPamModuleInfo()== null || this.pamControlledUnit.getPamModuleInfo().canRemove()){ + if (this.pamControlledUnit==null || this.pamControlledUnit.getPamModuleInfo()== null || this.pamControlledUnit.getPamModuleInfo().canRemove()){ connectionPane.removeModuleNode(this); } }); diff --git a/src/dataModelFX/connectionNodes/ModuleIconFactory.java b/src/dataModelFX/connectionNodes/ModuleIconFactory.java index c85f66f0..b9992530 100644 --- a/src/dataModelFX/connectionNodes/ModuleIconFactory.java +++ b/src/dataModelFX/connectionNodes/ModuleIconFactory.java @@ -249,6 +249,7 @@ public class ModuleIconFactory { icon=ModuleIcon.TIME_DISPLAY; break; case "detectionPlotFX.DetectionDisplayControl": + case "detectionPlotFX.DetectionDisplayControl2": icon=ModuleIcon.DETECTION_DISPLAY; break; case "dataMap.DataMapControl": diff --git a/src/dataPlotsFX/TDControlFX.java b/src/dataPlotsFX/TDControlFX.java index e82c57f1..f02b8d6b 100644 --- a/src/dataPlotsFX/TDControlFX.java +++ b/src/dataPlotsFX/TDControlFX.java @@ -233,8 +233,6 @@ public class TDControlFX extends TDControl implements UserDisplayNodeFX { } - - /** * The data observer monitors only the raw data source in real time * so that scrolling can take place. Need to set up a different @@ -401,5 +399,9 @@ public class TDControlFX extends TDControl implements UserDisplayNodeFX { @Override public void newSelectedDetectionGroup(DetectionGroupSummary detectionGroup, TDGraphFX tdGraph) { System.out.println("New selected detection group: " + detectionGroup); + + tdDisplayController.getDisplayDataBlock().clearAll(); + if (detectionGroup==null || detectionGroup.getDataList().size()<=0) return; + tdDisplayController.getDisplayDataBlock().addPamData(detectionGroup.getDataList().get(detectionGroup.getFocusedIndex())); } } diff --git a/src/dataPlotsFX/TDDisplayController.java b/src/dataPlotsFX/TDDisplayController.java index 65ea26a1..193b2efa 100644 --- a/src/dataPlotsFX/TDDisplayController.java +++ b/src/dataPlotsFX/TDDisplayController.java @@ -4,6 +4,8 @@ import java.util.ArrayList; import dataPlotsFX.data.TDDataInfoFX; import dataPlotsFX.data.TDDataProviderFX; import dataPlotsFX.data.TDDataProviderRegisterFX; +import detectionPlotFX.data.DDPlotRegister; +import detectionPlotFX.rawDDPlot.ClickDDPlotProvider; import pamViewFX.PamControlledGUIFX; import userDisplayFX.UserDisplayControlFX; import userDisplayFX.UserDisplayNodeFX; @@ -48,6 +50,8 @@ public class TDDisplayController extends UserDisplayControlFX { selectedDataUnits = new PamDataBlock(PamDataUnit.class, "Selected Data Units", getUserDisplayProcess() , Integer.MAX_VALUE); //TODO getUserDisplayProcess().addOutputDataBlock(selectedDataUnits); + + } /** @@ -154,6 +158,14 @@ public class TDDisplayController extends UserDisplayControlFX { System.out.println(tdPlotProviders.get(i).getDataBlock().getUnitClass()); } } + + /** + * Get the datablock for selected data units from the display. + * @return datablock for selected data units. + */ + public PamDataBlock getDisplayDataBlock() { + return selectedDataUnits; + } } diff --git a/src/dataPlotsFX/overlaymark/popUpMenu/OverlayGroupDisplay.java b/src/dataPlotsFX/overlaymark/popUpMenu/OverlayGroupDisplay.java index d84bd7c8..de0855c4 100644 --- a/src/dataPlotsFX/overlaymark/popUpMenu/OverlayGroupDisplay.java +++ b/src/dataPlotsFX/overlaymark/popUpMenu/OverlayGroupDisplay.java @@ -253,7 +253,6 @@ public class OverlayGroupDisplay extends PamBorderPane { this.detectionsPane.setDetectionGroup(dataList); - if (superDets!=null) { this.superDetectionsDisplay.setDetectionGroup(new ArrayList(superDets)); } diff --git a/src/detectionPlotFX/DetectionDisplayControl.java b/src/detectionPlotFX/DetectionDisplayControl.java index d9e78654..a725a4ea 100644 --- a/src/detectionPlotFX/DetectionDisplayControl.java +++ b/src/detectionPlotFX/DetectionDisplayControl.java @@ -119,8 +119,11 @@ public class DetectionDisplayControl extends UserDisplayControlFX { */ public boolean newDataBlockAdded(PamDataBlock pamDataBlock){ + System.out.println("New datablock added: " + pamDataBlock.getDataName()); + //now must find the data provider. //first get the list of dataInfos. + //22/05/206. Need to check we have the correct datablock before doing anything else. The datablock should //be null or of the correct type. If not need to keep the last connection. DDDataProvider newDataProviderFX=DDPlotRegister.getInstance().findDataProvider(pamDataBlock); @@ -147,7 +150,7 @@ public class DetectionDisplayControl extends UserDisplayControlFX { this.detectionDisplay.setDataInfo(newDataProviderFX); //now add the observer to the data block - //System.out.println("DetectionDisplayControl: Adding observer to datablock: "+ pamDataBlock.getDataName()); + //System.out.println("DetectionDisplayControl: Adding observer to data block: "+ pamDataBlock.getDataName()); pamDataBlock.addObserver(this.detectionDataObserver); return true; @@ -181,7 +184,7 @@ public class DetectionDisplayControl extends UserDisplayControlFX { @Override public void addData(PamObservable o, PamDataUnit arg) { - //System.out.println("DetectionDisplay: Incoming data unit: "+arg.getParentDataBlock().getDataName()); + System.out.println("DetectionDisplay: Incoming data unit: "+arg.getParentDataBlock().getDataName()); //send the data unit to the display. //TODO-why? Platform.runLater(()->{ diff --git a/src/detectionPlotFX/DetectionDisplayControl2.java b/src/detectionPlotFX/DetectionDisplayControl2.java new file mode 100644 index 00000000..09960f4e --- /dev/null +++ b/src/detectionPlotFX/DetectionDisplayControl2.java @@ -0,0 +1,157 @@ +package detectionPlotFX; + +import java.util.ArrayList; + +import PamController.PamControllerInterface; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; +import PamguardMVC.PamObservable; +import PamguardMVC.PamObserverAdapter; +import userDisplayFX.UserDisplayControlFX; +import userDisplayFX.UserDisplayNodeFX; + + +/** + * Detection plot which can display single or groups of detections. + * + * @author Jamie Macaulay + * + */ +public class DetectionDisplayControl2 extends UserDisplayControlFX { + + + /** + * The display + */ + private DetectionGroupDisplay detectionDisplay; + + /** + * A list of displays-> really redundant as there is only ever one display. + */ + private ArrayList displays; + + /** + * The data observer that + */ + private DetectionDataObserver detectionDataObserver; + + + public DetectionDisplayControl2(String unitName) { + super(unitName); + //set which data blocks can connect as parents. + setCompatibleDataUnits(); + //create the observer for the parent data block. + detectionDataObserver=new DetectionDataObserver(); + setMultiParent(false); + + } + + /** + * Set compatible data units in the process for this display. This allows the data model to determine if connections can + * be made to the display. + */ + @SuppressWarnings("unchecked") + private void setCompatibleDataUnits(){ + super.removeCompatibleDataUnits(); + super.addCompatibleUnit(PamDataUnit.class); + + //also add data unit + } + + + @Override + public void notifyModelChanged(int type){ + System.out.println("NOTIFICATION: " + type); + super.notifyModelChanged(type); + switch (type){ + case PamControllerInterface.INITIALIZATION_COMPLETE: + setCompatibleDataUnits(); + break; + case PamControllerInterface.ADD_CONTROLLEDUNIT: + setCompatibleDataUnits(); + break; + case PamControllerInterface.CHANGED_PROCESS_SETTINGS: + //this is were the data block may have been added. Need to add an observer to this data block to say when the thing has + //thing has a new detection. + displayToDataModel(this.getUserDisplayProcess().getParentDataBlock()); + break; + } + this.detectionDisplay.notifyModelChanged(type); + } + + /** + * Set the display to show detections form the data block set in the data model- + * i.e. show it's parent data block. + */ + protected void displayToDataModel(PamDataBlock parentDataBlock){ + //remove any TDDataInfos which are not present in the data block list + //if the datablock the same do nothing + newDataBlockAdded(parentDataBlock); + } + + /** + * Called whenever a new data block is added to the display. + * Removes the observer from all other data blocks in the model + * and then the adds the observer to that data block; + * @return true if the parent has successfully been added. + */ + public boolean newDataBlockAdded(PamDataBlock pamDataBlock){ + + System.out.println("NEW DATA BLOCK DETECTION DISPLAY"); + + //if null then no parent- simply set the DDataInfo to null; + if (pamDataBlock==null) { + this.detectionDisplay.clearDisplay(); + return true; + } + + //now add the observer to the data block + //System.out.println("DetectionDisplayControl: Adding observer to data block: "+ pamDataBlock.getDataName()); + pamDataBlock.addObserver(this.detectionDataObserver); + + return true; + } + + @Override + public ArrayList getDisplays(){ + if (displays==null){ + detectionDisplay=new DetectionGroupDisplay(); + displays=new ArrayList(); + displays.add(detectionDisplay); + } + return displays; + } + + + + /** + * + * The data observer monitors incoming data from data blocks. + * + * @author Doug Gillespie and Jamie Macaulay + * + */ + private class DetectionDataObserver extends PamObserverAdapter { + + @Override + public long getRequiredDataHistory(PamObservable o, Object arg) { + return 1000; //no data histroy required for this click. + } + + @Override + public void addData(PamObservable o, PamDataUnit arg) { + System.out.println("DetectionDisplay: INCOMING data unit: "+arg.getParentDataBlock().getDataName()); + //send the data unit to the display. + + + } + + @Override + public String getObserverName() { + return "Detection Display FX"; + } + + } + + +} diff --git a/src/detectionPlotFX/DetectionGroupDisplay.java b/src/detectionPlotFX/DetectionGroupDisplay.java index e2e553d4..f903d94d 100644 --- a/src/detectionPlotFX/DetectionGroupDisplay.java +++ b/src/detectionPlotFX/DetectionGroupDisplay.java @@ -18,6 +18,7 @@ import javafx.geometry.Side; import javafx.scene.control.Label; import javafx.scene.layout.BorderPane; import javafx.scene.layout.Pane; +import javafx.scene.layout.Region; import javafx.scene.layout.StackPane; import pamViewFX.PamGuiManagerFX; import pamViewFX.fxGlyphs.PamGlyphDude; @@ -25,7 +26,10 @@ import pamViewFX.fxNodes.PamBorderPane; import pamViewFX.fxNodes.PamButton; import pamViewFX.fxNodes.PamHBox; import pamViewFX.fxNodes.hidingPane.HidingPane; +import pamViewFX.fxNodes.internalNode.PamInternalPane; import pamViewFX.fxStyles.PamStylesManagerFX; +import userDisplayFX.UserDisplayNodeFX; +import userDisplayFX.UserDisplayNodeParams; /** * @@ -35,7 +39,7 @@ import pamViewFX.fxStyles.PamStylesManagerFX; * @author Jamie Macaulay * */ -public class DetectionGroupDisplay extends PamBorderPane { +public class DetectionGroupDisplay extends PamBorderPane implements UserDisplayNodeFX { /** * Index of the current normal unit with the detection summary. @@ -97,12 +101,19 @@ public class DetectionGroupDisplay extends PamBorderPane { * Hiding pane for the plot settings. */ private HidingPane hidingPane; + + /** + * The detection pot paramters. + */ + DetectionPlotParams detectionPlotParams; public DetectionGroupDisplay() { //create hash map to map DDDataInfos to datablocks for quick access. dDataInfoHashMap = new HashMap(); + detectionPlotParams=new DetectionPlotParams(); createDetectionDisplay(); this.setCenter(detectionDisplayHolder); + } /** @@ -426,4 +437,66 @@ public class DetectionGroupDisplay extends PamBorderPane { return detectionGroup.get(currentUnitIndex); } + @Override + public String getName() { + return "Detection Dsiplay"; + } + + @Override + public Region getNode() { + // TODO Auto-generated method stub + return this; + } + + @Override + public void openNode() { + // TODO Auto-generated method stub + + } + + @Override + public boolean isStaticDisplay() { + return false; + } + + @Override + public boolean isResizeableDisplay() { + return true; + } + + @Override + public boolean isMinorDisplay() { + return true; + } + + @Override + public boolean requestNodeSettingsPane() { + // TODO Auto-generated method stub + return false; + } + + @Override + public void closeNode() { + // TODO Auto-generated method stub + + } + + @Override + public void notifyModelChanged(int changeType) { + // TODO Auto-generated method stub + + } + + @Override + public UserDisplayNodeParams getDisplayParams() { + return detectionPlotParams; + } + + @Override + public void setFrameHolder(PamInternalPane internalFrame) { + // TODO Auto-generated method stub + + } + + } \ No newline at end of file diff --git a/src/detectionPlotFX/GeneralDDPlotProvider.java b/src/detectionPlotFX/GeneralDDPlotProvider.java new file mode 100644 index 00000000..75825b57 --- /dev/null +++ b/src/detectionPlotFX/GeneralDDPlotProvider.java @@ -0,0 +1,20 @@ +package detectionPlotFX; + +import PamguardMVC.PamDataBlock; +import detectionPlotFX.data.DDDataInfo; +import detectionPlotFX.data.DDDataProvider; +import detectionPlotFX.layout.DetectionPlotDisplay; + +public class GeneralDDPlotProvider extends DDDataProvider { + + public GeneralDDPlotProvider(PamDataBlock parentDataBlock) { + super(parentDataBlock); + // TODO Auto-generated constructor stub + } + + @Override + public DDDataInfo createDataInfo(DetectionPlotDisplay tdGraph) { + return null; + } + +} diff --git a/src/detectiongrouplocaliser/DetectionGroupSummary.java b/src/detectiongrouplocaliser/DetectionGroupSummary.java index ff86d16a..db461e89 100644 --- a/src/detectiongrouplocaliser/DetectionGroupSummary.java +++ b/src/detectiongrouplocaliser/DetectionGroupSummary.java @@ -39,7 +39,7 @@ public class DetectionGroupSummary { private OverlayMark overlayMark; /** - * Thye currently selected or focused data unit; + * The currently selected or focused data unit; */ private int focusedUnitIndex=0; diff --git a/src/export/layoutFX/ExportOptions.java b/src/export/ExportOptions.java similarity index 91% rename from src/export/layoutFX/ExportOptions.java rename to src/export/ExportOptions.java index c153dfca..a78e2da5 100644 --- a/src/export/layoutFX/ExportOptions.java +++ b/src/export/ExportOptions.java @@ -1,4 +1,4 @@ -package export.layoutFX; +package export; import java.io.Serializable; import javax.swing.JFrame; @@ -7,11 +7,11 @@ import PamController.PamControlledUnitSettings; import PamController.PamSettingManager; import PamController.PamSettings; import PamController.StorageParameters; -import export.PamExporterManager; +import export.layoutFX.ExportParams; import export.swing.ExportProcessDialog; /** - * Manages opening settings dialog and saving settings. + * Manages opening settings dialog and saving settings for both FX and Swing GUI's * * @author Jamie Macaulay * @@ -57,7 +57,8 @@ public class ExportOptions implements PamSettings { if (exportProcessDialog==null) { exportProcessDialog= new ExportProcessDialog(exportManager); } - this.exportProcessDialog.showOfflineDialog(parentFrame); + + this.exportProcessDialog.showOfflineDialog(parentFrame, this.storageParameters); // ExportParams newParams = StorageOptionsDialog.showDialog(parentFrame, storageParameters); // if (newParams != null) { diff --git a/src/export/MLExport/MLDetectionsManager.java b/src/export/MLExport/MLDetectionsManager.java index 1a03e6b8..38c14cca 100644 --- a/src/export/MLExport/MLDetectionsManager.java +++ b/src/export/MLExport/MLDetectionsManager.java @@ -137,6 +137,11 @@ public class MLDetectionsManager implements PamDataUnitExporter { return "file-matlab"; } + @Override + public String getName() { + return "MATLAB"; + } + diff --git a/src/export/PamDataUnitExporter.java b/src/export/PamDataUnitExporter.java index 8a399230..22c3dc2d 100644 --- a/src/export/PamDataUnitExporter.java +++ b/src/export/PamDataUnitExporter.java @@ -39,5 +39,11 @@ public interface PamDataUnitExporter { */ public String getIconString(); + /** + * Get the name of the exporter + * @return + */ + public String getName(); + } diff --git a/src/export/RExport/RExportManager.java b/src/export/RExport/RExportManager.java index 38dd55c0..af5d0020 100644 --- a/src/export/RExport/RExportManager.java +++ b/src/export/RExport/RExportManager.java @@ -144,7 +144,7 @@ public class RExportManager implements PamDataUnitExporter { @Override public String getFileExtension() { - return ".RData"; + return "RData"; } @Override @@ -152,6 +152,11 @@ public class RExportManager implements PamDataUnitExporter { return "file-r"; } + @Override + public String getName() { + return "R data"; + } + } diff --git a/src/export/layoutFX/ExportParams.java b/src/export/layoutFX/ExportParams.java index ea53be9d..c4db163d 100644 --- a/src/export/layoutFX/ExportParams.java +++ b/src/export/layoutFX/ExportParams.java @@ -9,13 +9,16 @@ import java.io.Serializable; * */ public class ExportParams implements Serializable, Cloneable { - + /** * */ private static final long serialVersionUID = 1L; - public int exportChoice; + /** + * The index of the ex;port choice. + */ + public int exportChoice = 0; @Override diff --git a/src/export/swing/ExportProcessDialog.java b/src/export/swing/ExportProcessDialog.java index 3238e49e..554b22a3 100644 --- a/src/export/swing/ExportProcessDialog.java +++ b/src/export/swing/ExportProcessDialog.java @@ -2,14 +2,30 @@ package export.swing; import java.awt.BorderLayout; import java.awt.Color; +import java.awt.Dimension; import java.awt.Frame; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; import java.awt.Window; import java.awt.event.ActionListener; +import java.io.File; import java.util.ArrayList; +import javax.swing.Box; +import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.Icon; +import javax.swing.JCheckBox; +import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JSpinner; +import javax.swing.JSpinner.DefaultEditor; +import javax.swing.JTextField; import javax.swing.JToggleButton; +import javax.swing.SpinnerListModel; +import javax.swing.SwingConstants; +import javax.swing.border.TitledBorder; import org.kordamp.ikonli.Ikon; import org.kordamp.ikonli.fileicons.FileIcons; @@ -18,14 +34,19 @@ import org.kordamp.ikonli.materialdesign2.MaterialDesignF; import org.kordamp.ikonli.swing.FontIcon; import PamController.PamController; +import PamUtils.PamFileChooser; +import PamView.dialog.PamButton; +import PamView.dialog.PamGridBagContraints; import PamView.panel.PamPanel; import PamguardMVC.PamDataBlock; import export.PamExporterManager; +import export.layoutFX.ExportParams; import offlineProcessing.OLProcessDialog; import offlineProcessing.OfflineTaskGroup; /** - * Processes exportying data. + * Handles an offline dialog for processing offline data and exporting to bespoke file types. + * * @author Jamie Macaulay * */ @@ -37,13 +58,19 @@ public class ExportProcessDialog { */ private OfflineTaskGroup dlOfflineGroup; - private OLProcessDialog mtOfflineDialog; + + private ExportOLDialog mtOfflineDialog; /** * Reference to the export manager. */ private PamExporterManager exportManager; + /** + * The current paramters. + */ + private ExportParams currentParams; + public ExportProcessDialog(PamExporterManager exportManager) { //create the offline task group. this.exportManager=exportManager; @@ -52,13 +79,13 @@ public class ExportProcessDialog { public void createExportGroup() { - + //clear current tasks. dlOfflineGroup.clearTasks(); //go through every data block we have and check if we can export the data units... ArrayList dataBlocks= PamController.getInstance().getDataBlocks(); - + for (int i=0; i { System.out.println(actionEvent.getActionCommand() + " Selected"); @@ -111,27 +159,82 @@ public class ExportProcessDialog { for (int i = 0; i < exportManager.getNumExporters(); i++) { JToggleButton b = new JToggleButton(); - + b.setToolTipText("Export to " + exportManager.getExporter(i).getName() + " file (" + exportManager.getExporter(i).getFileExtension() + ")"); + FontIcon icon = FontIcon.of(getIconFromString(exportManager.getExporter(i).getIconString())); icon.setIconSize(25); icon.setIconColor(Color.GRAY); - - + b.setIcon(icon); - + b.addActionListener(listener); buttonGroup.add(b); buttonPanel.add(b); } - mainPanel.add(buttonPanel, BorderLayout.CENTER); - //add the main panel at a diffderent index. - getMainPanel().add(buttonPanel, 1); - } - - private Ikon getIconFromString(String iconString) { + PamPanel p = new PamPanel(new GridBagLayout()); + GridBagConstraints c = new PamGridBagContraints(); + c.gridwidth = 3; + c.gridx = 0; + c.gridy = 0; + + addComponent(p, exportTo = new JTextField(), c); + exportTo.setMinimumSize(new Dimension(170, 25)); + exportTo.setPreferredSize(new Dimension(170, 25)); + + c.gridx +=3; + c.gridwidth = 1; + PamButton button = new PamButton("Browse..."); + + fc = new PamFileChooser(); + fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + + button.addActionListener((action)->{ + int returnVal = fc.showSaveDialog(this); + if(returnVal == JFileChooser.APPROVE_OPTION) { + File yourFolder = fc.getSelectedFile(); + exportTo.setText(yourFolder.getAbsolutePath()); + exportTo.setToolTipText(yourFolder.getAbsolutePath()); + } + }); + + addComponent(p, button, c); + + c.gridx = 1; + c.gridy++; + c.gridwidth = 2; + JLabel label = new JLabel("Maximum file size", SwingConstants.RIGHT); + addComponent(p, label, c); + + c.gridwidth = 1; + c.gridx +=2; + + SpinnerListModel list = new SpinnerListModel(new Double[] {10.,30., 60., 100., 200., 300., 600., 1000.}); + + spinner = new JSpinner(list); + //don't want the user to to able to set values + ((DefaultEditor) spinner.getEditor()).getTextField().setEditable(false); + spinner.setBounds(50, 80, 70, 100); + addComponent(p, spinner, c); + + c.gridx ++; + addComponent(p, new JLabel("MB"), c); + + + + mainPanel.add(p); + mainPanel.add(buttonPanel); + + //add the main panel at a different index. + getMainPanel().add(mainPanel, 1); + } + + + + private Ikon getIconFromString(String iconString) { + Ikon icon = null; /** * This is nasty but we won't have many exporters and this is the only @@ -143,17 +246,34 @@ public class ExportProcessDialog { break; case "file-r": icon=FileIcons.R; - break; + break; case "mdi2f-file-music": icon=MaterialDesignF.FILE_MUSIC; break; } - return icon; - } + public ExportParams getExportParams() { + + + return currentParams; + } + + @Override + public boolean getParams() { + //make sure we update the current paramters before processing starts. + this.currentParams = getExportParams(); + return super.getParams(); + } + + + public void setParams(ExportParams params) { + if (params ==null) currentParams = new ExportParams(); + currentParams = params.clone(); + + } } @@ -174,4 +294,9 @@ public class ExportProcessDialog { + + + + + } \ No newline at end of file diff --git a/src/export/wavExport/WavFileExportManager.java b/src/export/wavExport/WavFileExportManager.java index 65743f80..000a8f5a 100644 --- a/src/export/wavExport/WavFileExportManager.java +++ b/src/export/wavExport/WavFileExportManager.java @@ -79,7 +79,7 @@ public class WavFileExportManager implements PamDataUnitExporter { /** - * Get a list of ecporters that can export wav files from a data unit. + * Get a list of exporters that can export wav files from a data unit. * @return the wav file exporters. */ public ArrayList getWavDataUnitExporters() { @@ -453,6 +453,13 @@ public class WavFileExportManager implements PamDataUnitExporter { + @Override + public String getName() { + return "raw sound"; + } + + + // hello(){ diff --git a/src/noiseBandMonitor/NoiseBandProcess.java b/src/noiseBandMonitor/NoiseBandProcess.java index 0f576887..0da99e14 100644 --- a/src/noiseBandMonitor/NoiseBandProcess.java +++ b/src/noiseBandMonitor/NoiseBandProcess.java @@ -64,9 +64,9 @@ public class NoiseBandProcess extends PamProcess { super.setupProcess(); PamDataBlock sourceData = noiseBandControl.getPamConfiguration().getDataBlock(RawDataUnit.class, noiseBandControl.noiseBandSettings.rawDataSource); - System.out.println("********************************************************"); - System.out.println("NOISE BAND PROCESS: " + sourceData + " " + noiseBandControl.noiseBandSettings.rawDataSource); - System.out.println("********************************************************"); +// System.out.println("********************************************************"); +// System.out.println("NOISE BAND PROCESS: " + sourceData + " " + noiseBandControl.noiseBandSettings.rawDataSource); +// System.out.println("********************************************************"); if (sourceData == null) { return; } diff --git a/src/offlineProcessing/OLProcessDialog.java b/src/offlineProcessing/OLProcessDialog.java index 615a32e6..9e6f6c8a 100644 --- a/src/offlineProcessing/OLProcessDialog.java +++ b/src/offlineProcessing/OLProcessDialog.java @@ -35,6 +35,7 @@ import PamView.panel.PamAlignmentPanel; import PamView.panel.PamPanel; import PamView.panel.PamProgressBar; import PamguardMVC.PamDataBlock; +import export.layoutFX.ExportParams; import offlineProcessing.logging.OldTaskData; import offlineProcessing.logging.TaskLogging; import offlineProcessing.superdet.OfflineSuperDetFilter; @@ -836,4 +837,5 @@ public class OLProcessDialog extends PamDialog { return this.taskGroup; } + } diff --git a/src/rawDeepLearningClassifier/layoutFX/DLSettingsPane.java b/src/rawDeepLearningClassifier/layoutFX/DLSettingsPane.java index b07fe4fc..7c67d5d8 100644 --- a/src/rawDeepLearningClassifier/layoutFX/DLSettingsPane.java +++ b/src/rawDeepLearningClassifier/layoutFX/DLSettingsPane.java @@ -343,7 +343,9 @@ public class DLSettingsPane extends SettingsPane{ */ private void enableControls() { this.dataSelectorPane.setVisible(true); - //only show the data selector box for detection data. + //only show the data selector box for detec tion data. + if (sourcePane.getSource() == null) this.dataSelectorPane.setVisible(false); + if (sourcePane.getSource().getDataSelectCreator() instanceof NullDataSelectorCreator) { //^bit messy but cannot think of a better way to do it. this.dataSelectorPane.setVisible(false);