Issue #1158 Changed the scheduled and alerted alarm containers in SCANAlarmAlertManager to be sychronized. Changed the alarm button and alarm in SCANCellTableDlg to show and alarm only when the current table has alarms. Turn off alarms if the threshold has changed. Also a fix for ScanResource to initialize the ScanDrawer only after it has initialized the GeodeticCalculator.
Former-commit-id:02ca1776b4
[formerly e1f97dfdf69c0cf625555372e8855d85967c4b2a] Former-commit-id:1ed32bdefc
This commit is contained in:
parent
029f9537c8
commit
88d9115db9
8 changed files with 93 additions and 18 deletions
|
@ -19,6 +19,8 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.monitor.scan.commondialogs;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.FocusAdapter;
|
||||
import org.eclipse.swt.events.FocusEvent;
|
||||
|
@ -40,8 +42,12 @@ import org.eclipse.swt.widgets.Text;
|
|||
import com.raytheon.uf.common.monitor.scan.config.AbsConfigMgr;
|
||||
import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
|
||||
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
|
||||
import com.raytheon.uf.viz.monitor.scan.ScanMonitor;
|
||||
import com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg;
|
||||
import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager;
|
||||
import com.raytheon.uf.viz.monitor.scan.tables.SCANCellTableDlg;
|
||||
import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlarmType;
|
||||
import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlertedAlarms;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
public class SCANAlarmThreshDlg extends CaveSWTDialog implements
|
||||
|
@ -239,6 +245,16 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
alarmChoiceChanged();
|
||||
String columnName = attributeCbo.getText();
|
||||
mgr.clearAlertedAlarms(site, scanTable);
|
||||
AbstractTableDlg tableDlg = ScanMonitor.getInstance()
|
||||
.getDialog(scanTable, site);
|
||||
tableDlg.updateThresh(columnName);
|
||||
if (mgr.getAlertedAlarmCount(site, scanTable) == 0) {
|
||||
tableDlg.turnOffAlarm();
|
||||
} else {
|
||||
tableDlg.turnOnAlarm();
|
||||
}
|
||||
shell.dispose();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -157,7 +157,7 @@ public class ScanResource extends
|
|||
VizApp.runAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (getScanDrawer().font != null) {
|
||||
if (gc != null && getScanDrawer().font != null) {
|
||||
getScanDrawer().font.setMagnification(getCapability(
|
||||
MagnificationCapability.class).getMagnification()
|
||||
.floatValue());
|
||||
|
@ -560,7 +560,7 @@ public class ScanResource extends
|
|||
* @return
|
||||
*/
|
||||
public ScanDrawer getScanDrawer() {
|
||||
if (drawer == null) {
|
||||
if (drawer == null && gc != null) {
|
||||
if (getTable().equals(ScanTables.CELL)) {
|
||||
drawer = new ScanDrawer(SCANConfig.getInstance()
|
||||
.getStormCellConfig(), gc, getScan()
|
||||
|
|
|
@ -765,4 +765,8 @@ public abstract class AbstractTableDlg extends Dialog implements IMonitor,
|
|||
protected abstract void handleRankMenuEvent(SelectionEvent event);
|
||||
|
||||
public abstract void updateThresh(String attr);
|
||||
|
||||
public abstract void turnOffAlarm();
|
||||
|
||||
public abstract void turnOnAlarm();
|
||||
}
|
||||
|
|
|
@ -21,10 +21,13 @@ package com.raytheon.uf.viz.monitor.scan.tables;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
|
@ -36,6 +39,7 @@ import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums;
|
|||
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
|
||||
import com.raytheon.uf.viz.monitor.scan.ScanMonitor;
|
||||
import com.raytheon.uf.viz.monitor.scan.data.ScanDataGenerator;
|
||||
import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlarmType;
|
||||
|
||||
/**
|
||||
* Manager class to hold between scan dialog and alarming capabilities
|
||||
|
@ -74,11 +78,11 @@ public class SCANAlarmAlertManager {
|
|||
|
||||
private static SCANAlarmAlertManager instance = null;
|
||||
|
||||
private HashMap<String, HashMap<ScanTables, List<ScheduledAlarms>>> scheduledAlarmsMap;
|
||||
private Map<String, Map<ScanTables, List<ScheduledAlarms>>> scheduledAlarmsMap;
|
||||
|
||||
private HashMap<String, HashMap<ScanTables, Set<AlertedAlarms>>> alertedAlarmsMap;
|
||||
private Map<String, Map<ScanTables, Set<AlertedAlarms>>> alertedAlarmsMap;
|
||||
|
||||
private HashMap<String, HashMap<ScanTables, List<String>>> idents;
|
||||
private Map<String, Map<ScanTables, List<String>>> idents;
|
||||
|
||||
private boolean ring = false;
|
||||
|
||||
|
@ -98,7 +102,7 @@ public class SCANAlarmAlertManager {
|
|||
public void addSite(String site) {
|
||||
|
||||
if (!scheduledAlarmsMap.containsKey(site)) {
|
||||
HashMap<ScanTables, List<ScheduledAlarms>> siteScheduledAlarmsMap = new HashMap<ScanTables, List<ScheduledAlarms>>();
|
||||
Map<ScanTables, List<ScheduledAlarms>> siteScheduledAlarmsMap = Collections.synchronizedMap(new HashMap<ScanTables, List<ScheduledAlarms>>());
|
||||
siteScheduledAlarmsMap.put(ScanTables.DMD,
|
||||
new CopyOnWriteArrayList<ScheduledAlarms>());
|
||||
siteScheduledAlarmsMap.put(ScanTables.CELL,
|
||||
|
@ -107,7 +111,7 @@ public class SCANAlarmAlertManager {
|
|||
}
|
||||
|
||||
if (!alertedAlarmsMap.containsKey(site)) {
|
||||
HashMap<ScanTables, Set<AlertedAlarms>> siteAlertedAlarmsSet = new HashMap<ScanTables, Set<AlertedAlarms>>();
|
||||
Map<ScanTables, Set<AlertedAlarms>> siteAlertedAlarmsSet = Collections.synchronizedMap(new HashMap<ScanTables, Set<AlertedAlarms>>());
|
||||
siteAlertedAlarmsSet.put(ScanTables.DMD,
|
||||
new HashSet<AlertedAlarms>());
|
||||
siteAlertedAlarmsSet.put(ScanTables.CELL,
|
||||
|
@ -116,7 +120,7 @@ public class SCANAlarmAlertManager {
|
|||
}
|
||||
|
||||
if (!idents.containsKey(site)) {
|
||||
HashMap<ScanTables, List<String>> siteIdents = new HashMap<ScanTables, List<String>>();
|
||||
Map<ScanTables, List<String>> siteIdents = new HashMap<ScanTables, List<String>>();
|
||||
siteIdents.put(ScanTables.CELL, new ArrayList<String>());
|
||||
siteIdents.put(ScanTables.DMD, new ArrayList<String>());
|
||||
idents.put(site, siteIdents);
|
||||
|
@ -126,15 +130,15 @@ public class SCANAlarmAlertManager {
|
|||
private SCANAlarmAlertManager() {
|
||||
|
||||
if (scheduledAlarmsMap == null) {
|
||||
scheduledAlarmsMap = new HashMap<String, HashMap<ScanTables, List<ScheduledAlarms>>>();
|
||||
scheduledAlarmsMap = Collections.synchronizedMap(new HashMap<String, Map<ScanTables, List<ScheduledAlarms>>>());
|
||||
}
|
||||
|
||||
if (alertedAlarmsMap == null) {
|
||||
alertedAlarmsMap = new HashMap<String, HashMap<ScanTables, Set<AlertedAlarms>>>();
|
||||
alertedAlarmsMap = Collections.synchronizedMap(new HashMap<String, Map<ScanTables, Set<AlertedAlarms>>>());
|
||||
}
|
||||
|
||||
if (idents == null) {
|
||||
idents = new HashMap<String, HashMap<ScanTables, List<String>>>();
|
||||
idents = new HashMap<String, Map<ScanTables, List<String>>>();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -438,7 +442,7 @@ public class SCANAlarmAlertManager {
|
|||
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
public boolean containsAlarm(String site, ScanTables tableType,
|
||||
AlarmType type, String colName, String ident) {
|
||||
for (AlertedAlarms alarm : alertedAlarmsMap.get(site).get(tableType)) {
|
||||
|
@ -493,9 +497,10 @@ public class SCANAlarmAlertManager {
|
|||
alarm.cleared = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void removeAlertedAlarms(String site, ScanTables tableType) {
|
||||
alertedAlarmsMap.get(site).get(tableType).clear();
|
||||
setRing(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -603,4 +608,5 @@ public class SCANAlarmAlertManager {
|
|||
+ this.row + "\nCol #:" + this.col + "\nCleared: " + cleared + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -475,8 +475,7 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
|
|||
alarmDlg.open();
|
||||
if (!alarmBtn.isDisposed()
|
||||
&& (mgr.getAlertedAlarmCount(site, scanTable) == 0)) {
|
||||
alarmBtn.setVisible(false);
|
||||
mgr.setRing(false);
|
||||
turnOffAlarm();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -488,7 +487,23 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
|
|||
timeLbl.setLayoutData(gd);
|
||||
}
|
||||
|
||||
// private void resetButtonForegroundColor(Button btn)
|
||||
@Override
|
||||
public void turnOffAlarm() {
|
||||
if (alarmBtn != null && !alarmBtn.isDisposed()) {
|
||||
alarmBtn.setVisible(false);
|
||||
}
|
||||
mgr.setRing(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void turnOnAlarm() {
|
||||
if (alarmBtn != null && !alarmBtn.isDisposed()) {
|
||||
alarmBtn.setVisible(true);
|
||||
}
|
||||
mgr.setRing(true);
|
||||
}
|
||||
|
||||
// private void resetButtonForegroundColor(Button btn)
|
||||
// {
|
||||
// btn.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
|
||||
// }
|
||||
|
|
|
@ -514,8 +514,7 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
|
|||
alarmsDlg.open();
|
||||
if (!alarmBtn.isDisposed()
|
||||
&& mgr.getAlertedAlarms(site, scanTable).isEmpty()) {
|
||||
alarmBtn.setVisible(false);
|
||||
mgr.setRing(false);
|
||||
turnOffAlarm();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1299,4 +1298,19 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
|
|||
dmdTableComp.alarmSelection(ident);
|
||||
|
||||
}
|
||||
|
||||
public void turnOffAlarm() {
|
||||
if (alarmBtn != null && !alarmBtn.isDisposed()) {
|
||||
alarmBtn.setVisible(false);
|
||||
}
|
||||
mgr.setRing(false);
|
||||
}
|
||||
|
||||
public void turnOnAlarm() {
|
||||
if (alarmBtn != null && !alarmBtn.isDisposed()) {
|
||||
alarmBtn.setVisible(true);
|
||||
}
|
||||
mgr.setRing(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -647,4 +647,14 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void turnOffAlarm() {
|
||||
mgr.setRing(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void turnOnAlarm() {
|
||||
mgr.setRing(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -609,4 +609,14 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
|
|||
// Not currently used for TVS
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void turnOffAlarm() {
|
||||
mgr.setRing(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void turnOnAlarm() {
|
||||
mgr.setRing(true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue