diff --git a/pom.xml b/pom.xml index 4c03eb41..20248009 100644 --- a/pom.xml +++ b/pom.xml @@ -784,7 +784,7 @@ pamguard.org x3 - 2.1.0 + 2.2.0 diff --git a/repo/pamguard/org/x3/2.2.0/_remote.repositories b/repo/pamguard/org/x3/2.2.0/_remote.repositories new file mode 100644 index 00000000..725ee49b --- /dev/null +++ b/repo/pamguard/org/x3/2.2.0/_remote.repositories @@ -0,0 +1,4 @@ +#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice. +#Mon Nov 14 09:57:39 GMT 2022 +x3-2.2.0.jar>= +x3-2.2.0.pom>= diff --git a/repo/pamguard/org/x3/2.2.0/m2e-lastUpdated.properties b/repo/pamguard/org/x3/2.2.0/m2e-lastUpdated.properties new file mode 100644 index 00000000..d95ec242 --- /dev/null +++ b/repo/pamguard/org/x3/2.2.0/m2e-lastUpdated.properties @@ -0,0 +1,7 @@ +#Fri Nov 11 13:38:50 GMT 2022 +central|https\://repo1.maven.org/maven2|sources=1668173930657 +repo|file\:///Users/au671271/git/PAMGuard/repo|sources=1668173930657 +talan|https\://nexus.talanlabs.com/content/repositories/releases/|sources=1668173930657 +bintray-macster110-jtorch4pam|macster110|https\://dl.bintray.com/macster110/jtorch4pam|sources=1668173930657 +bedatadriven|https\://nexus.bedatadriven.com/content/groups/public/|sources=1668173930657 +unidata-all|https\://artifacts.unidata.ucar.edu/repository/unidata-all/|sources=1668173930657 diff --git a/repo/pamguard/org/x3/2.2.0/x3-2.2.0-sources.jar.lastUpdated b/repo/pamguard/org/x3/2.2.0/x3-2.2.0-sources.jar.lastUpdated new file mode 100644 index 00000000..0248ad5d --- /dev/null +++ b/repo/pamguard/org/x3/2.2.0/x3-2.2.0-sources.jar.lastUpdated @@ -0,0 +1,14 @@ +#NOTE: This is a Maven Resolver internal implementation file, its format can be changed without prior notice. +#Fri Nov 11 13:38:50 GMT 2022 +@default-talan-https\://nexus.talanlabs.com/content/repositories/releases/.lastUpdated=1668173930381 +https\://dl.bintray.com/macster110/jtorch4pam/.error=Could not transfer artifact pamguard.org\:x3\:jar\:sources\:2.2.0 from/to bintray-macster110-jtorch4pam (https\://dl.bintray.com/macster110/jtorch4pam)\: Remote host terminated the handshake +https\://repo1.maven.org/maven2/.error= +file\:///Users/au671271/git/PAMGuard/repo/.error= +https\://nexus.bedatadriven.com/content/groups/public/.error= +https\://artifacts.unidata.ucar.edu/repository/unidata-all/.error= +https\://artifacts.unidata.ucar.edu/repository/unidata-all/.lastUpdated=1668173930064 +https\://repo1.maven.org/maven2/.lastUpdated=1668173930657 +https\://nexus.talanlabs.com/content/repositories/releases/.error=Could not transfer artifact pamguard.org\:x3\:jar\:sources\:2.2.0 from/to talan (https\://nexus.talanlabs.com/content/repositories/releases/)\: Access denied to https\://nexus.talanlabs.com/content/repositories/releases/pamguard/org/x3/2.2.0/x3-2.2.0-sources.jar. Error code 401, Unauthorized +file\:///Users/au671271/git/PAMGuard/repo/.lastUpdated=1668173929099 +4d1f727a0c17e3b21ef2f6654eed0b3113a4db97@default-bintray-macster110-jtorch4pam-https\://dl.bintray.com/macster110/jtorch4pam/.lastUpdated=1668173929096 +https\://nexus.bedatadriven.com/content/groups/public/.lastUpdated=1668173930217 diff --git a/repo/pamguard/org/x3/2.2.0/x3-2.2.0.jar b/repo/pamguard/org/x3/2.2.0/x3-2.2.0.jar new file mode 100644 index 00000000..2a3edf65 Binary files /dev/null and b/repo/pamguard/org/x3/2.2.0/x3-2.2.0.jar differ diff --git a/repo/pamguard/org/x3/2.2.0/x3-2.2.0.pom b/repo/pamguard/org/x3/2.2.0/x3-2.2.0.pom new file mode 100644 index 00000000..ef90ef10 --- /dev/null +++ b/repo/pamguard/org/x3/2.2.0/x3-2.2.0.pom @@ -0,0 +1,9 @@ + + + 4.0.0 + pamguard.org + x3 + 2.2.0 + POM was created from install:install-file + diff --git a/src/Resources/css/primer-dark.css b/src/Resources/css/primer-dark.css index ca9a4708..82062a73 100644 --- a/src/Resources/css/primer-dark.css +++ b/src/Resources/css/primer-dark.css @@ -1422,6 +1422,7 @@ Text { -color-cell-bg-odd: -color-bg-subtle; -color-cell-border: -color-border-default; -fx-border-color: -color-cell-border; + -fx-control-inner-background: -color-bg-default; -fx-border-width: 1px; -fx-border-radius: 0; -color-header-bg: -color-bg-subtle; @@ -3703,4 +3704,20 @@ Text { #label-title2 { -fx-font: bold 13pt -fx-font-family; + } + +/******************************************************************************* + * * + * Label * + * * + ******************************************************************************/ + + +.validatorfx-error { + -fx-text-fill: rgb(164, 0, 0); +} + +.validatorfx-warning { + -fx-text-fill: rgb(196, 160, 0); +} } diff --git a/src/clickDetector/ClickClassifiers/basicSweep/SweepClassifier.java b/src/clickDetector/ClickClassifiers/basicSweep/SweepClassifier.java index 5b814962..7dbc2840 100644 --- a/src/clickDetector/ClickClassifiers/basicSweep/SweepClassifier.java +++ b/src/clickDetector/ClickClassifiers/basicSweep/SweepClassifier.java @@ -412,7 +412,7 @@ public class SweepClassifier implements ClickIdentifier , PamSettings { } @Override - public ClassifyPaneFX getClassifierPane() { + public SweepClassifierPaneFX getClassifierPane() { if (fxPane==null) fxPane = new SweepClassifierPaneFX(this, clickControl); return fxPane; } diff --git a/src/clickDetector/layoutFX/ClickSettingsPane.java b/src/clickDetector/layoutFX/ClickSettingsPane.java index 197bd958..2263e018 100644 --- a/src/clickDetector/layoutFX/ClickSettingsPane.java +++ b/src/clickDetector/layoutFX/ClickSettingsPane.java @@ -40,6 +40,7 @@ import pamViewFX.fxNodes.PamVBox; import pamViewFX.fxNodes.pamDialogFX.PamDialogFX; import pamViewFX.fxNodes.utilityPanes.FilterPaneFX; import pamViewFX.fxNodes.utilityPanes.GroupedSourcePaneFX; +import pamViewFX.validator.PamValidator; /** * A pane to change click detector settings. @@ -190,7 +191,7 @@ public class ClickSettingsPane extends SettingsPane{ this.clickControl=clickControl; mainPane= new PamBorderPane(); - clickValidator = new Validator(); + clickValidator = new PamValidator(); pamTabbedPane=new PamTabPane(); pamTabbedPane.setAddTabButton(false); diff --git a/src/clickDetector/layoutFX/clickClassifiers/SweepClassifierPaneFX.java b/src/clickDetector/layoutFX/clickClassifiers/SweepClassifierPaneFX.java index e9a0979b..185d4c2a 100644 --- a/src/clickDetector/layoutFX/clickClassifiers/SweepClassifierPaneFX.java +++ b/src/clickDetector/layoutFX/clickClassifiers/SweepClassifierPaneFX.java @@ -39,11 +39,11 @@ public class SweepClassifierPaneFX extends BasicIdentifierPaneFX { public void setClassifierPane(ClickTypeProperty clickTypeProperty){ SweepClassifierSetPaneFX sweepPane=new SweepClassifierSetPaneFX(sweepClickClassifier); - //make it so the title of the pane is the same as the name as the classifier getFlipPane().getAdvLabel().textProperty().unbind(); getFlipPane().getAdvLabel().textProperty().bind( sweepPane.getNameTextProperty()); + //System.out.println("sweepPane.classifierItemRow: " + sweepPane.classifierItemRow); sweepPane.classifierItemRow = sweepClickClassifier.getSweepClassifierParams().getSetRow((SweepClassifierSet) clickTypeProperty.getClickType()); sweepPane.setParams(clickTypeProperty); @@ -62,7 +62,6 @@ public class SweepClassifierPaneFX extends BasicIdentifierPaneFX { public void setParams() { sweepIdParameters = sweepClickClassifier.getSweepClassifierParams().clone(); - //change the table tableDataChanged(); @@ -80,7 +79,6 @@ public class SweepClassifierPaneFX extends BasicIdentifierPaneFX { for (int i=0; i { - + /** * Holds general options for the classifier. */ private OptionsBox optionBox; - + /** * Settings for pre-filtering of click */ @@ -84,7 +91,7 @@ public class SweepClassifierSetPaneFX extends SettingsPane { * Pane to change zero crossings */ private ZeroCrossingsBox zeroCrossingsBox; - + /** * Cloned reference to ClickTypeProperty. */ @@ -99,38 +106,37 @@ public class SweepClassifierSetPaneFX extends SettingsPane { * Changes the amplitude range */ private AmplitudeBlock amplitudeBlock; - + private PamBorderPane mainPane = new PamBorderPane(); - - private Validator validator = new Validator(); + public int classifierItemRow; - + public SweepClassifierSetPaneFX(SweepClassifier sweepClassifier){ super(null); this.sweepClassifier=sweepClassifier; mainPane= new PamBorderPane(); mainPane.setCenter(createSweepPane()); } - + /** * Create pane with controls to change SweepClassiferSet class * @return pane with controls to create a sweep classifier. */ private Node createSweepPane(){ - + PamVBox holder=new PamVBox(); holder.setSpacing(15); holder.setPadding(new Insets(10,0,0,0)); optionBox=new OptionsBox(); - + /*********Waveform Tab************/ Tab waveformTab=new Tab("Waveform"); PamVBox waveformHolder=new PamVBox(5); waveformHolder.setPadding(new Insets(10,0,0,0)); - + clickLength=new ClickLengthBox(); filterBox=new FilterBox(); amplitudeBlock = new AmplitudeBlock(); @@ -138,7 +144,7 @@ public class SweepClassifierSetPaneFX extends SettingsPane { waveformHolder.getChildren().addAll(clickLength, filterBox, amplitudeBlock, zeroCrossingsBox); waveformTab.setContent(waveformHolder); - + /*********Spectrum Tab****************/ Tab spectrumTab=new Tab("Spectrum"); PamVBox spectrumHolder=new PamVBox(5); @@ -150,17 +156,17 @@ public class SweepClassifierSetPaneFX extends SettingsPane { spectrumTab.setContent(spectrumHolder); /**********Main Layout**************/ - + TabPane tabPane= new TabPane(); tabPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); tabPane.getTabs().addAll(waveformTab, spectrumTab); - + holder.getChildren().add(optionBox); holder.getChildren().add(tabPane); - + return holder; } - + /** * Each section in the classifier can be enabled or disabled. * This is a generic abstract class for each pane. @@ -168,26 +174,33 @@ public class SweepClassifierSetPaneFX extends SettingsPane { * */ private abstract class SweepBox extends PamBorderPane { - + + + /** + * Validator to check settings are correct. + */ + private Validator validator = new Validator(); + + /** * Check box to enable pane */ - private PamToggleSwitch enableBox; - + protected PamToggleSwitch enableBox; + /** * Border pane to hold content */ private PamBorderPane borderPane; - - + + private Font disableFont; private Label label; - + SweepBox(String borderTitle, Boolean enableButton) { - //create holder pnae + //create holder pane borderPane=new PamBorderPane(); this.setCenter(borderPane); @@ -231,7 +244,17 @@ public class SweepClassifierSetPaneFX extends SettingsPane { //tP.setCenter( description = new Label("", JLabel.CENTER)); //this.setTop(tP); } - + + + /** + * Get the validator for the sweep box. + * @return + */ + public Validator getValidator() { + return validator; + } + + /** * Set a description for the sweep box. * @param desc - a description of the control @@ -239,11 +262,11 @@ public class SweepClassifierSetPaneFX extends SettingsPane { protected void setDescription(String desc) { label.setTooltip(new Tooltip(desc)); } - -// private void showTopStrip() { -// tP.setVisible(enableBox != null && description.getText().length() > 0); -// } - + + // private void showTopStrip() { + // tP.setVisible(enableBox != null && description.getText().length() > 0); + // } + /** * Set the controls to be anabled or disabled. * @param enabled - true to enable. @@ -253,18 +276,18 @@ public class SweepClassifierSetPaneFX extends SettingsPane { return; } enableBox.setSelected(enabled); - disbleControls(enabled); + disbleControls(!enabled); } - - + + protected boolean getEnableBox() { if (enableBox == null) { return false; } return enableBox.isSelected(); } - - + + /** * Get pane which holds content * @return the border pane. @@ -272,63 +295,63 @@ public class SweepClassifierSetPaneFX extends SettingsPane { public PamBorderPane getHolderPane() { return borderPane; } - + /** * Called whenever a new ClickTypeProperty is selected. Sets pane controls to show ClickTypeProperty params */ protected abstract void setParams(); - + /** * Called whenever a ClickTypeProperty should be generated from controls. * @return a new ClickTypeProperty generated from values set by user in controls. */ protected abstract boolean getParams(); - + /** * Disable all controls within a box. * @param disable - true to disable controls. */ protected abstract void disbleControls(boolean disable); } - - + + /** * General options for the sweep classifier set * @author Jamie Macaulay * */ private class OptionsBox extends SweepBox implements FFTLengthModeled, CodeHost { - + /** * Text field to set classifier name. */ private TextField nameField; - + /** * Pick a colour. */ private ColorPicker symbolColour; - + /** * Choose a symbol for the classifier */ private SymbolPicker symbolPicker; - + /** * Spinner to change the spinner code. */ private PamSpinner codeSpinner; - + /** * Channels box. */ private ComboBox channelsBox; - + /** * Click length spinner. */ private PamSpinner clickLengthSpinner; - + /** * Shows lengths of extraction samples in millis. */ @@ -345,17 +368,17 @@ public class SweepClassifierSetPaneFX extends SettingsPane { OptionsBox() { super("General Options", false); this.getHolderPane().setCenter(createOptionsPane()); - + } - + //create the general options private Node createOptionsPane(){ - + PamGridPane pamGridPane=new PamGridPane(); pamGridPane.setHgap(5); pamGridPane.setVgap(5); -// pamGridPane.setPadding(new Insets(10,5,5,35)); + // pamGridPane.setPadding(new Insets(10,5,5,35)); pamGridPane.add(new Label("Name"), 0, 0); @@ -364,20 +387,20 @@ public class SweepClassifierSetPaneFX extends SettingsPane { pamGridPane.add(nameField, 1, 0); PamGridPane.setColumnSpan(nameField, 8); PamGridPane.setHgrow(nameField, Priority.ALWAYS); - - validator.createCheck() - .dependsOn("speciesname", nameField.textProperty()) - .withMethod(c -> { - String userName = c.get("speciesname"); - if (userName == null || userName.length()<=0) { - c.error("The classifier must have a name"); - } - }) - .decorates(nameField) - .immediate(); - ; - - + + getValidator().createCheck() + .dependsOn("speciesname", nameField.textProperty()) + .withMethod(c -> { + String userName = c.get("speciesname"); + if (userName == null || userName.length()<=0) { + c.error("The classifier must have a name"); + } + }) + .decorates(nameField) + .immediate(); + ; + + pamGridPane.add(new Label("Code"), 0, 1); codeSpinner=new PamSpinner (1, 500, 0, 1); @@ -385,23 +408,23 @@ public class SweepClassifierSetPaneFX extends SettingsPane { //codeSpinner.setPrefWidth(150); codeSpinner.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); pamGridPane.add(codeSpinner, 1, 1); - -// pamGridPane.add(new Label("Symbol"), 0,1); - + + // pamGridPane.add(new Label("Symbol"), 0,1); + //create colour picker to allow users to change symbol colour. symbolPicker=new SymbolPicker(); pamGridPane.add(symbolPicker, 3,1); - + pamGridPane.add(new Label("Symbol"), 2,1); - + lineColourPicker = new ColorPicker(); lineColourPicker.setStyle("-fx-color-label-visible: false ;"); lineColourPicker.setOnAction((action)->{ symbolPicker.setLineColour(lineColourPicker.getValue()); }); pamGridPane.add(lineColourPicker, 4, 1); - - + + fillColourPicker = new ColorPicker(); fillColourPicker.setStyle("-fx-color-label-visible: false ;"); fillColourPicker.setOnAction((action)->{ @@ -410,30 +433,30 @@ public class SweepClassifierSetPaneFX extends SettingsPane { pamGridPane.add(fillColourPicker, 5, 1); -// //create a button to allow users to change symbol shape. -// symbolColour=new ColorPicker(); -// pamGridPane.add(symbolColour, 3, 1); -// symbolColour.setOnAction((action)->{ -// symbolPicker.setFillColour(symbolColour.getValue()); -// }); - + // //create a button to allow users to change symbol shape. + // symbolColour=new ColorPicker(); + // pamGridPane.add(symbolColour, 3, 1); + // symbolColour.setOnAction((action)->{ + // symbolPicker.setFillColour(symbolColour.getValue()); + // }); + //channel options pamGridPane.add(new Label("Channels"), 0,2); - + channelsBox = new ComboBox(); for (int i = 0; i < 3; i++) { channelsBox.getItems().add(SweepClassifierSet.getChannelOptionsName(i)); } pamGridPane.add(channelsBox, 1,2); - + PamGridPane.setColumnSpan(channelsBox,8 ); - + //restrict parameter to click centre PamHBox clickCenterBox=new PamHBox(); clickCenterBox.setSpacing(5); clickCenterBox.getChildren().add(restrictLength = new CheckBox("Trim click")); - + clickLengthSpinner=new PamSpinner(4,102400,128,32); clickLengthSpinner.setEditable(true); //clickLengthSpinner.setPrefWidth(150); @@ -441,7 +464,7 @@ public class SweepClassifierSetPaneFX extends SettingsPane { clickLengthSpinner.valueProperty().addListener((obsVal, oldVal, newVal)->{ setLengthLabel(); }); - + clickCenterBox.getChildren().add(clickLengthSpinner); Label samplesLabel =new Label("samples"); clickCenterBox.getChildren().add(samplesLabel); @@ -450,33 +473,33 @@ public class SweepClassifierSetPaneFX extends SettingsPane { lengthTypeBox.getItems().add("around click center"); lengthTypeBox.getItems().add("from start of click"); clickCenterBox.setAlignment(Pos.CENTER_LEFT); - + restrictLength.setOnAction((action)->{ lengthTypeBox.setDisable(!restrictLength.isSelected()); clickLengthSpinner.setDisable(!restrictLength.isSelected()); samplesLabel.setDisable(!restrictLength.isSelected()); lengthMS.setDisable(!restrictLength.isSelected()); }); - -// //column constraints -// ColumnConstraints col1 = new ColumnConstraints(); -// col1.setPercentWidth(15); -// ColumnConstraints col2 = new ColumnConstraints(); -// col2.setPercentWidth(35); -// ColumnConstraints col3 = new ColumnConstraints(); -// col3.setPercentWidth(15); -// ColumnConstraints col4 = new ColumnConstraints(); -// col4.setPercentWidth(35); -// ColumnConstraints col4 = new ColumnConstraints(); -// col4.setPercentWidth(35); -// -// pamGridPane.getColumnConstraints().addAll(col1, col2, col3,col4); - + + // //column constraints + // ColumnConstraints col1 = new ColumnConstraints(); + // col1.setPercentWidth(15); + // ColumnConstraints col2 = new ColumnConstraints(); + // col2.setPercentWidth(35); + // ColumnConstraints col3 = new ColumnConstraints(); + // col3.setPercentWidth(15); + // ColumnConstraints col4 = new ColumnConstraints(); + // col4.setPercentWidth(35); + // ColumnConstraints col4 = new ColumnConstraints(); + // col4.setPercentWidth(35); + // + // pamGridPane.getColumnConstraints().addAll(col1, col2, col3,col4); + PamVBox holder = new PamVBox(); holder.setSpacing(5); holder.getChildren().addAll(pamGridPane,clickCenterBox); - + return holder; } @@ -501,7 +524,7 @@ public class SweepClassifierSetPaneFX extends SettingsPane { float sr = sweepClassifier.getClickDetector().getSampleRate(); lengthMS.setText(String.format("(%.2f ms)", fftLength * 1000 / sr)); } - + /** * Set the length in seconds. */ @@ -512,7 +535,7 @@ public class SweepClassifierSetPaneFX extends SettingsPane { @Override protected void setParams() { - + if (sweepClassifierSet == null) { //symbolViewer.setSymbol(null); symbolPicker.getSelectionModel().select(0); @@ -528,32 +551,32 @@ public class SweepClassifierSetPaneFX extends SettingsPane { if (sweepClassifierSet == null) { return; } - + lengthTypeBox.getSelectionModel().select(sweepClassifierSet.restrictedBinstype); - + channelsBox.getSelectionModel().select(sweepClassifierSet.channelChoices); restrictLength.setSelected(sweepClassifierSet.restrictLength); setFFTLength(sweepClassifierSet.restrictedBins); - - -// nameField.setText(sweepClassifierSet.getName()); -// codeSpinner.getValueFactory().setValue(sweepClassifierSet.getSpeciesCode()); -// channelsBox.getSelectionModel().select(sweepClassifierSet.channelChoices); -// -// //length stuff -// clickLengthSpinner.getValueFactory().setValue(sweepClassifierSet.restrictedBins); - - + + + // nameField.setText(sweepClassifierSet.getName()); + // codeSpinner.getValueFactory().setValue(sweepClassifierSet.getSpeciesCode()); + // channelsBox.getSelectionModel().select(sweepClassifierSet.channelChoices); + // + // //length stuff + // clickLengthSpinner.getValueFactory().setValue(sweepClassifierSet.restrictedBins); + + } @Override protected boolean getParams() { sweepClassifierSet.setName(nameField.getText()); - + if (this.symbolPicker.getValue()==null) { return showWarning("You must pick a symbol"); } - + SymbolData symbolData = new SymbolData(this.symbolPicker.getValue().getSymbol(), 10,10,true, PamUtilsFX.fxToAWTColor(this.lineColourPicker.getValue()), PamUtilsFX.fxToAWTColor(this.fillColourPicker.getValue())); sweepClassifierSet.symbol= new PamSymbol(symbolData); @@ -561,6 +584,9 @@ public class SweepClassifierSetPaneFX extends SettingsPane { return showWarning("You must enter a name for this type of click"); } sweepClassifierSet.setSpeciesCode(getCode()); + + System.out.println(" sweepClassifierSet: " + sweepClassifierSet + " classifierItemRow: " + + classifierItemRow + "sweepClassifierSet.getSpeciesCode(): " + sweepClassifierSet.getSpeciesCode()); if (sweepClassifier.codeDuplicated(sweepClassifierSet, classifierItemRow) || sweepClassifierSet.getSpeciesCode() <= 0){ return showWarning("You must enter a unique positive integer species code"); @@ -570,9 +596,9 @@ public class SweepClassifierSetPaneFX extends SettingsPane { } sweepClassifierSet.channelChoices = channelsBox.getSelectionModel().getSelectedIndex(); sweepClassifierSet.restrictLength = restrictLength.isSelected(); - + sweepClassifierSet.restrictedBinstype = lengthTypeBox.getSelectionModel().getSelectedIndex(); - + try { sweepClassifierSet.restrictedBins = clickLengthSpinner.getValue(); } @@ -580,10 +606,10 @@ public class SweepClassifierSetPaneFX extends SettingsPane { return showWarning("Invalid Restricted length value"); } return true; -// sweepClassifierSet.setName(nameField.getText()); -// sweepClassifierSet.setSpeciesCode(codeSpinner.getValue()); -// sweepClassifierSet.channelChoices=channelsBox.getSelectionModel().getSelectedIndex(); -// sweepClassifierSet.restrictedBins=clickLengthSpinner.getValue(); + // sweepClassifierSet.setName(nameField.getText()); + // sweepClassifierSet.setSpeciesCode(codeSpinner.getValue()); + // sweepClassifierSet.channelChoices=channelsBox.getSelectionModel().getSelectedIndex(); + // sweepClassifierSet.restrictedBins=clickLengthSpinner.getValue(); } @Override @@ -594,33 +620,33 @@ public class SweepClassifierSetPaneFX extends SettingsPane { public TextField getNameLabel() { return this.nameField; } - + } - + /** * Filter options for the sweep classifier set * @author Jamie Macaulay */ private class FilterBox extends SweepBox implements FFTLengthModeled { - + private SimpleFilterPaneFX simpleFilterPane; FilterBox() { super("Filter Options", true); this.getHolderPane().setCenter(createOptionsPane()); - + } - + //create the general options private Node createOptionsPane(){ - + PamGridPane pamGridPane=new PamGridPane(); pamGridPane.setHgap(5); pamGridPane.setVgap(5); - + simpleFilterPane=new SimpleFilterPaneFX(); - + return simpleFilterPane.getContentNode(); } @@ -634,16 +660,17 @@ public class SweepClassifierSetPaneFX extends SettingsPane { @Override public void setFFTLength(int fftLength) { // TODO Auto-generated method stub - + } @Override protected void setParams() { //set sample rate. + setEnableBox(sweepClassifierSet.enableFFTFilter); simpleFilterPane.setSampleRate(sweepClassifier.getClickDetector().getSampleRate()); if (sweepClassifierSet.fftFilterParams!=null) simpleFilterPane.setParams(sweepClassifierSet.fftFilterParams); - + } @Override @@ -659,21 +686,21 @@ public class SweepClassifierSetPaneFX extends SettingsPane { protected void disbleControls(boolean disable) { simpleFilterPane.setDisableFilterPane(disable); } - + } - + /** * Click length box. * @author Jamie Macaulay * */ private class ClickLengthBox extends SweepBox { - + /** * Spinner for peak smoothing */ PamSpinner smoothing; - + /** * Spinner for minimum click length in milliseconds */ @@ -683,7 +710,7 @@ public class SweepClassifierSetPaneFX extends SettingsPane { * Spinner for maximum click length in milliseconds */ PamSpinner maxLengthms; - + /** * Spinner for smoothing threshold. */ @@ -694,85 +721,117 @@ public class SweepClassifierSetPaneFX extends SettingsPane { super("Click Length", true); this.getHolderPane().setCenter(createClickLengthPane()); } - + private Node createClickLengthPane(){ - -// PamGridPane gridPane=new PamGridPane(); -// gridPane.setHgap(5); -// gridPane.setVgap(5); - + + // PamGridPane gridPane=new PamGridPane(); + // gridPane.setHgap(5); + // gridPane.setVgap(5); + //threshold -// gridPane.add(new Label("Smoothing"),0,0); + // gridPane.add(new Label("Smoothing"),0,0); smoothing=new PamSpinner(3,101,5,2); smoothing.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); //smoothing.setPrefWidth(100); -// gridPane.add(smoothing,1,0); -// gridPane.add(new Label("bins (must be odd)"),2,0); - + // gridPane.add(smoothing,1,0); + // gridPane.add(new Label("bins (must be odd)"),2,0); + //spinner -// gridPane.add(new Label("Threshold"),3,0); + // gridPane.add(new Label("Threshold"),3,0); threshold=new PamSpinner(1., 300., 6.,1.); threshold.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); //threshold.setPrefWidth(100); -// gridPane.add(threshold,4,0); -// gridPane.add(new Label("dB"),5,0); - + // gridPane.add(threshold,4,0); + // gridPane.add(new Label("dB"),5,0); + PamHBox clickLengthHolder1=new PamHBox(); clickLengthHolder1.setSpacing(5); clickLengthHolder1.getChildren().addAll(new Label("Smoothing"), - smoothing, new Label("bins (must be odd)"), new Label("Threshold"), threshold, new Label("dB")); + smoothing, new Label("bins"), new Label("Threshold"), threshold, new Label("dB")); clickLengthHolder1.setAlignment(Pos.CENTER_LEFT); - + //spinner -// gridPane.add(new Label("Click Length"),0,1); - - minLengthms=new PamSpinner(0.00, 1.00, 0.03,0.01); + // gridPane.add(new Label("Click Length"),0,1); + + minLengthms=new PamSpinner(0.00, 100.00, 0.03,0.01); minLengthms.setEditable(true); minLengthms.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); //minLengthms.setPrefWidth(130); - - maxLengthms=new PamSpinner(0.00, 1.00, 0.22,0.01); + + maxLengthms=new PamSpinner(0.00, 100.00, 0.22,0.01); maxLengthms.setEditable(true); maxLengthms.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); //maxLengthms.setPrefWidth(130); - + PamHBox clickLengthHolder2=new PamHBox(); clickLengthHolder2.setSpacing(5); clickLengthHolder2.getChildren().addAll(new Label("Click Length"), minLengthms, new Label("to"), maxLengthms, new Label("ms")); clickLengthHolder2.setAlignment(Pos.CENTER_LEFT); - -// gridPane.add(clickLengthHolder2,1,1); -// PamGridPane.setRowSpan(clickLengthHolder2, 5); -// PamGridPane.setFillWidth(clickLengthHolder2, false); - + // gridPane.add(clickLengthHolder2,1,1); + // PamGridPane.setRowSpan(clickLengthHolder2, 5); + // PamGridPane.setFillWidth(clickLengthHolder2, false); + + PamVBox vboxholder=new PamVBox(); vboxholder.setSpacing(5); vboxholder.getChildren().addAll(clickLengthHolder1, clickLengthHolder2); - + return vboxholder; } @Override protected void setParams() { - smoothing.getValueFactory().setValue(sweepClassifierSet.peakSmoothing); - minLengthms.getValueFactory().setValue(sweepClassifierSet.minLength); - maxLengthms.getValueFactory().setValue(sweepClassifierSet.maxLength); + if (sweepClassifierSet == null) { + return; + } + setEnableBox(sweepClassifierSet.enableLength); + smoothing.getValueFactory().setValue(sweepClassifierSet.lengthSmoothing); threshold.getValueFactory().setValue(sweepClassifierSet.lengthdB); + minLengthms.getValueFactory().setValue( sweepClassifierSet.minLength); + maxLengthms.getValueFactory().setValue(sweepClassifierSet.maxLength); + } @Override protected boolean getParams() { - sweepClassifierSet.peakSmoothing=smoothing.getValue(); - sweepClassifierSet.minLength=minLengthms.getValue(); - sweepClassifierSet.maxLength=maxLengthms.getValue(); - sweepClassifierSet.lengthdB=threshold.getValue(); + sweepClassifierSet.enableLength = getEnableBox(); + try { + sweepClassifierSet.lengthSmoothing = smoothing.getValue(); + sweepClassifierSet.lengthdB = threshold.getValue(); + } + catch (NumberFormatException e) { + return showWarning("Click Length Parameters", + "The length smoothing or threshold parameter is invalid"); + } + if (sweepClassifierSet.lengthSmoothing%2 == 0 || sweepClassifierSet.lengthSmoothing <= 0) { + return showWarning("The number of length smoothing bins must be odd and positive"); + } + if (sweepClassifierSet.lengthdB == 0) { + return showWarning("The length threshold cannot be zero dB"); + } + if (!sweepClassifierSet.enableLength) { + return true; + } + try { + sweepClassifierSet.minLength = minLengthms.getValue(); + sweepClassifierSet.maxLength = maxLengthms.getValue(); + } + catch (NumberFormatException e) { + return showWarning("Click Length Parameters", + "One or more click length parameters is invalid"); + } + if (sweepClassifierSet.maxLength <= sweepClassifierSet.minLength) { + return showWarning("Click Length Parameters", + "The maximum click length must be greater than the minimum"); + } return true; } + @Override protected void disbleControls(boolean disable) { smoothing.setDisable(disable); @@ -780,55 +839,47 @@ public class SweepClassifierSetPaneFX extends SettingsPane { maxLengthms.setDisable(disable); threshold.setDisable(disable); } - + } - + /** * Filter options for the sweep classifier set * @author Jamie Macaulay */ private class EnergyBandBox extends SweepBox { - + /** * Frequency pane for test band */ private FreqBandPane testBandFreqPane; - + /** * Frequency pane for the first control band. */ - private FreqBandPane contralBandFreqPane1; - - /** - * Frequency pane for the second control band. - */ - private FreqBandPane contralBandFreqPane2; - + private ArrayList contralBandFreqPanes; + + /** * Spinner for the first control band */ - PamSpinner thresholdSpinner1; + private ArrayList> thresholdSpinners; - /** - * Spinner for the second control band - */ - PamSpinner thresholdSpinner2; EnergyBandBox() { super("Energy Band", true); this.getHolderPane().setCenter(createOptionsPane()); - + } - + //create the general options private Node createOptionsPane(){ - + PamGridPane pamGridPane=new PamGridPane(); pamGridPane.setHgap(5); pamGridPane.setVgap(5); - + Label freqLabel=new Label("Frequency (Hz)"); pamGridPane.add(freqLabel, 0, 0); pamGridPane.add(new Label("Threshold (dB)"), 2, 0); @@ -841,57 +892,142 @@ public class SweepClassifierSetPaneFX extends SettingsPane { testBandFreqPane=new FreqBandPane(Orientation.HORIZONTAL); testBandFreqPane.setBandText(""); pamGridPane.add(testBandFreqPane, 1, 1); - - //control band 1 - pamGridPane.add(new Label("Control Band"), 0, 2); - contralBandFreqPane1=new FreqBandPane(Orientation.HORIZONTAL); - contralBandFreqPane1.setBandText(""); - pamGridPane.add(contralBandFreqPane1, 1, 2); - thresholdSpinner1=new PamSpinner(0,100.,6.,0); - thresholdSpinner1.setEditable(true); - pamGridPane.add(thresholdSpinner1, 2, 2); - thresholdSpinner1.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); - thresholdSpinner1.setPrefWidth(100); - //control band 2 - pamGridPane.add(new Label("Control Band"), 0, 3); - contralBandFreqPane2=new FreqBandPane(Orientation.HORIZONTAL); - contralBandFreqPane2.setBandText(""); - pamGridPane.add(contralBandFreqPane2, 1, 3); - thresholdSpinner2=new PamSpinner(0,100.,6.,0); - thresholdSpinner2.setEditable(true); - thresholdSpinner2.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); - pamGridPane.add(thresholdSpinner2, 2, 3); - thresholdSpinner2.setPrefWidth(100); - + + contralBandFreqPanes = new ArrayList(); + thresholdSpinners = new ArrayList>(); + + for (int i=0; i(0,100.,6.,0)); + thresholdSpinners.get(i).setEditable(true); + pamGridPane.add(thresholdSpinners.get(i), 2, i+2); + thresholdSpinners.get(i).getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); + thresholdSpinners.get(i).setMaxWidth(100); + + //add validation. + + final int ii=i; + getValidator().createCheck() + .dependsOn("minfreq_controlband_"+ii, contralBandFreqPanes.get(i).getLowPassFreq().valueProperty()) + .withMethod(c -> { + Double minfreq = c.get("minfreq_controlband_"+ii); + if (minfreq>=contralBandFreqPanes.get(ii).getHighPassFreq().getValue() && isPaneShowing()) { + c.error("Minimum control band frequency in control band " + ii + "must be lower than the maximum frequency "); + } + }) + .decorates(contralBandFreqPanes.get(i).getLowPassFreq()) + .immediate(); + + getValidator().createCheck() + .dependsOn("controlband_"+ii, contralBandFreqPanes.get(i).getHighPassFreq().valueProperty()) + .withMethod(c -> { + Double maxFreq = c.get("controlband_"+ii); + if (maxFreq { private PamToggleSwitch peakFreqCheckBox; private PamToggleSwitch peakWidthCheckBox; private PamToggleSwitch meanFreqCheckBox; - - + + /** * Pane to set frequency band range */ private FreqBandPane peakFreqPane; @@ -917,46 +1053,46 @@ public class SweepClassifierSetPaneFX extends SettingsPane { super("Peak and Mean Frequency", true); this.getHolderPane().setCenter(createFreqSearchPane()); } - + private Node createFreqSearchPane(){ - + PamGridPane pamGridPane=new PamGridPane(); pamGridPane.setHgap(5); pamGridPane.setVgap(5); - - + + //search and integration range pamGridPane.add(new Label("Search Range"),1,0); searchRange=new FreqBandPane(Orientation.HORIZONTAL); searchRange.setBandText(""); pamGridPane.add(searchRange,2,0); - + pamGridPane.add(new Label("Smoothing"), 3,0); - + smoothing=new PamSpinner(3,101,5,2); smoothing.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); smoothing.setPrefWidth(100); pamGridPane.add(smoothing, 4,0); - + pamGridPane.add(new Label("bins"), 5,0); - + //peak frequency peakFreqCheckBox=new PamToggleSwitch(""); peakFreqCheckBox.selectedProperty().addListener((obsVal, oldVal, newVal)->{ peakFreqPane.setDisableFreqPane(!peakWidthCheckBox.isSelected()); }); - + pamGridPane.add(peakFreqCheckBox,0,1); - + pamGridPane.add(new Label("Peak Frequency"),1,1); peakFreqPane=new FreqBandPane(Orientation.HORIZONTAL); peakFreqPane.setBandText(""); pamGridPane.add(peakFreqPane,2,1); - - + + //peak width peakWidthCheckBox=new PamToggleSwitch(""); peakWidthCheckBox.selectedProperty().addListener((obsVal, oldVal, newVal)->{ @@ -964,32 +1100,32 @@ public class SweepClassifierSetPaneFX extends SettingsPane { peakWidthPane.setDisableFreqPane(!peakWidthCheckBox.isSelected()); threshold.setDisable(!peakWidthCheckBox.isSelected()); }); - + pamGridPane.add(peakWidthCheckBox,0,2); - + pamGridPane.add(new Label("Peak Width"),1,2); peakWidthPane=new FreqBandPane(Orientation.HORIZONTAL); peakWidthPane.setBandText(""); pamGridPane.add(peakWidthPane,2,2); - + pamGridPane.add(new Label("Threshold"), 3,2); - + threshold=new PamSpinner(1., 300., 6.,1.); threshold.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); threshold.setPrefWidth(100); - + pamGridPane.add(threshold,4,2); - + pamGridPane.add(new Label("dB"), 5,2); - + //mean frequency meanFreqCheckBox=new PamToggleSwitch(""); meanFreqCheckBox.selectedProperty().addListener((obsVal, oldVal, newVal)->{ meanFreq.setDisableFreqPane(!peakWidthCheckBox.isSelected()); }); - + pamGridPane.add(meanFreqCheckBox,0,3); pamGridPane.add(new Label("Mean Frequency"),1,3); @@ -997,15 +1133,15 @@ public class SweepClassifierSetPaneFX extends SettingsPane { meanFreq=new FreqBandPane(Orientation.HORIZONTAL); meanFreq.setBandText(""); pamGridPane.add(meanFreq,2,3); - + return pamGridPane; - + } @Override protected void setParams() { // TODO Auto-generated method stub - + } @Override @@ -1017,12 +1153,12 @@ public class SweepClassifierSetPaneFX extends SettingsPane { @Override protected void disbleControls(boolean enable) { // TODO Auto-generated method stub - + } - + } - - + + /** * Block to specify peak frequency to search for. * @author Jamie Macaulay @@ -1034,7 +1170,7 @@ public class SweepClassifierSetPaneFX extends SettingsPane { * Spinner for the minimum number of zero crossings */ private PamSpinner zeroCorssingsMin; - + /** * Spinner for the maximum number of zero crossings */ @@ -1054,65 +1190,191 @@ public class SweepClassifierSetPaneFX extends SettingsPane { super("Zero Crossings", true); this.getHolderPane().setCenter(createZeroCrossPane()); } - + private Node createZeroCrossPane(){ - + PamGridPane pamGridPane=new PamGridPane(); pamGridPane.setHgap(5); pamGridPane.setVgap(5); - + //Number of zeros crossings - pamGridPane.add(new Label("Number of zero corssings"),0,0); - + Label zeroLabel; + pamGridPane.add(zeroLabel = new Label("Number of zero crossings"),0,0); + zeroCorssingsMin=new PamSpinner(0,999999,0,1); zeroCorssingsMin.setEditable(true); zeroCorssingsMin.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); zeroCorssingsMin.setPrefWidth(100); pamGridPane.add(zeroCorssingsMin, 1,0); - + pamGridPane.add(new Label("to"),2,0); - - zeroCorssingsMax=new PamSpinner(0,999999,0,1); + + final PamSpinner zeroCorssingsMax=new PamSpinner(0,999999,0,1); zeroCorssingsMax.setEditable(true); zeroCorssingsMax.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); zeroCorssingsMax.setPrefWidth(100); pamGridPane.add(zeroCorssingsMax, 3,0); - + + this.zeroCorssingsMax=zeroCorssingsMax; + + + + getValidator().createCheck() + .dependsOn("minzero", zeroCorssingsMin.valueProperty()) + .withMethod(c -> { + Integer minZero = c.get("minzero"); + if (minZero>=zeroCorssingsMax.getValue() && isPaneShowing()) { + c.error("Minimum zero corssing must be less than the maximum zero crossing"); + } + }) + .decorates(zeroCorssingsMin) + .immediate(); + + zeroCorssingsMin.valueProperty().addListener((obsVal, oldval, newVal)->{ + getValidator().validate(); //need to make sure the min undecorates if this changes + }); + + + getValidator().createCheck() + .dependsOn("maxzero", zeroCorssingsMax.valueProperty()) + .withMethod(c -> { + try { + Integer maxZero = c.get("maxzero"); + if (maxZero<=zeroCorssingsMin.getValue() && isPaneShowing()) { //For some reason the validator does not work with flip panes. + c.error("Maxmimum zero crossing must be greater than the minimum zero crossing"); + } + } + catch (Exception e) { + e.printStackTrace(); + } + }) + .decorates(zeroCorssingsMax) + .immediate(); + + GraphicDecoration.updateDecorations(zeroCorssingsMax); + // + // zeroCorssingsMax.valueProperty().addListener((obsVal, oldval, newVal)->{ + // getValidator().validate(); //need to make sure the min undecorates if this changes + // }); + + //zero crossing freuquency sweep - + pamGridPane.add(new Label("Zero crossing frequency sweep"),0,1); - + freqZeroMin=new PamSpinner(0.,999999.,0.,1.); freqZeroMin.setEditable(true); freqZeroMin.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); freqZeroMin.setPrefWidth(100); pamGridPane.add(freqZeroMin, 1,1); - + + + + zeroCorssingsMax.valueProperty().addListener((obsVal, oldval, newVal)->{ + getValidator().validate(); //need to make sure the min undecorates if this changes + }); + + pamGridPane.add(new Label("to"),2,1); - + freqZeroMax=new PamSpinner(0.,999999.,0,1); freqZeroMax.setEditable(true); freqZeroMax.getStyleClass().add(Spinner.STYLE_CLASS_SPLIT_ARROWS_HORIZONTAL); freqZeroMax.setPrefWidth(100); pamGridPane.add(freqZeroMax, 3,1); - + + getValidator().createCheck() + .dependsOn("minzerofreq", freqZeroMin.valueProperty()) + .withMethod(c -> { + Double minFreq = c.get("minzerofreq"); + if (minFreq>=freqZeroMax.getValue() && isPaneShowing()) { + c.error("Minimum frequency must be less than the maximum frequency"); + } + }) + .decorates(freqZeroMin) + .immediate(); + + + freqZeroMin.valueProperty().addListener((obsVal, oldval, newVal)->{ + getValidator().validate(); //need to make sure the min undecorates if this changes + }); + + + getValidator().createCheck() + .dependsOn("maxzerofreq", freqZeroMax.valueProperty()) + .withMethod(c -> { + Double maxZero = c.get("maxzerofreq"); + if (maxZero<=freqZeroMin.getValue() && isPaneShowing()) { + c.error("Maxmimum frequency must be greater than the minimum frequency"); + } + }) + .decorates(freqZeroMax) + .immediate(); + + + freqZeroMax.valueProperty().addListener((obsVal, oldval, newVal)->{ + getValidator().validate(); //need to make sure the min undecorates if this changes + }); + + pamGridPane.add(new Label("KHz/ms"),4,1); - + return pamGridPane; - + } @Override protected void setParams() { - // TODO Auto-generated method stub - + setEnableBox(sweepClassifierSet.enableZeroCrossings); + + sweepClassifierSet.checkZCAllocation(); + // setEnableBox(sweepClassifierSet.enableZeroCrossings); + //enableSweep.setSelected(sweepClassifierSet.enableSweep); + + zeroCorssingsMin.getValueFactory().setValue(sweepClassifierSet.nCrossings[0]); + zeroCorssingsMax.getValueFactory().setValue(sweepClassifierSet.nCrossings[1]); + + freqZeroMin.getValueFactory().setValue(sweepClassifierSet.zcSweep[0]); + freqZeroMax.getValueFactory().setValue(sweepClassifierSet.zcSweep[1]); + + getValidator().validate(); //need to make sure the min undecorates if this changes + + // for (int i = 0; i < 2; i++) { + // nZC[i].setText(String.format("%d", sweepClassifierSet.nCrossings[i])); + // zcRate[i].setText(String.format("%3.1f", sweepClassifierSet.zcSweep[i])); + // } + } @Override protected boolean getParams() { - // TODO Auto-generated method stub - return false; + + if (this.getValidator().containsErrors()) { + showValidatorWarning(getValidator()); + return false; + } + + if ((sweepClassifierSet.enableZeroCrossings = enableBox.isSelected()) == true) { + sweepClassifierSet.checkZCAllocation(); + + sweepClassifierSet.nCrossings = new int[2]; + sweepClassifierSet.nCrossings[0] = zeroCorssingsMin.getValue(); + sweepClassifierSet.nCrossings[1] = zeroCorssingsMax.getValue(); + + //return showWarning("Zero Crossings", "Invalid number of zero crossings"); + + } + if ((sweepClassifierSet.enableSweep = enableBox.isSelected()) == true) { + + sweepClassifierSet.zcSweep = new double[2]; + sweepClassifierSet.zcSweep[0] = freqZeroMin.getValue(); + sweepClassifierSet.zcSweep[1] = freqZeroMax.getValue(); + + //return showWarning("Zero Crossings", "Invalid zero crossing sweep parameter"); + } + + return true; } @Override @@ -1122,31 +1384,33 @@ public class SweepClassifierSetPaneFX extends SettingsPane { freqZeroMin.setDisable(disable); freqZeroMax.setDisable(disable); } - + } - + /** * Controls to change the minimum and maximum amplitude range for the classifier. * @author Jamie Macaulay * */ private class AmplitudeBlock extends SweepBox { + + private TextField[] ampRange = new TextField[2]; - + public AmplitudeBlock() { super("Amplitude Range", true); setDescription("Set a minimum and maximum click amplitude for this type"); - + PamGridPane gridPane= new PamGridPane(); gridPane.setHgap(5); gridPane.setVgap(5); - + gridPane.add(new Label("Minimum"), 0, 0); gridPane.add(ampRange[0] = new TextField(), 1, 0); gridPane.add(new Label("Maximum"), 2, 0); gridPane.add(ampRange[1] = new TextField(), 3, 0); gridPane.add(new Label("dB"), 4,0); - + this.getHolderPane().setCenter(gridPane); } @@ -1162,10 +1426,18 @@ public class SweepClassifierSetPaneFX extends SettingsPane { for (int i = 0; i < 2; i++) { ampRange[i].setText(String.format("%3.1f", range[i])); } + + getValidator().validate(); //need to make sure the min undecorates if this change } @Override protected boolean getParams() { + + if (this.getValidator().containsErrors()) { + showValidatorWarning(getValidator()); + return false; + } + sweepClassifierSet.testAmplitude = getEnableBox(); if (getEnableBox()) { sweepClassifierSet.amplitudeRange = new double[2]; @@ -1184,17 +1456,17 @@ public class SweepClassifierSetPaneFX extends SettingsPane { @Override protected void disbleControls(boolean disable) { for (int i = 0; i < 2; i++) { - ampRange[i].setDisable(getEnableBox()); + ampRange[i].setDisable(!getEnableBox()); } - + } } /**~*main set and get params functions***/ - + @Override public ClickTypeProperty getParams(ClickTypeProperty clickTypeProperty) { - + //set the classifier optionBox.getParams(); clickLength.getParams(); @@ -1205,16 +1477,16 @@ public class SweepClassifierSetPaneFX extends SettingsPane { amplitudeBlock.getParams(); currentClickProperty.setClickType(sweepClassifierSet); - + return currentClickProperty; } @Override public void setParams(ClickTypeProperty clickTypeProperty) { - + this.sweepClassifierSet=(SweepClassifierSet) clickTypeProperty.getClickType(); this.currentClickProperty=clickTypeProperty; - + optionBox.setParams(); clickLength.setParams(); filterBox.setParams(); @@ -1222,7 +1494,7 @@ public class SweepClassifierSetPaneFX extends SettingsPane { freqBox.setParams(); zeroCrossingsBox.setParams(); amplitudeBlock.setParams(); - + } @Override @@ -1238,18 +1510,48 @@ public class SweepClassifierSetPaneFX extends SettingsPane { @Override public void paneInitialized() { // TODO Auto-generated method stub - + } public StringProperty getNameTextProperty() { return optionBox.getNameLabel().textProperty(); } - + private boolean showWarning(String string) { PamDialogFX.showWarning(string); return false; } + + private boolean showWarning(String string, String string2) { + //PamController.getInstance(); + PamDialogFX.showWarning(null, string, string2); + return false; + } + + + /** + * Show a warning from the validator. + * @param validator - the validator to show warning for. + */ + private void showValidatorWarning(Validator validator) { + List validatorMessages = validator.getValidationResult().getMessages(); + + String messages = ""; + for (int i=0; i lowPassFreq; + private PamSpinner lowPassFreq; /** * Layout of the pane- either horizontal or vertical diff --git a/src/pamViewFX/fxNodes/utilityPanes/GroupedSourcePaneFX.java b/src/pamViewFX/fxNodes/utilityPanes/GroupedSourcePaneFX.java index c8a3ebbe..c2fe9295 100644 --- a/src/pamViewFX/fxNodes/utilityPanes/GroupedSourcePaneFX.java +++ b/src/pamViewFX/fxNodes/utilityPanes/GroupedSourcePaneFX.java @@ -17,6 +17,7 @@ import pamViewFX.PamGuiManagerFX; import pamViewFX.fxNodes.PamGridPane; import pamViewFX.fxNodes.PamHBox; import pamViewFX.fxNodes.PamVBox; +import pamViewFX.validator.PamValidator; import PamUtils.PamUtils; import PamView.GroupedSourceParameters; import PamguardMVC.PamConstants; @@ -76,7 +77,7 @@ public class GroupedSourcePaneFX extends SourcePaneFX { @Override protected void createPanel() { - channelValidator = new Validator(); + channelValidator = new PamValidator(); sourcePane=new PamGridPane(); sourcePane.setVgap(5); diff --git a/src/pamViewFX/validator/PamValidator.java b/src/pamViewFX/validator/PamValidator.java new file mode 100644 index 00000000..54d4b3c6 --- /dev/null +++ b/src/pamViewFX/validator/PamValidator.java @@ -0,0 +1,17 @@ +package pamViewFX.validator; + +import net.synedra.validatorfx.Validator; + +/** + * Extension of the validator class to add PAMGuard specific functions. + * @author Jamie Macaulay + * + */ +public class PamValidator extends Validator { + + public PamValidator() { + super(); + // TODO Auto-generated constructor stub + } + +}