Tidy up click selector

Improve layout and tips on dialog and improve logic for manual and
automatic event types.
This commit is contained in:
Douglas Gillespie 2024-03-27 11:05:36 +00:00
parent 52d8697844
commit 3b69341472
7 changed files with 69 additions and 14 deletions

View File

@ -4,7 +4,7 @@
<groupId>org.pamguard</groupId> <groupId>org.pamguard</groupId>
<artifactId>Pamguard</artifactId> <artifactId>Pamguard</artifactId>
<name>Pamguard Java12+</name> <name>Pamguard Java12+</name>
<version>2.02.10ad</version> <version>2.02.10bb</version>
<description>Pamguard for Java 12+, using Maven to control dependcies</description> <description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url> <url>www.pamguard.org</url>
<organization> <organization>

View File

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>org.pamguard</groupId> <groupId>org.pamguard</groupId>
<artifactId>Pamguard</artifactId> <artifactId>Pamguard</artifactId>
<version>2.02.10ba</version> <version>2.02.10bb</version>
<name>Pamguard Java12+</name> <name>Pamguard Java12+</name>
<description>Pamguard for Java 12+, using Maven to control dependcies</description> <description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url> <url>www.pamguard.org</url>

View File

@ -31,7 +31,7 @@ public class PamguardVersionInfo {
* Version number, major version.minorversion.sub-release. * Version number, major version.minorversion.sub-release.
* Note: can't go higher than sub-release 'f' * Note: can't go higher than sub-release 'f'
*/ */
static public final String version = "2.02.10ba"; static public final String version = "2.02.10bb";
/** /**
* Release date * Release date

View File

@ -0,0 +1,27 @@
package PamView.panel;
import java.awt.Component;
import java.awt.FontMetrics;
import java.awt.Graphics;
import javax.swing.border.TitledBorder;
public class SeparatorBorder extends TitledBorder {
private static final long serialVersionUID = 1L;
public SeparatorBorder(String title) {
super(title);
// TODO Auto-generated constructor stub
}
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
FontMetrics fm = g.getFontMetrics();
if (fm != null) {
height = fm.getHeight()-EDGE_SPACING*2-1;
}
else {
height = 12;
}
super.paintBorder(c, g, x, y, width, height);
}
}

View File

@ -112,14 +112,23 @@ public class ClickDataSelector extends DataSelector {
// see if there is a super detection and see if it's got a comment. // see if there is a super detection and see if it's got a comment.
String comment = oev.getComment(); String comment = oev.getComment();
boolean isAutomatic = false;
if (comment != null) { if (comment != null) {
if (clickAlarmParameters.onlineAutoEvents && comment.startsWith("Automatic")) { isAutomatic = comment.startsWith("Automatic");
}
if (isAutomatic && clickAlarmParameters.onlineAutoEvents) {
return true; return true;
} }
if (clickAlarmParameters.onlineManualEvents && comment.startsWith("Manual")) { else if (clickAlarmParameters.onlineManualEvents) {
return true; return true;
} }
} // if (clickAlarmParameters.onlineAutoEvents && comment.startsWith("Automatic")) {
// return true;
// }
// if (clickAlarmParameters.onlineManualEvents && comment.startsWith("Manual")) {
// return true;
// }
/* /*
* Otherwise need to work out where the hell the event type is in the * Otherwise need to work out where the hell the event type is in the
* list of event types and see if it's wanted. * list of event types and see if it's wanted.

View File

@ -30,6 +30,8 @@ import PamView.dialog.PamDialog;
import PamView.dialog.PamDialogPanel; import PamView.dialog.PamDialogPanel;
import PamView.dialog.PamGridBagContraints; import PamView.dialog.PamGridBagContraints;
import PamView.panel.PamAlignmentPanel; import PamView.panel.PamAlignmentPanel;
import PamView.panel.SeparatorBorder;
import PamView.panel.WestAlignedPanel;
public class ClickSelectPanel implements PamDialogPanel { public class ClickSelectPanel implements PamDialogPanel {
@ -41,6 +43,8 @@ public class ClickSelectPanel implements PamDialogPanel {
private JPanel mainPanel; private JPanel mainPanel;
private boolean isViewer; private boolean isViewer;
public static final String mainTip = "You should select options in both the Click Type and the Event Type panels";
public ClickSelectPanel(ClickDataSelector clickDataSelector, boolean allowScores, boolean useEventTypes) { public ClickSelectPanel(ClickDataSelector clickDataSelector, boolean allowScores, boolean useEventTypes) {
this.clickDataSelector = clickDataSelector; this.clickDataSelector = clickDataSelector;
this.allowScores = allowScores; this.allowScores = allowScores;
@ -79,7 +83,9 @@ public class ClickSelectPanel implements PamDialogPanel {
private LookupList lutList; private LookupList lutList;
public EventTypePanel() { public EventTypePanel() {
setBorder(new TitledBorder("Event Type Selection")); setBorder(new SeparatorBorder("Event Type Selection"));
setToolTipText(mainTip);
} }
void setParams() { void setParams() {
@ -102,16 +108,24 @@ public class ClickSelectPanel implements PamDialogPanel {
boxPanel.add(onlineAuto = new JCheckBox("Automatically detected click trains"), c); boxPanel.add(onlineAuto = new JCheckBox("Automatically detected click trains"), c);
onlineAuto.setSelected(clickAlarmParameters.onlineAutoEvents); onlineAuto.setSelected(clickAlarmParameters.onlineAutoEvents);
useUnassigned.setToolTipText("Clicks that are NOT part of a manual or automatic click train");
onlineManual.setToolTipText("Clicks that are part of a manually marked click train");
onlineAuto.setToolTipText("Clicks that are part of an automatically detected click train");
lutList = LookUpTables.getLookUpTables().getLookupList(ClicksOffline.ClickTypeLookupName); lutList = LookUpTables.getLookUpTables().getLookupList(ClicksOffline.ClickTypeLookupName);
if (lutList == null) { if (lutList == null) {
return; return;
} }
c.gridy++;
boxPanel.add(new JLabel("OR the following click train types ...", JLabel.LEFT), c);
useType = new JCheckBox[lutList.getList().size()]; useType = new JCheckBox[lutList.getList().size()];
for (int i = 0; i < useType.length; i++) { for (int i = 0; i < useType.length; i++) {
c.gridy++; c.gridy++;
boxPanel.add(useType[i] = new JCheckBox(lutList.getList().get(i).getText()), c); boxPanel.add(useType[i] = new JCheckBox(lutList.getList().get(i).getText()), c);
useType[i].setSelected(clickAlarmParameters.isUseEventType(lutList.getList().get(i).getCode())); useType[i].setSelected(clickAlarmParameters.isUseEventType(lutList.getList().get(i).getCode()));
String tip = String.format("Clicks that are part of a click train labelled as %s", lutList.getList().get(i).getText());
useType[i].setToolTipText(tip);
} }
} }
@ -158,10 +172,9 @@ public class ClickSelectPanel implements PamDialogPanel {
northPanel = new JPanel(); northPanel = new JPanel();
northPanel.setLayout(new GridBagLayout()); northPanel.setLayout(new GridBagLayout());
GridBagConstraints c = new PamGridBagContraints(); GridBagConstraints c = new PamGridBagContraints();
northPanel.setBorder(new TitledBorder("Echoes"));
c.gridwidth = 3; c.gridwidth = 3;
c.anchor = GridBagConstraints.WEST; c.anchor = GridBagConstraints.WEST;
northPanel.add(useEchoes = new JCheckBox("Use Echoes"), c); northPanel.add(new PamAlignmentPanel(useEchoes = new JCheckBox("Use Echoes"), BorderLayout.WEST), c);
c.gridwidth = 1; c.gridwidth = 1;
c.gridy++; c.gridy++;
c.gridx = 0; c.gridx = 0;
@ -178,11 +191,13 @@ public class ClickSelectPanel implements PamDialogPanel {
northPanel.add(scoreByAmplitude = new JCheckBox("Score by amplitude"), c); northPanel.add(scoreByAmplitude = new JCheckBox("Score by amplitude"), c);
scoreByAmplitude.setVisible(allowScores); scoreByAmplitude.setVisible(allowScores);
scoreByAmplitude.addActionListener(new AllSpeciesListener()); scoreByAmplitude.addActionListener(new AllSpeciesListener());
add(BorderLayout.NORTH, northPanel); WestAlignedPanel walpn;
add(BorderLayout.NORTH, walpn = new WestAlignedPanel(northPanel));
walpn.setBorder(new SeparatorBorder("Echoes"));
JPanel centralOuterPanel = new JPanel(new BorderLayout()); JPanel centralOuterPanel = new JPanel(new BorderLayout());
centralPanel.setLayout(new GridBagLayout()); centralPanel.setLayout(new GridBagLayout());
centralOuterPanel.setBorder(new TitledBorder("Click Type Selection")); centralOuterPanel.setBorder(new SeparatorBorder("Click Type Selection"));
add(BorderLayout.CENTER, centralOuterPanel); add(BorderLayout.CENTER, centralOuterPanel);
JScrollPane scrollPane = new DialogScrollPane(new PamAlignmentPanel(centralPanel, BorderLayout.WEST), 10); JScrollPane scrollPane = new DialogScrollPane(new PamAlignmentPanel(centralPanel, BorderLayout.WEST), 10);
@ -197,6 +212,9 @@ public class ClickSelectPanel implements PamDialogPanel {
clearAll.addActionListener(new AutoSelect(false)); clearAll.addActionListener(new AutoSelect(false));
centralOuterPanel.add(BorderLayout.SOUTH, new PamAlignmentPanel(centralEastPanel, BorderLayout.WEST)); centralOuterPanel.add(BorderLayout.SOUTH, new PamAlignmentPanel(centralEastPanel, BorderLayout.WEST));
centralOuterPanel.setToolTipText(mainTip);
setToolTipText(mainTip);
} }
void setParams() { void setParams() {

View File

@ -127,6 +127,7 @@ public class DatablockDetectionsPanel extends TethysGUIPanel implements StreamTa
this.dataBlock = dataBlock; this.dataBlock = dataBlock;
if (dataBlock == null) { if (dataBlock == null) {
dataBlockName.setText("Select data in panel on the left"); dataBlockName.setText("Select data in panel on the left");
return;
} }
else { else {
dataBlockName.setText(dataBlock.getLongDataName()); dataBlockName.setText(dataBlock.getLongDataName());