mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2025-02-16 17:22:46 +00:00
Better GoTo options for click events and groupdetections
In tables, can now scroll to 10 or 60s before the marked event, which is often more useful than scrolling to the exact start of those events.
This commit is contained in:
parent
1739bd66b2
commit
b916209f4f
@ -451,7 +451,7 @@ final public class PamModel implements PamModelInterface, PamSettings {
|
||||
mi = PamModuleInfo.registerControlledUnit(EffortControl.class.getName(), EffortControl.unitType);
|
||||
mi.setToolTipText("Record observer monitoring effort");
|
||||
mi.setModulesMenuGroup(utilitiesGroup);
|
||||
mi.setHidden(SMRUEnable.isEnable() == false);
|
||||
// mi.setHidden(SMRUEnable.isEnable() == false);
|
||||
mi.setToolTipText("Enables an observer to enter their name and infomation about which displays are being monitored");
|
||||
mi.setMaxNumber(1);
|
||||
|
||||
|
@ -3660,15 +3660,15 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett
|
||||
/**
|
||||
* Scroll the display to a specific event.
|
||||
* @param event event to scroll to
|
||||
* @param beforeTime seconds before the event to scroll to.
|
||||
*/
|
||||
public void gotoEvent(OfflineEventDataUnit event) {
|
||||
long evStart = event.getTimeMilliseconds();
|
||||
public void gotoEvent(OfflineEventDataUnit event, int beforeTime) {
|
||||
long evStart = event.getTimeMilliseconds() - beforeTime*1000;
|
||||
if (evStart < hScrollBar.getMinimumMillis() || evStart > hScrollBar.getMaximumMillis()) {
|
||||
long range = hScrollBar.getMaximumMillis() - hScrollBar.getMinimumMillis();
|
||||
hScrollBar.setRangeMillis(evStart, evStart + range, true);
|
||||
}
|
||||
hScrollBar.setValueMillis(evStart);
|
||||
|
||||
}
|
||||
|
||||
int playbackStatus = PlaybackProgressMonitor.PLAY_END;
|
||||
|
@ -1015,9 +1015,10 @@ public class ClickControl extends PamControlledUnit implements PamSettings {
|
||||
/**
|
||||
* Scrolls the display to a specific event.
|
||||
* @param event event to scroll to
|
||||
* @param beforeTime
|
||||
*/
|
||||
public void gotoEvent(OfflineEventDataUnit event) {
|
||||
tabPanelControl.clickDisplayManager.gotoEvent(event);
|
||||
public void gotoEvent(OfflineEventDataUnit event, int beforeTime) {
|
||||
tabPanelControl.clickDisplayManager.gotoEvent(event, beforeTime);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -463,11 +463,12 @@ public class ClickDisplayManager implements PamSettings {
|
||||
/**
|
||||
* Scroll the time displays to a specific event.
|
||||
* @param event
|
||||
* @param beforeTime
|
||||
*/
|
||||
public void gotoEvent(OfflineEventDataUnit event) {
|
||||
public void gotoEvent(OfflineEventDataUnit event, int beforeTime) {
|
||||
for (int i = 0; i < windowList.size(); i++) {
|
||||
if (windowList.get(i).getClass() == ClickBTDisplay.class) {
|
||||
((ClickBTDisplay)windowList.get(i)).gotoEvent(event);
|
||||
((ClickBTDisplay)windowList.get(i)).gotoEvent(event, beforeTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,9 +175,19 @@ public class EventListDialog extends PamDialog {
|
||||
JPopupMenu menu = new JPopupMenu();
|
||||
JMenuItem menuItem;
|
||||
int evNo = event.getDatabaseIndex();
|
||||
menuItem = new JMenuItem(String.format("Goto event %d ...", evNo));
|
||||
menuItem.addActionListener(new GotoEvent(event));
|
||||
menu.add(menuItem);
|
||||
int[] beforeTimes = {0, 10, 60};
|
||||
for (int i = 0; i < beforeTimes.length; i++) {
|
||||
String title;
|
||||
if (beforeTimes[i] == 0) {
|
||||
title = String.format("Goto event %d ...", evNo);
|
||||
}
|
||||
else {
|
||||
title = String.format("Goto %ds before event %d ...", beforeTimes[i], evNo);
|
||||
}
|
||||
menuItem = new JMenuItem(title);
|
||||
menuItem.addActionListener(new GotoEvent(event, beforeTimes[i]));
|
||||
menu.add(menuItem);
|
||||
}
|
||||
menuItem = new JMenuItem(String.format("Edit event %d ...", evNo));
|
||||
menuItem.addActionListener(new EditEvent(event));
|
||||
menu.add(menuItem);
|
||||
@ -219,14 +229,16 @@ public class EventListDialog extends PamDialog {
|
||||
private class GotoEvent implements ActionListener {
|
||||
|
||||
private OfflineEventDataUnit event;
|
||||
private int beforeTime;
|
||||
|
||||
public GotoEvent(OfflineEventDataUnit event) {
|
||||
public GotoEvent(OfflineEventDataUnit event, int beforeTime) {
|
||||
this.event = event;
|
||||
this.beforeTime = beforeTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
clickControl.gotoEvent(event);
|
||||
clickControl.gotoEvent(event, beforeTime);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -24,7 +24,8 @@ import detectiongrouplocaliser.dialogs.DisplayOptionsHandler;
|
||||
import userDisplay.UserDisplayControl;
|
||||
|
||||
/**
|
||||
* Class for grouping any type of data together.
|
||||
* Class for grouping any type of data together. Not really a localiser, but
|
||||
* does include some localisation options.<br>
|
||||
* Will attempt to offer a variety of localisation options and will store data for each group
|
||||
* in a pair of database tables.
|
||||
* @author dg50
|
||||
|
@ -136,7 +136,7 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
}
|
||||
|
||||
|
||||
// sortColumnWidths();
|
||||
// sortColumnWidths();
|
||||
}
|
||||
|
||||
|
||||
@ -235,22 +235,35 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
menuItem.setIcon(menuIcon);
|
||||
pMenu.add(menuItem);
|
||||
|
||||
menuItem = new JMenuItem("Scroll to Group UID " + dgdu.getUID() + " at " + PamCalendar.formatDBDateTime(dgdu.getTimeMilliseconds()));
|
||||
menuItem.setIcon(menuIcon);
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
scrollToEvent(dgdu.getTimeMilliseconds());
|
||||
int[] beforeTimesSecs = {0, 10, 60};
|
||||
pMenu.addSeparator();
|
||||
for (int i = 0; i < beforeTimesSecs.length; i++) {
|
||||
int before = beforeTimesSecs[i];
|
||||
String title;
|
||||
if (before == 0) {
|
||||
title = "Scroll to Group UID " + dgdu.getUID() + " at " + PamCalendar.formatDBDateTime(dgdu.getTimeMilliseconds());
|
||||
}
|
||||
});
|
||||
pMenu.add(menuItem);
|
||||
else {
|
||||
title = String.format("Scroll to %ds before Group UID %d", before, dgdu.getUID());
|
||||
}
|
||||
menuItem = new JMenuItem(title);
|
||||
// menuItem.setIcon(menuIcon);
|
||||
menuItem.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
scrollToEvent(dgdu.getTimeMilliseconds()-before*1000);
|
||||
}
|
||||
});
|
||||
pMenu.add(menuItem);
|
||||
}
|
||||
|
||||
pMenu.show(e.getComponent(), e.getX(), e.getY());
|
||||
}
|
||||
|
||||
protected void scrollToEvent(long timeMilliseconds) {
|
||||
// start a it earlier.
|
||||
timeMilliseconds -= 5000;
|
||||
// now WTF - how do I tell every scroller to go to this point in time ?
|
||||
// now WTF - how do I tell every scroller to go to this point in time ?
|
||||
AbstractScrollManager scrollManager = AbstractScrollManager.getScrollManager();
|
||||
scrollManager.startDataAt(detectionGroupDataBlock, timeMilliseconds);
|
||||
|
||||
@ -348,7 +361,7 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
// System.out.println("getRowCount()");
|
||||
// System.out.println("getRowCount()");
|
||||
if (getViewOption() == DisplayOptionsHandler.SHOW_ALL) {
|
||||
firstRowToShow = 0;
|
||||
return numRowsToShow = detectionGroupDataBlock.getUnitsCount();
|
||||
@ -396,9 +409,9 @@ public class DetectionGroupTable extends UserDisplayComponentAdapter implements
|
||||
return null;
|
||||
}
|
||||
case 2:
|
||||
// if (iRow == 0) {
|
||||
// System.out.println("getValueAt(0,0)");
|
||||
// }
|
||||
// if (iRow == 0) {
|
||||
// System.out.println("getValueAt(0,0)");
|
||||
// }
|
||||
return dgdu.getUID();
|
||||
case 3:
|
||||
return PamCalendar.formatDateTime(dgdu.getTimeMilliseconds());
|
||||
|
Loading…
Reference in New Issue
Block a user