Issue #2143. Changes for non-blocking SCAN dialogs.

Change-Id: I0afcaced20e0cc76cbcb2d64a24fcfc3022dc1d1

Former-commit-id: 5539da3d19fa0c174eba1a8733e946ca10e5f4bb
This commit is contained in:
Slav Korolev 2013-07-26 14:01:51 -04:00
parent 08f1021c6d
commit 4afde7addb
22 changed files with 1271 additions and 376 deletions

View file

@ -113,6 +113,7 @@ import com.vividsolutions.jts.io.WKBReader;
* to avoid !TimeStamp.equals(Date) issue * to avoid !TimeStamp.equals(Date) issue
* Apr 26, 2013 1926 njensen Optimized getAvailableUris() * Apr 26, 2013 1926 njensen Optimized getAvailableUris()
* Jul 24, 2013 2218 mpduff Improved error handling, optimizations * Jul 24, 2013 2218 mpduff Improved error handling, optimizations
* Jul 30, 2013 2143 skorolev Changes for non-blocking dialogs.
* </pre> * </pre>
* *
* @author dhladky * @author dhladky
@ -753,48 +754,54 @@ public class ScanMonitor extends ResourceMonitor implements IScanDialogListener
if (cellDialogs.isEmpty()) { if (cellDialogs.isEmpty()) {
getScanConfig().reload(ScanTables.CELL); getScanConfig().reload(ScanTables.CELL);
} }
if (cellDialogs.get(icao) == null) { if (cellDialogs.get(icao) == null||cellDialogs.get(icao).isDisposed()) {
SCANCellTableDlg cellDialog = new SCANCellTableDlg(shell, icao, SCANCellTableDlg cellDialog = new SCANCellTableDlg(shell, icao,
new SCANTableData(ScanTables.CELL)); new SCANTableData(ScanTables.CELL));
cellDialogs.put(icao, cellDialog); cellDialogs.put(icao, cellDialog);
monitor.addMonitorListener(cellDialog); monitor.addMonitorListener(cellDialog);
cellDialog.addMonitorControlListener(monitor); cellDialog.addMonitorControlListener(monitor);
} else {
cellDialogs.get(icao).bringToTop();
} }
} else if (table.equals(ScanTables.DMD)) { } else if (table.equals(ScanTables.DMD)) {
if (dmdDialogs.isEmpty()) { if (dmdDialogs.isEmpty()) {
getScanConfig().reload(ScanTables.DMD); getScanConfig().reload(ScanTables.DMD);
} }
if (dmdDialogs.get(icao) == null) { if (dmdDialogs.get(icao) == null||dmdDialogs.get(icao).isDisposed()) {
SCANDmdTableDlg dmdDialog = new SCANDmdTableDlg(shell, icao, SCANDmdTableDlg dmdDialog = new SCANDmdTableDlg(shell, icao,
new SCANTableData(ScanTables.DMD)); new SCANTableData(ScanTables.DMD));
dmdDialogs.put(icao, dmdDialog); dmdDialogs.put(icao, dmdDialog);
monitor.addMonitorListener(dmdDialog); monitor.addMonitorListener(dmdDialog);
dmdDialog.addMonitorControlListener(monitor); dmdDialog.addMonitorControlListener(monitor);
}else{
dmdDialogs.get(icao).bringToTop();
} }
} else if (table.equals(ScanTables.MESO)) { } else if (table.equals(ScanTables.MESO)) {
if (mesoDialogs.isEmpty()) { if (mesoDialogs.isEmpty()) {
getScanConfig().reload(ScanTables.MESO); getScanConfig().reload(ScanTables.MESO);
} }
if (mesoDialogs.get(icao) == null) { if (mesoDialogs.get(icao) == null || mesoDialogs.get(icao).isDisposed()) {
SCANMesoTableDlg mesoDialog = new SCANMesoTableDlg(shell, icao, SCANMesoTableDlg mesoDialog = new SCANMesoTableDlg(shell, icao,
new SCANTableData(ScanTables.MESO)); new SCANTableData(ScanTables.MESO));
mesoDialogs.put(icao, mesoDialog); mesoDialogs.put(icao, mesoDialog);
monitor.addMonitorListener(mesoDialog); monitor.addMonitorListener(mesoDialog);
mesoDialog.addMonitorControlListener(monitor); mesoDialog.addMonitorControlListener(monitor);
} else { } else {
mesoDialogs.get(icao).bringToTop();
return; return;
} }
} else if (table.equals(ScanTables.TVS)) { } else if (table.equals(ScanTables.TVS)) {
if (tvsDialogs.isEmpty()) { if (tvsDialogs.isEmpty()) {
getScanConfig().reload(ScanTables.TVS); getScanConfig().reload(ScanTables.TVS);
} }
if (tvsDialogs.get(icao) == null) { if (tvsDialogs.get(icao) == null||tvsDialogs.get(icao).isDisposed()) {
SCANTvsTableDlg tvsDialog = new SCANTvsTableDlg(shell, icao, SCANTvsTableDlg tvsDialog = new SCANTvsTableDlg(shell, icao,
new SCANTableData(ScanTables.TVS)); new SCANTableData(ScanTables.TVS));
tvsDialogs.put(icao, tvsDialog); tvsDialogs.put(icao, tvsDialog);
monitor.addMonitorListener(tvsDialog); monitor.addMonitorListener(tvsDialog);
tvsDialog.addMonitorControlListener(monitor); tvsDialog.addMonitorControlListener(monitor);
} else { } else {
tvsDialogs.get(icao).bringToTop();
return; return;
} }
} }

View file

@ -39,6 +39,7 @@ import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML; import com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML;
import com.raytheon.uf.common.monitor.scan.xml.SCANConfigDmdXML; import com.raytheon.uf.common.monitor.scan.xml.SCANConfigDmdXML;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase.CAVE;
/** /**
* This class displays the DMD Display Filter Control dialog. * This class displays the DMD Display Filter Control dialog.
@ -49,6 +50,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 12, 2009 3039 lvenable Initial creation. * Nov 12, 2009 3039 lvenable Initial creation.
* 24 Jul 2013 #2143 skorolev Changes for non-blocking dialog.
* *
* </pre> * </pre>
* *
@ -102,12 +104,17 @@ public class DmdDisplayFilterDlg extends CaveSWTDialog implements
* Callback that is called when changes are made. * Callback that is called when changes are made.
*/ */
public DmdDisplayFilterDlg(Shell parentShell, IDisplayFilterUpdate cb) { public DmdDisplayFilterDlg(Shell parentShell, IDisplayFilterUpdate cb) {
super(parentShell); super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
setText("DMD Display Filter Control"); setText("DMD Display Filter Control");
displayFilterUpdateCB = cb; displayFilterUpdateCB = cb;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override @Override
protected Layout constructShellLayout() { protected Layout constructShellLayout() {
// Create the main layout for the shell. // Create the main layout for the shell.
@ -117,12 +124,24 @@ public class DmdDisplayFilterDlg extends CaveSWTDialog implements
return mainLayout; return mainLayout;
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override @Override
protected void disposed() { protected void disposed() {
lrgLabelFont.dispose(); lrgLabelFont.dispose();
smLabelFont.dispose(); smLabelFont.dispose();
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
// Initialize all of the controls and layouts // Initialize all of the controls and layouts
@ -241,7 +260,7 @@ public class DmdDisplayFilterDlg extends CaveSWTDialog implements
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
applyAction(); applyAction();
shell.dispose(); close();
} }
}); });
@ -364,9 +383,15 @@ public class DmdDisplayFilterDlg extends CaveSWTDialog implements
displayFilterUpdateCB.displayFilterUpdated(); displayFilterUpdateCB.displayFilterUpdated();
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.scan.commondialogs.ICommonDialogAction#
* closeDialog()
*/
@Override @Override
public void closeDialog() { public void closeDialog() {
shell.dispose(); close();
} }
/** /**

View file

@ -41,6 +41,7 @@ import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
import com.raytheon.uf.common.monitor.scan.config.TrendSetConfigMgr; import com.raytheon.uf.common.monitor.scan.config.TrendSetConfigMgr;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables; import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase.CAVE;
/** /**
* *
@ -52,6 +53,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 3, 2009 #3039 lvenable Initial creation * Dec 3, 2009 #3039 lvenable Initial creation
* 24 Jul 2013 #2143 skorolev Changes for non-blocking dialog.
* *
* </pre> * </pre>
* *
@ -135,12 +137,15 @@ public class EditCreateTrendDlg extends CaveSWTDialog implements
* SCAN table identifier. * SCAN table identifier.
*/ */
public EditCreateTrendDlg(Shell parentShell, ScanTables scanTable) { public EditCreateTrendDlg(Shell parentShell, ScanTables scanTable) {
super(parentShell); super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
setText("Edit/Create Trend Sets"); setText("Edit/Create Trend Sets");
this.scanTable = scanTable; this.scanTable = scanTable;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override @Override
protected Layout constructShellLayout() { protected Layout constructShellLayout() {
// Create the main layout for the shell. // Create the main layout for the shell.
@ -150,6 +155,9 @@ public class EditCreateTrendDlg extends CaveSWTDialog implements
return mainLayout; return mainLayout;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org.eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
/* /*
@ -565,7 +573,7 @@ public class EditCreateTrendDlg extends CaveSWTDialog implements
scanCfg.getTrendConfigMgr(scanTable).saveTrendSets(); scanCfg.getTrendConfigMgr(scanTable).saveTrendSets();
okSelected = true; okSelected = true;
shell.dispose(); close();
} }
/** /**
@ -642,7 +650,7 @@ public class EditCreateTrendDlg extends CaveSWTDialog implements
@Override @Override
public void closeDialog() { public void closeDialog() {
handleCancelAction(); handleCancelAction();
shell.dispose(); close();
} }
} }

View file

@ -45,35 +45,60 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.monitor.scan.config.SCANConfig; import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables; import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase.CAVE;
/**
* Open and Save Dialog for configuration files.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 24 Jul 2013 #2143 skorolev Changes for non-blocking dialogs.
*
* </pre>
*
* @author
* @version 1.0
*/
public class LoadSaveConfigDlg extends CaveSWTDialog { public class LoadSaveConfigDlg extends CaveSWTDialog {
public static enum DialogType { public static enum DialogType {
OPEN, SAVE_AS OPEN, SAVE_AS
}; };
/* Type of dialog */
private DialogType dialogType; private DialogType dialogType;
/* Font type */
private Font controlFont; private Font controlFont;
/* File list control */
private List cfgFileList; private List cfgFileList;
/* LocalizationFile */
private LocalizationFile selectedFile; private LocalizationFile selectedFile;
/* Localization Files */
private LocalizationFile[] locFiles; private LocalizationFile[] locFiles;
/* Tree map of localization files */
private TreeMap<String, LocalizationFile> locFileMap; private TreeMap<String, LocalizationFile> locFileMap;
/* Name of new file */
private Text newFileNameTF; private Text newFileNameTF;
/* Action button */
private Button actionBtn; private Button actionBtn;
/* SCAN Table */
private ScanTables scanTable; private ScanTables scanTable;
/* SCAN configuration */
private SCANConfig scanCfg; private SCANConfig scanCfg;
/**
* Constructor
*
* @param parent
* @param type
* @param scanTable
*/
public LoadSaveConfigDlg(Shell parent, DialogType type, ScanTables scanTable) { public LoadSaveConfigDlg(Shell parent, DialogType type, ScanTables scanTable) {
super(parent, SWT.TITLE); super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
if (type == DialogType.OPEN) { if (type == DialogType.OPEN) {
setText("Load " + scanTable.name() + " Configuration"); setText("Load " + scanTable.name() + " Configuration");
} else { } else {
@ -85,6 +110,9 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
scanCfg = SCANConfig.getInstance(); scanCfg = SCANConfig.getInstance();
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override @Override
protected Layout constructShellLayout() { protected Layout constructShellLayout() {
// Create the main layout for the shell. // Create the main layout for the shell.
@ -95,12 +123,18 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
return mainLayout; return mainLayout;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override @Override
protected void disposed() { protected void disposed() {
controlFont.dispose(); controlFont.dispose();
setReturnValue(selectedFile); setReturnValue(selectedFile);
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org.eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
locFileMap = new TreeMap<String, LocalizationFile>(); locFileMap = new TreeMap<String, LocalizationFile>();
@ -114,6 +148,9 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
getAvailableConfigFiles(); getAvailableConfigFiles();
} }
/**
* Create List control.
*/
private void createListControl() { private void createListControl() {
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite controlComp = new Composite(shell, SWT.NONE); Composite controlComp = new Composite(shell, SWT.NONE);
@ -161,6 +198,9 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
} }
} }
/**
* Create bottom buttons.
*/
private void createBottomButtons() { private void createBottomButtons() {
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
Composite mainButtonComp = new Composite(shell, SWT.NONE); Composite mainButtonComp = new Composite(shell, SWT.NONE);
@ -189,7 +229,7 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
if (validateFileName() == true) { if (validateFileName() == true) {
saveAction(); saveAction();
shell.dispose(); close();
} }
} }
}); });
@ -202,18 +242,26 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
cancelBtn.addSelectionListener(new SelectionAdapter() { cancelBtn.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
selectedFile = null; selectedFile = null;
shell.dispose(); setReturnValue(null);
close();
} }
}); });
} }
/**
* Open action.
*/
private void openAction() { private void openAction() {
int selectedIndex = cfgFileList.getSelectionIndex(); int selectedIndex = cfgFileList.getSelectionIndex();
String str = cfgFileList.getItem(selectedIndex); String str = cfgFileList.getItem(selectedIndex);
selectedFile = locFileMap.get(str); selectedFile = locFileMap.get(str);
shell.dispose(); setReturnValue(selectedFile);
close();
} }
/**
* Save action.
*/
private void saveAction() { private void saveAction() {
// TODO : need to save a file // TODO : need to save a file
@ -224,10 +272,15 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
LocalizationType.COMMON_STATIC, LocalizationLevel.SITE); LocalizationType.COMMON_STATIC, LocalizationLevel.SITE);
String newFileName = getConfigPath() + fileName; String newFileName = getConfigPath() + fileName;
selectedFile = pm.getLocalizationFile(context, newFileName); selectedFile = pm.getLocalizationFile(context, newFileName);
setReturnValue(selectedFile);
shell.dispose(); close();
} }
/**
* Validate file.
*
* @return
*/
private boolean validateFileName() { private boolean validateFileName() {
StringBuffer strBuf = new StringBuffer(newFileNameTF.getText().trim()); StringBuffer strBuf = new StringBuffer(newFileNameTF.getText().trim());
@ -278,6 +331,9 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
return true; return true;
} }
/**
* Get available configuration files.
*/
private void getAvailableConfigFiles() { private void getAvailableConfigFiles() {
String[] extensions = new String[] { ".xml" }; String[] extensions = new String[] { ".xml" };
locFiles = PathManagerFactory.getPathManager().listStaticFiles( locFiles = PathManagerFactory.getPathManager().listStaticFiles(
@ -288,11 +344,6 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
} }
for (int i = 0; i < locFiles.length; i++) { for (int i = 0; i < locFiles.length; i++) {
System.out.println("Get file, get name --- "
+ locFiles[i].getFile().getName());
System.out.println("Get name *** "
+ locFiles[i].getName());
// locFileMap.put(locFiles[i].getName(), locFiles[i]);
locFileMap.put(locFiles[i].getFile().getName(), locFiles[i]); locFileMap.put(locFiles[i].getFile().getName(), locFiles[i]);
} }
@ -305,10 +356,20 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
} }
} }
/**
* Get path.
*
* @return
*/
private String getConfigPath() { private String getConfigPath() {
return scanCfg.getConfigurationPath(scanTable); return scanCfg.getConfigurationPath(scanTable);
} }
/**
* Get localization file.
*
* @return
*/
public LocalizationFile getSelectedFile() { public LocalizationFile getSelectedFile() {
return selectedFile; return selectedFile;
} }

View file

@ -19,8 +19,6 @@
**/ **/
package com.raytheon.uf.viz.monitor.scan.commondialogs; package com.raytheon.uf.viz.monitor.scan.commondialogs;
import java.util.Set;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.FocusAdapter; import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent; import org.eclipse.swt.events.FocusEvent;
@ -45,49 +43,71 @@ 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.ScanMonitor;
import com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg; 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.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.AlarmType;
import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlertedAlarms;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
* SCAN Alarm Threshold Dialog.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 24 Jul 2013 #2143 skorolev Changes for non-blocking dialogs.
*
* </pre>
*
* @author
* @version 1.0
*/
public class SCANAlarmThreshDlg extends CaveSWTDialog implements public class SCANAlarmThreshDlg extends CaveSWTDialog implements
ICommonDialogAction { ICommonDialogAction {
/* SCAN Table */
private ScanTables scanTable; private ScanTables scanTable;
/* SCAN Configuration */
private SCANConfig scanCfg; private SCANConfig scanCfg;
/* Attribute combo control */
private Combo attributeCbo; private Combo attributeCbo;
/* Disable All Alarms Checkbox */
private Button disableAllAlarmChk; private Button disableAllAlarmChk;
/* Absolute Value Rdo */
private Button absValueRdo; private Button absValueRdo;
/* Rate Of Change Rdo */
private Button rateOfChangeRdo; private Button rateOfChangeRdo;
/* Selected Choice Label */
private Label selectedChoiceLbl; private Label selectedChoiceLbl;
/* Time Frame Value */
private Text valueTF; private Text valueTF;
/* Unit Label */
private Label unitsLbl; private Label unitsLbl;
/* "Absolute Value" */
private final String absValStr = "Absolute Value"; private final String absValStr = "Absolute Value";
/* "Rate of Change" */
private final String rocStr = "Rate of Change"; private final String rocStr = "Rate of Change";
/* Bell Checkbox */
private Button bellChk; private Button bellChk;
/* SCAN Alarm Alert Manager */
private SCANAlarmAlertManager mgr; private SCANAlarmAlertManager mgr;
/* Alarm Type */
private AlarmType type; private AlarmType type;
/* prevAttr */
private String prevAttr; private String prevAttr;
/* Site */
private String site = null; private String site = null;
/**
* Constructor
*
* @param site
* @param parentShell
* @param scanTable
*/
public SCANAlarmThreshDlg(String site, Shell parentShell, public SCANAlarmThreshDlg(String site, Shell parentShell,
ScanTables scanTable) { ScanTables scanTable) {
super(parentShell); super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
if (scanTable == ScanTables.CELL) { if (scanTable == ScanTables.CELL) {
setText("CELL Alarm Thresh"); setText("CELL Alarm Thresh");
} else { } else {
@ -99,6 +119,9 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
this.site = site; this.site = site;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override @Override
protected Layout constructShellLayout() { protected Layout constructShellLayout() {
// Create the main layout for the shell. // Create the main layout for the shell.
@ -108,6 +131,9 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
return mainLayout; return mainLayout;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org.eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
// Initialize all of the controls and layouts // Initialize all of the controls and layouts
@ -119,6 +145,9 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
attributeChanged(); attributeChanged();
} }
/**
* Create Dialog Controls
*/
private void createControls() { private void createControls() {
Composite controlComp = new Composite(shell, SWT.NONE); Composite controlComp = new Composite(shell, SWT.NONE);
controlComp.setLayout(new GridLayout(3, false)); controlComp.setLayout(new GridLayout(3, false));
@ -230,6 +259,9 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
unitsLbl.setLayoutData(gd); unitsLbl.setLayoutData(gd);
} }
/**
* Create Bottom Buttons.
*/
private void createBottomButtons() { private void createBottomButtons() {
Composite buttonComp = new Composite(shell, SWT.NONE); Composite buttonComp = new Composite(shell, SWT.NONE);
buttonComp.setLayout(new GridLayout(2, true)); buttonComp.setLayout(new GridLayout(2, true));
@ -255,7 +287,7 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
} else { } else {
tableDlg.turnOnAlarm(); tableDlg.turnOnAlarm();
} }
shell.dispose(); close();
} }
}); });
@ -272,6 +304,11 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
}); });
} }
/**
* Add Separator.
*
* @param parentComp
*/
private void addSeparator(Composite parentComp) { private void addSeparator(Composite parentComp) {
GridLayout gl = (GridLayout) parentComp.getLayout(); GridLayout gl = (GridLayout) parentComp.getLayout();
@ -281,6 +318,9 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
sepLbl.setLayoutData(gd); sepLbl.setLayoutData(gd);
} }
/**
* Populate Attribute Combo control.
*/
private void populateAttributeCombo() { private void populateAttributeCombo() {
AbsConfigMgr absCfgMgr = scanCfg.getAbsConfigMgr(scanTable); AbsConfigMgr absCfgMgr = scanCfg.getAbsConfigMgr(scanTable);
@ -293,17 +333,12 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
attributeCbo.select(0); attributeCbo.select(0);
} }
/**
* Attribute Changed.
*/
private void attributeChanged() { private void attributeChanged() {
String attrName = attributeCbo String attrName = attributeCbo
.getItem(attributeCbo.getSelectionIndex()); .getItem(attributeCbo.getSelectionIndex());
/*
* Check if the alarm is disabled and enable/disable the controls.
*/
// boolean alarmDisabled = scanCfg.getAlarmsDisabled(scanTable);
// System.out.println("alarmDisabled = " + alarmDisabled);
// disableAllAlarmChk.setSelection(alarmDisabled);
//
// disableSelectedAttributeAlarm(alarmDisabled);
/* /*
* Set the value text control with the proper abs/roc value. * Set the value text control with the proper abs/roc value.
@ -316,15 +351,12 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
unitsLbl.setText(scanCfg.getAbsConfigMgr(scanTable).getUnit(attrName)); unitsLbl.setText(scanCfg.getAbsConfigMgr(scanTable).getUnit(attrName));
} }
/**
* Disable Selected Attribute Alarm.
*
* @param alarmDisabled
*/
private void disableSelectedAttributeAlarm(boolean alarmDisabled) { private void disableSelectedAttributeAlarm(boolean alarmDisabled) {
// String attrName =
// attributeCbo.getItem(attributeCbo.getSelectionIndex());
// boolean alarmEnabled = !disableAlarmChk.getSelection();
//
// scanCfg.getAbsConfigMgr(scanTable).setAlarmDisabled(attrName,
// alarmEnabled);
System.out.println("alarmDisabled = " + alarmDisabled);
absValueRdo.setEnabled(!alarmDisabled); absValueRdo.setEnabled(!alarmDisabled);
@ -341,6 +373,9 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
valueTF.setEnabled(!alarmDisabled); valueTF.setEnabled(!alarmDisabled);
} }
/**
* Alarm Choice Changed.
*/
private void alarmChoiceChanged() { private void alarmChoiceChanged() {
if (!valueTF.getText().isEmpty()) { if (!valueTF.getText().isEmpty()) {
mgr.updateScheduledAlarm(site, scanTable, prevAttr, type, mgr.updateScheduledAlarm(site, scanTable, prevAttr, type,
@ -366,6 +401,9 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
prevAttr = attrName; prevAttr = attrName;
} }
/**
* Validate And Set Time Frame Value.
*/
private void validateAndSetValue() { private void validateAndSetValue() {
int newValue = 0; int newValue = 0;
String valueStr = valueTF.getText().trim(); String valueStr = valueTF.getText().trim();
@ -406,8 +444,11 @@ public class SCANAlarmThreshDlg extends CaveSWTDialog implements
} }
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.commondialogs.ICommonDialogAction#closeDialog()
*/
@Override @Override
public void closeDialog() { public void closeDialog() {
shell.dispose(); close();
} }
} }

View file

@ -43,6 +43,7 @@ import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.monitor.scan.xml.ScanAlarmXML; import com.raytheon.uf.common.monitor.scan.xml.ScanAlarmXML;
import com.raytheon.uf.common.serialization.SerializationUtil; import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase.CAVE;
/** /**
* *
@ -53,6 +54,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Nov 22, 2010 lvenable Initial creation * Nov 22, 2010 lvenable Initial creation
* 24 Jul 2013 #2143 skorolev Changes for non-blocking dialogs.
* *
* </pre> * </pre>
* *
@ -62,30 +64,64 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
public class SCANAlarmTimeLimitDlg extends CaveSWTDialog implements public class SCANAlarmTimeLimitDlg extends CaveSWTDialog implements
ICommonDialogAction { ICommonDialogAction {
/**
* Scan Tables
*/
private ScanTables scanTable; private ScanTables scanTable;
/**
* Cell Spinner
*/
private Spinner cellSpnr; private Spinner cellSpnr;
/**
* Meso Spinner
*/
private Spinner mesoSpnr; private Spinner mesoSpnr;
/**
* TVS Spinner
*/
private Spinner tvsSpnr; private Spinner tvsSpnr;
/**
* DMD Spinner
*/
private Spinner dmdSpnr; private Spinner dmdSpnr;
/**
* Label Width
*/
private int labelWidth = 80; private int labelWidth = 80;
/**
* Width Spinner
*/
private int spinnerWidth = 70; private int spinnerWidth = 70;
/**
* SCAN Alarm XML
*/
private ScanAlarmXML dataXML; private ScanAlarmXML dataXML;
/**
* Constructor
*
* @param parentShell
* @param scanTable
* @param site
*/
public SCANAlarmTimeLimitDlg(Shell parentShell, ScanTables scanTable, public SCANAlarmTimeLimitDlg(Shell parentShell, ScanTables scanTable,
String site) { String site) {
super(parentShell); super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
setText("Alarm Time Limit for: " + site); setText("Alarm Time Limit for: " + site);
this.scanTable = scanTable; this.scanTable = scanTable;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override @Override
protected Layout constructShellLayout() { protected Layout constructShellLayout() {
// Create the main layout for the shell. // Create the main layout for the shell.
@ -95,6 +131,9 @@ public class SCANAlarmTimeLimitDlg extends CaveSWTDialog implements
return mainLayout; return mainLayout;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org.eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
@ -114,6 +153,9 @@ public class SCANAlarmTimeLimitDlg extends CaveSWTDialog implements
createBottomButtons(); createBottomButtons();
} }
/**
* Create CELL, MESO, TVS Controls.
*/
private void createCellMesoTvsControls() { private void createCellMesoTvsControls() {
Composite controlComp = new Composite(shell, SWT.NONE); Composite controlComp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(3, false); GridLayout gl = new GridLayout(3, false);
@ -195,6 +237,9 @@ public class SCANAlarmTimeLimitDlg extends CaveSWTDialog implements
} }
} }
/**
* Create DMD Controls
*/
private void createDmdControls() { private void createDmdControls() {
Composite controlComp = new Composite(shell, SWT.NONE); Composite controlComp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(3, false); GridLayout gl = new GridLayout(3, false);
@ -231,6 +276,9 @@ public class SCANAlarmTimeLimitDlg extends CaveSWTDialog implements
} }
} }
/**
* Create Bottom Buttons.
*/
private void createBottomButtons() { private void createBottomButtons() {
Composite buttonComp = new Composite(shell, SWT.NONE); Composite buttonComp = new Composite(shell, SWT.NONE);
buttonComp.setLayout(new GridLayout(2, true)); buttonComp.setLayout(new GridLayout(2, true));
@ -247,7 +295,7 @@ public class SCANAlarmTimeLimitDlg extends CaveSWTDialog implements
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
saveAlarmData(); saveAlarmData();
shell.dispose(); close();
} }
}); });
@ -259,16 +307,22 @@ public class SCANAlarmTimeLimitDlg extends CaveSWTDialog implements
cancelBtn.addSelectionListener(new SelectionAdapter() { cancelBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
shell.dispose(); close();
} }
}); });
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.commondialogs.ICommonDialogAction#closeDialog()
*/
@Override @Override
public void closeDialog() { public void closeDialog() {
shell.dispose(); close();
} }
/**
* Read Alarm Data.
*/
private void readAlarmData() private void readAlarmData()
{ {
try try
@ -281,12 +335,14 @@ public class SCANAlarmTimeLimitDlg extends CaveSWTDialog implements
} }
catch (Exception e) catch (Exception e)
{ {
// e.printStackTrace();
System.out.println("*** ScanAlarms.xml not available."); System.out.println("*** ScanAlarms.xml not available.");
dataXML = null; dataXML = null;
} }
} }
/**
* Save Alarm Data.
*/
private void saveAlarmData() private void saveAlarmData()
{ {
if (dataXML == null) if (dataXML == null)
@ -329,6 +385,11 @@ public class SCANAlarmTimeLimitDlg extends CaveSWTDialog implements
} }
} }
/**
* Get Full Path And File Name.
*
* @return file name
*/
public String getFullPathAndFileName() public String getFullPathAndFileName()
{ {
String fs = String.valueOf(File.separatorChar); String fs = String.valueOf(File.separatorChar);

View file

@ -35,25 +35,61 @@ import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.monitor.scan.config.SCANConfig; import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables; import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase.CAVE;
/**
* SCAN Attributes Dialog.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 24 Jul 2013 #2143 skorolev Changes for non-blocking dialogs.
*
* </pre>
*
* @author
* @version 1.0
*/
public class SCANAttributesDlg extends CaveSWTDialog implements public class SCANAttributesDlg extends CaveSWTDialog implements
ICommonDialogAction { ICommonDialogAction {
/**
* Attribute checkboxes.
*/
private ArrayList<Button> attributeChkBtns; private ArrayList<Button> attributeChkBtns;
/**
* Attribute Update Checkboxes.
*/
private IAttributeUpdate attributeUpdateCb; private IAttributeUpdate attributeUpdateCb;
/**
* SCAN Tables.
*/
private ScanTables scanTable; private ScanTables scanTable;
/**
* Constructor
*
* @param parent
* @param scanTable
* @param attributeUpdateCb
*/
public SCANAttributesDlg(Shell parent, ScanTables scanTable, public SCANAttributesDlg(Shell parent, ScanTables scanTable,
IAttributeUpdate attributeUpdateCb) { IAttributeUpdate attributeUpdateCb) {
super(parent); super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
setText("Attributes"); setText("Attributes");
this.scanTable = scanTable; this.scanTable = scanTable;
this.attributeUpdateCb = attributeUpdateCb; this.attributeUpdateCb = attributeUpdateCb;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override @Override
protected Layout constructShellLayout() { protected Layout constructShellLayout() {
// Create the main layout for the shell. // Create the main layout for the shell.
@ -63,6 +99,9 @@ public class SCANAttributesDlg extends CaveSWTDialog implements
return mainLayout; return mainLayout;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org.eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
attributeChkBtns = new ArrayList<Button>(); attributeChkBtns = new ArrayList<Button>();
@ -70,6 +109,9 @@ public class SCANAttributesDlg extends CaveSWTDialog implements
createBottomButtons(); createBottomButtons();
} }
/**
* Create Attribute Controls.
*/
private void createAttributeControls() { private void createAttributeControls() {
SCANConfig scanCfg = SCANConfig.getInstance(); SCANConfig scanCfg = SCANConfig.getInstance();
@ -87,6 +129,9 @@ public class SCANAttributesDlg extends CaveSWTDialog implements
} }
} }
/**
* Create Bottom Buttons.
*/
private void createBottomButtons() { private void createBottomButtons() {
Composite buttonComp = new Composite(shell, SWT.NONE); Composite buttonComp = new Composite(shell, SWT.NONE);
buttonComp.setLayout(new GridLayout(2, false)); buttonComp.setLayout(new GridLayout(2, false));
@ -119,6 +164,9 @@ public class SCANAttributesDlg extends CaveSWTDialog implements
}); });
} }
/**
* Update Action.
*/
private void updateAction() { private void updateAction() {
boolean[] selectedCols = new boolean[attributeChkBtns.size()]; boolean[] selectedCols = new boolean[attributeChkBtns.size()];
Arrays.fill(selectedCols, true); Arrays.fill(selectedCols, true);
@ -131,9 +179,12 @@ public class SCANAttributesDlg extends CaveSWTDialog implements
attributeUpdateCb.attributeUpdates(selectedCols); attributeUpdateCb.attributeUpdates(selectedCols);
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.commondialogs.ICommonDialogAction#closeDialog()
*/
@Override @Override
public void closeDialog() { public void closeDialog() {
shell.dispose(); close();
} }
} }

View file

@ -41,6 +41,7 @@ import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables; import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanThresholdColor; import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanThresholdColor;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase.CAVE;
/** /**
* Displays the Color threshold dialog used by CELL, DMD, MESO, and TVS. * Displays the Color threshold dialog used by CELL, DMD, MESO, and TVS.
@ -51,6 +52,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 2, 2009 #3039 lvenable Initial creation * Dec 2, 2009 #3039 lvenable Initial creation
* 24 Jul 2013 #2143 skorolev Changes non-blocking dialogs.
* *
* </pre> * </pre>
* *
@ -127,13 +129,16 @@ public class SCANColorThreshDlg extends CaveSWTDialog implements
*/ */
public SCANColorThreshDlg(Shell parentShell, ScanTables scanTable, public SCANColorThreshDlg(Shell parentShell, ScanTables scanTable,
IThresholdUpdate thresholdCB) { IThresholdUpdate thresholdCB) {
super(parentShell); super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
setText(scanTable.name() + " Color Threshold"); setText(scanTable.name() + " Color Threshold");
this.thresholdCB = thresholdCB; this.thresholdCB = thresholdCB;
this.scanTable = scanTable; this.scanTable = scanTable;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override @Override
protected Layout constructShellLayout() { protected Layout constructShellLayout() {
// Create the main layout for the shell. // Create the main layout for the shell.
@ -143,6 +148,9 @@ public class SCANColorThreshDlg extends CaveSWTDialog implements
return mainLayout; return mainLayout;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org.eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
createAttributeControls(); createAttributeControls();
@ -437,7 +445,7 @@ public class SCANColorThreshDlg extends CaveSWTDialog implements
*/ */
@Override @Override
public void closeDialog() { public void closeDialog() {
shell.dispose(); close();
} }
/** /**

View file

@ -33,177 +33,157 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Dialog; import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Monitor; import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.common.localization.IPathManager; import com.raytheon.uf.common.localization.IPathManager;
import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
* SCAN Splash.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 24 Jul 2013 #2143 skorolev Changes for non-blocking dialogs.
*
* </pre>
*
* @author
* @version 1.0
*/
public class SCANSplash extends CaveSWTDialog {
public class SCANSplash extends Dialog
{
/**
* Dialog shell.
*/
private Shell shell;
/**
* The display control.
*/
private Display display;
/** /**
* Canvas to display the information. * Canvas to display the information.
*/ */
private Canvas canvas; private Canvas canvas;
private Font textFont; private Font textFont;
/** /**
* Canvas width. * Canvas width.
*/ */
private int canvasWidth = 300; private int canvasWidth = 300;
/** /**
* Canvas height. * Canvas height.
*/ */
private int canvasHeight = 200; private int canvasHeight = 200;
private Image loadImage = null; private Image loadImage = null;
public SCANSplash(Shell parent) private Display display;
{
super(parent, 0);
open();
}
/** /**
* Open method to show the dialog. * Constructor
* @return Null. *
* @param parent
*/ */
public Object open() public SCANSplash(Shell parent) {
{ super(parent, SWT.NO_TRIM, CAVE.DO_NOT_BLOCK);
Shell parent = getParent();
display = parent.getDisplay(); }
// shell = new Shell(parent, SWT.NO_TRIM | SWT.ON_TOP);
shell = new Shell(parent, SWT.NO_TRIM); @Override
protected Layout constructShellLayout() {
// Create the main layout for the shell. // Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false); GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 0; mainLayout.marginHeight = 0;
mainLayout.marginWidth = 0; mainLayout.marginWidth = 0;
shell.setLayout(mainLayout); return mainLayout;
// Initialize all of the controls and layouts
initializeComponents();
shell.pack();
centerOnScreen();
shell.setVisible(true);
return null;
} }
private void initializeComponents() @Override
{ protected void initializeComponents(Shell parentShell) {
// Initialize all of the controls and layouts
display = shell.getDisplay();
centerOnScreen();
textFont = new Font(display, "Monospace", 50, SWT.BOLD); textFont = new Font(display, "Monospace", 50, SWT.BOLD);
String imageName = loadImage(); String imageName = loadImage();
if (imageName != null) {
if (imageName != null) loadImage = new Image(display, imageName);
{
loadImage = new Image(display, imageName);
} }
// Make the calculation for the canvas.
// makeCalculations();
// Create the canvas.
createCanvas(); createCanvas();
} }
private void createCanvas() private void createCanvas() {
{
canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED); canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
GridData gd = new GridData(SWT.DEFAULT, SWT.TOP, false, true); GridData gd = new GridData(SWT.DEFAULT, SWT.TOP, false, true);
gd.heightHint = canvasHeight; gd.heightHint = canvasHeight;
gd.widthHint = canvasWidth; gd.widthHint = canvasWidth;
canvas.setSize(canvasWidth, canvasHeight); canvas.setSize(canvasWidth, canvasHeight);
canvas.setLayoutData(gd); canvas.setLayoutData(gd);
canvas.addPaintListener(new PaintListener() canvas.addPaintListener(new PaintListener() {
{ public void paintControl(PaintEvent e) {
public void paintControl(PaintEvent e)
{
drawCanvas(e.gc); drawCanvas(e.gc);
} }
}); });
} }
private void drawCanvas(GC gc) private void drawCanvas(GC gc) {
{
gc.setFont(textFont); gc.setFont(textFont);
gc.setTextAntialias(SWT.ON); gc.setTextAntialias(SWT.ON);
if (loadImage != null) if (loadImage != null) {
{
gc.drawImage(loadImage, 0, 0); gc.drawImage(loadImage, 0, 0);
} } else {
else
{
gc.setBackground(display.getSystemColor(SWT.COLOR_BLUE)); gc.setBackground(display.getSystemColor(SWT.COLOR_BLUE));
gc.fillRectangle(0, 0, canvasWidth, canvasHeight); gc.fillRectangle(0, 0, canvasWidth, canvasHeight);
} }
gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE)); gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
gc.setLineWidth(3); gc.setLineWidth(3);
gc.drawRectangle(1, 1, canvasWidth-3, canvasHeight-3); gc.drawRectangle(1, 1, canvasWidth - 3, canvasHeight - 3);
} }
/** /**
* Center on the screen that CAVE is on. * Center on the screen that CAVE is on.
*/ */
private void centerOnScreen() private void centerOnScreen() {
{
Shell tmpShell = getParent().getShell(); Shell tmpShell = getParent().getShell();
Monitor[] monitors = getParent().getDisplay().getMonitors(); Monitor[] monitors = getParent().getDisplay().getMonitors();
int displayMonitor = 0; int displayMonitor = 0;
for (int i = 0; i < monitors.length; i++) for (int i = 0; i < monitors.length; i++) {
{
displayMonitor = i; displayMonitor = i;
int rightEdge = monitors[i].getBounds().x + monitors[i].getBounds().width; int rightEdge = monitors[i].getBounds().x
if (tmpShell.getBounds().x < rightEdge) + monitors[i].getBounds().width;
{ if (tmpShell.getBounds().x < rightEdge) {
break; break;
} }
} }
Monitor monitor = monitors[displayMonitor]; Monitor monitor = monitors[displayMonitor];
Rectangle monRect = monitor.getBounds(); Rectangle monRect = monitor.getBounds();
int xCoord = ((monRect.x + (monRect.width / 2)) - (canvasWidth / 2)); int xCoord = ((monRect.x + (monRect.width / 2)) - (canvasWidth / 2));
int yCoord = (monRect.height / 2) - (canvasHeight / 2); int yCoord = (monRect.height / 2) - (canvasHeight / 2);
shell.setLocation(xCoord, yCoord); shell.setLocation(xCoord, yCoord);
} }
private String loadImage() private String loadImage() {
{
IPathManager pm = PathManagerFactory.getPathManager(); IPathManager pm = PathManagerFactory.getPathManager();
String path = pm.getStaticFile("scan" + File.separatorChar + "images" + String path = pm.getStaticFile(
File.separatorChar + "ScanLoading.png").getAbsolutePath(); "scan" + File.separatorChar + "images" + File.separatorChar
+ "ScanLoading.png").getAbsolutePath();
return path; return path;
} }
public void disposeDialog() public void disposeDialog() {
{
textFont.dispose(); textFont.dispose();
loadImage.dispose(); loadImage.dispose();
shell.dispose(); close();
} }
} }

View file

@ -40,6 +40,7 @@ import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
import com.raytheon.uf.common.monitor.scan.config.UnwarnedConfig; import com.raytheon.uf.common.monitor.scan.config.UnwarnedConfig;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanColors; import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanColors;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase.CAVE;
/** /**
* *
@ -50,7 +51,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* SOFTWARE HISTORY * SOFTWARE HISTORY
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Oct 25, 2009 lvenable Initial creation * Oct 25, 2009 lvenable Initial creation
* 24 Jul 2013 #2143 skorolev Changes non-blocking dialogs.
* *
* </pre> * </pre>
* *
@ -151,10 +153,13 @@ public class SCANUnwarnedDlg extends CaveSWTDialog implements
* Parent shell. * Parent shell.
*/ */
public SCANUnwarnedDlg(Shell parentShell) { public SCANUnwarnedDlg(Shell parentShell) {
super(parentShell, SWT.DIALOG_TRIM, CAVE.MODE_INDEPENDENT); super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
setText("Unwarned Alarm Control"); setText("Unwarned Alarm Control");
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override @Override
protected Layout constructShellLayout() { protected Layout constructShellLayout() {
// Create the main layout for the shell. // Create the main layout for the shell.
@ -164,11 +169,17 @@ public class SCANUnwarnedDlg extends CaveSWTDialog implements
return mainLayout; return mainLayout;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override @Override
protected void disposed() { protected void disposed() {
topLabelFont.dispose(); topLabelFont.dispose();
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org.eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
setReturnValue(false); setReturnValue(false);
@ -206,8 +217,6 @@ public class SCANUnwarnedDlg extends CaveSWTDialog implements
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.horizontalSpan = 4; gd.horizontalSpan = 4;
// TODO
createInfoString(); createInfoString();
Label msgLbl = new Label(controlComp, SWT.NONE); Label msgLbl = new Label(controlComp, SWT.NONE);
msgLbl.setText(infoText.toString()); msgLbl.setText(infoText.toString());
@ -544,6 +553,9 @@ public class SCANUnwarnedDlg extends CaveSWTDialog implements
mb.open(); mb.open();
} }
/**
* Create Info String.
*/
private void createInfoString() { private void createInfoString() {
infoText = new StringBuilder(); infoText = new StringBuilder();
@ -579,6 +591,11 @@ public class SCANUnwarnedDlg extends CaveSWTDialog implements
.append("magenta for TOR warnings and yellow for SVR warnings."); .append("magenta for TOR warnings and yellow for SVR warnings.");
} }
/**
* Setup Button Mouse Listeners.
*
* @param btn
*/
private void setupButtonMouseListeners(final Button btn) { private void setupButtonMouseListeners(final Button btn) {
btn.addMouseMoveListener(new MouseMoveListener() { btn.addMouseMoveListener(new MouseMoveListener() {
@Override @Override
@ -604,8 +621,11 @@ public class SCANUnwarnedDlg extends CaveSWTDialog implements
}); });
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.commondialogs.ICommonDialogAction#closeDialog()
*/
@Override @Override
public void closeDialog() { public void closeDialog() {
shell.dispose(); close();
} }
} }

View file

@ -44,69 +44,170 @@ import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML; import com.raytheon.uf.common.monitor.scan.xml.SCANAttributesXML;
import com.raytheon.uf.common.monitor.scan.xml.SCANConfigCellXML; import com.raytheon.uf.common.monitor.scan.xml.SCANConfigCellXML;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase.CAVE;
/**
* Storm Cell ID Display Dialog
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 24 Jul 2013 #2143 skorolev Changes for non-blocking dialogs.
*
* </pre>
*
* @author
* @version 1.0
*/
public class StormCellIdDisplayDlg extends CaveSWTDialog implements public class StormCellIdDisplayDlg extends CaveSWTDialog implements
ICommonDialogAction { ICommonDialogAction {
/**
* Large Label Font
*/
private Font lrgLabelFont; private Font lrgLabelFont;
/**
* Small Label Font
*/
private Font smLabelFont; private Font smLabelFont;
/**
* High Hexagon Checkbox
*/
private Button highHexagonChk; private Button highHexagonChk;
/**
* Middle Hexagon Checkbox
*/
private Button midHexagonChk; private Button midHexagonChk;
/**
* Low Hexagon Checkbox
*/
private Button lowHexagonChk; private Button lowHexagonChk;
/**
* Future Tracks Checkbox
*/
private Button futureTracksChk; private Button futureTracksChk;
/**
* Past Traks Checkbox
*/
private Button pastTracksChk; private Button pastTracksChk;
/**
* Low Arrow Checkbox
*/
private Button lowArrowsChk; private Button lowArrowsChk;
/**
* Middle Arrow Checkbox
*/
private Button midArrowsChk; private Button midArrowsChk;
/**
* High Arrow Checkbox
*/
private Button highArrowsChk; private Button highArrowsChk;
/**
* High ID Checkbox
*/
private Button highIdsChk; private Button highIdsChk;
/**
* Middle ID Checkbox
*/
private Button midIdsChk; private Button midIdsChk;
/**
* Low ID Checkbox
*/
private Button lowIdsChk; private Button lowIdsChk;
/**
* Radius Ring Two Value Slider
*/
private TwoValueSliderCanvas radiusRngSlider; private TwoValueSliderCanvas radiusRngSlider;
/**
* Radius Interpolation Two Value Slider
*/
private TwoValueSliderCanvas radiusInterpolSlider; private TwoValueSliderCanvas radiusInterpolSlider;
/**
* Clutter Three Value Slider
*/
private ThreeValueSliderCanvas clutterSlider; private ThreeValueSliderCanvas clutterSlider;
/**
* Radius Interpolation Combo Control
*/
private Combo radInterpolCbo; private Combo radInterpolCbo;
/**
* Unit Label Width
*/
private final int unitLabelWidth = 100; private final int unitLabelWidth = 100;
/**
* Attribute Unit Map
*/
private LinkedHashMap<String, String> attrUnitMap; private LinkedHashMap<String, String> attrUnitMap;
/**
* Radius Interpolation Unit Label
*/
private Label raduisInterpolUnitLbl; private Label raduisInterpolUnitLbl;
/**
* SCAN Configuration
*/
private SCANConfig scanCfg; private SCANConfig scanCfg;
/**
* Full Shaft Checkbox
*/
private Button fullShaftChk; private Button fullShaftChk;
/**
* Conversion
*/
private Spinner conversionSpnr; private Spinner conversionSpnr;
/**
* Clutter combo control
*/
private Combo clutterThreshCbo; private Combo clutterThreshCbo;
/**
* Threshold Unit Label
*/
private Label thresholdUnitLbl; private Label thresholdUnitLbl;
private final IStormCellDisplayUpdate stormCellCB; private final IStormCellDisplayUpdate stormCellCB;
/**
* Constructor
*
* @param parentShell
* @param cb
*/
public StormCellIdDisplayDlg(Shell parentShell, IStormCellDisplayUpdate cb) { public StormCellIdDisplayDlg(Shell parentShell, IStormCellDisplayUpdate cb) {
super(parentShell); super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
setText("Storm Cell Identification Display Parameters"); setText("Storm Cell Identification Display Parameters");
stormCellCB = cb; stormCellCB = cb;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override @Override
protected Layout constructShellLayout() { protected Layout constructShellLayout() {
// Create the main layout for the shell. // Create the main layout for the shell.
@ -116,12 +217,18 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
return mainLayout; return mainLayout;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override @Override
protected void disposed() { protected void disposed() {
lrgLabelFont.dispose(); lrgLabelFont.dispose();
smLabelFont.dispose(); smLabelFont.dispose();
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org.eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
// Initialize all of the controls and layouts // Initialize all of the controls and layouts
@ -144,6 +251,9 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
clutterAction(); clutterAction();
} }
/**
* Create Symbols Controls
*/
private void createSymbolsControls() { private void createSymbolsControls() {
SCANConfigCellXML cellCfgXML = ((CellConfigMgr) scanCfg SCANConfigCellXML cellCfgXML = ((CellConfigMgr) scanCfg
.getAbsConfigMgr(ScanTables.CELL)).getScanCellCfgXML(); .getAbsConfigMgr(ScanTables.CELL)).getScanCellCfgXML();
@ -240,6 +350,9 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
} }
/**
* Create Hexagon Controls
*/
private void createHexagonControls() { private void createHexagonControls() {
SCANConfigCellXML cellCfgXML = ((CellConfigMgr) scanCfg SCANConfigCellXML cellCfgXML = ((CellConfigMgr) scanCfg
.getAbsConfigMgr(ScanTables.CELL)).getScanCellCfgXML(); .getAbsConfigMgr(ScanTables.CELL)).getScanCellCfgXML();
@ -312,6 +425,9 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
raduisInterpolUnitLbl.setLayoutData(gd); raduisInterpolUnitLbl.setLayoutData(gd);
} }
/**
* Create Arrow Controls
*/
private void createArrowControls() { private void createArrowControls() {
SCANConfigCellXML cellCfgXML = ((CellConfigMgr) scanCfg SCANConfigCellXML cellCfgXML = ((CellConfigMgr) scanCfg
.getAbsConfigMgr(ScanTables.CELL)).getScanCellCfgXML(); .getAbsConfigMgr(ScanTables.CELL)).getScanCellCfgXML();
@ -362,6 +478,9 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
conversionUnitsLbl.setLayoutData(gd); conversionUnitsLbl.setLayoutData(gd);
} }
/**
* Create Clutter Controls
*/
private void createClutterControls() { private void createClutterControls() {
SCANConfigCellXML cellCfgXML = ((CellConfigMgr) scanCfg SCANConfigCellXML cellCfgXML = ((CellConfigMgr) scanCfg
.getAbsConfigMgr(ScanTables.CELL)).getScanCellCfgXML(); .getAbsConfigMgr(ScanTables.CELL)).getScanCellCfgXML();
@ -409,6 +528,9 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
thresholdUnitLbl.setLayoutData(gd); thresholdUnitLbl.setLayoutData(gd);
} }
/**
* Create Bottom Buttons
*/
private void createBottomButtons() { private void createBottomButtons() {
Composite buttonComp = new Composite(shell, SWT.NONE); Composite buttonComp = new Composite(shell, SWT.NONE);
buttonComp.setLayout(new GridLayout(3, true)); buttonComp.setLayout(new GridLayout(3, true));
@ -453,6 +575,11 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
}); });
} }
/**
* Populate Attribute Combo Box
*
* @param cellCfgXML
*/
private void populateAttributeCombo(SCANConfigCellXML cellCfgXML) { private void populateAttributeCombo(SCANConfigCellXML cellCfgXML) {
Set<String> keys = attrUnitMap.keySet(); Set<String> keys = attrUnitMap.keySet();
@ -467,6 +594,11 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
radInterpolCbo.select(index); radInterpolCbo.select(index);
} }
/**
* Populate Clutter Combo Box
*
* @param cellCfgXML
*/
private void populateClutterCombo(SCANConfigCellXML cellCfgXML) { private void populateClutterCombo(SCANConfigCellXML cellCfgXML) {
Set<String> keys = attrUnitMap.keySet(); Set<String> keys = attrUnitMap.keySet();
@ -481,6 +613,11 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
clutterThreshCbo.select(index); clutterThreshCbo.select(index);
} }
/**
* Radius Interpolation Action
*
* @param startup
*/
private void radiusInterpolationAction(boolean startup) { private void radiusInterpolationAction(boolean startup) {
String attribute = radInterpolCbo.getItem(radInterpolCbo String attribute = radInterpolCbo.getItem(radInterpolCbo
.getSelectionIndex()); .getSelectionIndex());
@ -550,6 +687,9 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
} }
} }
/**
* Clutter Action
*/
private void clutterAction() { private void clutterAction() {
String attribute = clutterThreshCbo.getItem(clutterThreshCbo String attribute = clutterThreshCbo.getItem(clutterThreshCbo
.getSelectionIndex()); .getSelectionIndex());
@ -609,6 +749,12 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
} }
} }
/**
* Get Increment
*
* @param attribute
* @return
*/
private double getIncrement(String attribute) { private double getIncrement(String attribute) {
if (CELLTable.HSIZE.getColName().compareTo(attribute) == 0) { if (CELLTable.HSIZE.getColName().compareTo(attribute) == 0) {
return 0.25; return 0.25;
@ -619,6 +765,11 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
return 1.0; return 1.0;
} }
/**
* Add Separator
*
* @param parentComp
*/
private void addSeparator(Composite parentComp) { private void addSeparator(Composite parentComp) {
GridLayout gl = (GridLayout) parentComp.getLayout(); GridLayout gl = (GridLayout) parentComp.getLayout();
@ -628,6 +779,9 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
sepLbl.setLayoutData(gd); sepLbl.setLayoutData(gd);
} }
/**
* Apply Action
*/
private void applyAction() { private void applyAction() {
/* /*
* TODO : set all of the configuration variables * TODO : set all of the configuration variables
@ -690,9 +844,12 @@ public class StormCellIdDisplayDlg extends CaveSWTDialog implements
stormCellCB.stormCellUpdated(); stormCellCB.stormCellUpdated();
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.commondialogs.ICommonDialogAction#closeDialog()
*/
@Override @Override
public void closeDialog() { public void closeDialog() {
shell.dispose(); close();
} }
/** /**

View file

@ -41,6 +41,8 @@ import com.raytheon.uf.common.monitor.scan.config.SCANConfig;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums; import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums;
import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables; import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase.CAVE;
/** /**
* Time-Height Graph dialog. * Time-Height Graph dialog.
@ -53,7 +55,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Mar 10, 2010 lvenable Initial creation * Mar 10, 2010 lvenable Initial creation
* Dec 23, 2011 13608 mgamazay Updated populateIdentCombo so the drop down menu * Dec 23, 2011 13608 mgamazay Updated populateIdentCombo so the drop down menu
* shows the current feature ident instead of being blank. * shows the current feature ident instead of being blank.
* * 24 Jul 2013 #2143 skorolev Changes for non-blocking dialogs.
*
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -158,7 +161,7 @@ public class TimeHeightDlg extends CaveSWTDialog implements ITimeHeightInfo {
*/ */
public TimeHeightDlg(Shell parentShell, ScanTables scanTable, String ident, String attrName, String[] identArray, public TimeHeightDlg(Shell parentShell, ScanTables scanTable, String ident, String attrName, String[] identArray,
TreeMap<Long, DMDTableDataRow> graphData, IRequestTimeHeightData timeHeightCB) { TreeMap<Long, DMDTableDataRow> graphData, IRequestTimeHeightData timeHeightCB) {
super(parentShell, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK | CAVE.INDEPENDENT_SHELL); super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
setText("DMD Time-Height Trend"); setText("DMD Time-Height Trend");
this.scanTable = scanTable; this.scanTable = scanTable;
@ -169,11 +172,17 @@ public class TimeHeightDlg extends CaveSWTDialog implements ITimeHeightInfo {
this.timeHeightCB = timeHeightCB; this.timeHeightCB = timeHeightCB;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override @Override
protected Layout constructShellLayout() { protected Layout constructShellLayout() {
return new GridLayout(1, false); return new GridLayout(1, false);
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org.eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
createTopControls(); createTopControls();
@ -278,7 +287,7 @@ public class TimeHeightDlg extends CaveSWTDialog implements ITimeHeightInfo {
closeBtn.addSelectionListener(new SelectionAdapter() { closeBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
shell.dispose(); close();
} }
}); });
} }
@ -418,13 +427,26 @@ public class TimeHeightDlg extends CaveSWTDialog implements ITimeHeightInfo {
* is no longer valid. * is no longer valid.
*/ */
public void displayMessage() { public void displayMessage() {
if (this.msgBox == null) { if (this.msgBox == null || msgBox.isDisposed()) {
msgBox = new TimeHeightMsgBox(getShell(), this.ident); msgBox = new TimeHeightMsgBox(getShell(), this.ident);
Object action = msgBox.open(); msgBox.setCloseCallback(new ICloseCallback(){
if (action.toString().equalsIgnoreCase("OK")) {
shell.dispose(); @Override
} public void dialogClosed(Object returnValue) {
msgBox = null; if (returnValue instanceof String) {
if (returnValue.equals("OK")) {
close();
}else{
return;
}
}
msgBox = null;
}
});
msgBox.open();
}else{
msgBox.bringToTop();
} }
} }

View file

@ -44,6 +44,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 25, 2011 mpduff Initial creation * Apr 25, 2011 mpduff Initial creation
* Dec 23, 2011 13608 mgamazay Added initialization of ident to the constructor * Dec 23, 2011 13608 mgamazay Added initialization of ident to the constructor
* 24 Jul 2013 #2143 skorolev Changes for non-blocking dialogs.
* *
* </pre> * </pre>
* *
@ -64,18 +65,24 @@ public class TimeHeightMsgBox extends CaveSWTDialog implements
* @param swtStyle * @param swtStyle
*/ */
protected TimeHeightMsgBox(Shell parentShell, String ident) { protected TimeHeightMsgBox(Shell parentShell, String ident) {
super(parentShell, SWT.DIALOG_TRIM | SWT.MODELESS); super(parentShell, SWT.DIALOG_TRIM | SWT.MODELESS, CAVE.DO_NOT_BLOCK);
setText("Unavailable T-H Trend"); setText("Unavailable T-H Trend");
this.ident = ident; this.ident = ident;
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org.eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
createMessage(); createMessage();
createButtons(); createButtons();
} }
/**
* Create Message.
*/
private void createMessage() { private void createMessage() {
Image img = Display.getCurrent().getSystemImage(SWT.ICON_QUESTION); Image img = Display.getCurrent().getSystemImage(SWT.ICON_QUESTION);
@ -94,6 +101,9 @@ public class TimeHeightMsgBox extends CaveSWTDialog implements
msgLabel.setText(msg); msgLabel.setText(msg);
} }
/**
* Create Buttons.
*/
private void createButtons() { private void createButtons() {
Composite buttonComp = new Composite(shell, SWT.NONE); Composite buttonComp = new Composite(shell, SWT.NONE);
buttonComp.setLayout(new GridLayout(2, false)); buttonComp.setLayout(new GridLayout(2, false));
@ -129,8 +139,11 @@ public class TimeHeightMsgBox extends CaveSWTDialog implements
}); });
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.commondialogs.ICommonDialogAction#closeDialog()
*/
@Override @Override
public void closeDialog() { public void closeDialog() {
shell.dispose(); close();
} }
} }

View file

@ -153,7 +153,7 @@ public class TrendGraphDlg extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() { closeBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
shell.dispose(); close();
} }
}); });
} }

View file

@ -179,7 +179,7 @@ public class TrendSetsGraphDlg extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() { closeBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
shell.dispose(); close();
} }
}); });
} }

View file

@ -29,8 +29,6 @@ import java.util.Timer;
import java.util.TimerTask; import java.util.TimerTask;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener; import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.MouseTrackAdapter; import org.eclipse.swt.events.MouseTrackAdapter;
@ -40,8 +38,8 @@ import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.MessageBox;
@ -65,6 +63,8 @@ import com.raytheon.uf.viz.monitor.scan.commondialogs.ICommonDialogAction;
import com.raytheon.uf.viz.monitor.scan.commondialogs.IRequestTrendGraphData; import com.raytheon.uf.viz.monitor.scan.commondialogs.IRequestTrendGraphData;
import com.raytheon.uf.viz.monitor.scan.commondialogs.LoadSaveConfigDlg; import com.raytheon.uf.viz.monitor.scan.commondialogs.LoadSaveConfigDlg;
import com.raytheon.uf.viz.monitor.scan.commondialogs.LoadSaveConfigDlg.DialogType; import com.raytheon.uf.viz.monitor.scan.commondialogs.LoadSaveConfigDlg.DialogType;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/** /**
* Abstract dialog class used for the CALL, DND, MESO, and TVS table dialogs. * Abstract dialog class used for the CALL, DND, MESO, and TVS table dialogs.
@ -79,24 +79,20 @@ import com.raytheon.uf.viz.monitor.scan.commondialogs.LoadSaveConfigDlg.DialogTy
* 06 Jun 2013 #2065 lvenable Added convenience method to alert the user to use the clear * 06 Jun 2013 #2065 lvenable Added convenience method to alert the user to use the clear
* button if they want to close the dialog. * button if they want to close the dialog.
* Jul 24, 2013 #2218 mpduff Changed method signature. * Jul 24, 2013 #2218 mpduff Changed method signature.
* Jul 26, 2013 #2143 skorolev Changes for non-blocking dialog.
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
* @version 1.0 * @version 1.0
*/ */
public abstract class AbstractTableDlg extends Dialog implements IMonitor, public abstract class AbstractTableDlg extends CaveSWTDialog implements
IMonitorListener, IMonitorControlListener, ITableAction, IMonitor, IMonitorListener, IMonitorControlListener, ITableAction,
IRequestTrendGraphData { IRequestTrendGraphData {
/** /**
* The display object. * The display object.
*/ */
protected Display display; protected Display display;
/**
* Shell object.
*/
protected Shell shell;
/** /**
* Array listening monitors * Array listening monitors
*/ */
@ -144,6 +140,10 @@ public abstract class AbstractTableDlg extends Dialog implements IMonitor,
protected SCANAlarmAlertManager mgr = null; protected SCANAlarmAlertManager mgr = null;
private LoadSaveConfigDlg loadDlg = null;
private LoadSaveConfigDlg saveDlg = null;
/** /**
* Abstract constructor. * Abstract constructor.
* *
@ -151,36 +151,47 @@ public abstract class AbstractTableDlg extends Dialog implements IMonitor,
* Parent shell. * Parent shell.
*/ */
public AbstractTableDlg(Shell parentShell) { public AbstractTableDlg(Shell parentShell) {
super(parentShell); super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
scanCfg = SCANConfig.getInstance(); scanCfg = SCANConfig.getInstance();
} }
/** /*
* Open the dialog. * (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/ */
protected void open() { @Override
Shell parent = getParent(); protected Layout constructShellLayout() {
display = parent.getDisplay();
/*
* The shell is being created off of the display
*/
shell = new Shell(display, SWT.DIALOG_TRIM | SWT.RESIZE);
parent.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
shell.dispose();
}
});
GridLayout mainLayout = new GridLayout(1, false); GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 0; mainLayout.marginHeight = 0;
mainLayout.marginWidth = 2; mainLayout.marginWidth = 2;
mainLayout.verticalSpacing = 2; mainLayout.verticalSpacing = 2;
shell.setLayout(mainLayout); return (mainLayout);
shell.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false)); }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayoutData()
*/
@Override
protected Object constructShellLayoutData() {
return new GridData(SWT.FILL, SWT.DEFAULT, true, false);
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override
protected void initializeComponents(Shell parentShell) {
display = shell.getDisplay();
initData(); initData();
setShellText(); setShellText();
@ -188,9 +199,6 @@ public abstract class AbstractTableDlg extends Dialog implements IMonitor,
setTableType(); setTableType();
initComponents(); initComponents();
shellDisposeAction(); shellDisposeAction();
shell.pack();
shell.setVisible(true);
} }
/** /**
@ -298,21 +306,26 @@ public abstract class AbstractTableDlg extends Dialog implements IMonitor,
return; return;
} }
LoadSaveConfigDlg loadDlg = new LoadSaveConfigDlg(shell, if (loadDlg == null || loadDlg.isDisposed()) {
DialogType.OPEN, scanTable); loadDlg = new LoadSaveConfigDlg(shell, DialogType.OPEN, scanTable);
LocalizationFile fileName = (LocalizationFile) loadDlg.open(); loadDlg.setCloseCallback(new ICloseCallback() {
@Override
if (fileName == null) { public void dialogClosed(Object returnValue) {
System.out.println("FileName is null..."); if (returnValue instanceof LocalizationFile) {
return; LocalizationFile fileName = (LocalizationFile) returnValue;
scanCfg.loadNewConfigFileName(scanTable, fileName
.getFile().getName());
updateAfterConfigLoad();
updateFileButton();
} else {
return;
}
}
});
loadDlg.open();
} else {
loadDlg.bringToTop();
} }
scanCfg.loadNewConfigFileName(scanTable, fileName.getFile().getName());
System.out.println(fileName.getFile().getAbsolutePath());
updateAfterConfigLoad();
updateFileButton();
} }
/** /**
@ -359,34 +372,41 @@ public abstract class AbstractTableDlg extends Dialog implements IMonitor,
* *
* do not need to update the display... * do not need to update the display...
*/ */
String defCfgName = scanCfg.getDefaultConfigName(scanTable); if (saveDlg == null || saveDlg.isDisposed()) {
saveDlg = new LoadSaveConfigDlg(shell, DialogType.SAVE_AS,
scanTable);
saveDlg.setCloseCallback(new ICloseCallback() {
LoadSaveConfigDlg loadDlg = new LoadSaveConfigDlg(shell, @Override
DialogType.SAVE_AS, scanTable); public void dialogClosed(Object returnValue) {
LocalizationFile fileName = (LocalizationFile) loadDlg.open(); if (returnValue instanceof LocalizationFile) {
String defCfgName = scanCfg
.getDefaultConfigName(scanTable);
LocalizationFile fileName = (LocalizationFile) returnValue;
if (defCfgName.compareTo(fileName.getFile().getName()) == 0) {
MessageBox mb = new MessageBox(shell,
SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
mb.setText("Overwrite");
mb.setMessage("The Save As name is the same as the default configuration name. Saving "
+ "will overwrite the default configuration.\n"
+ "Do you wish to continue?");
int result = mb.open();
if (fileName == null) { // If the user selected Cancel then return.
System.out.println("FileName is null..."); if (result == SWT.CANCEL) {
return; return;
}
}
scanCfg.saveConfigurationFileAs(scanTable, fileName
.getFile().getName());
}
updateFileButton();
}
});
saveDlg.open();
} else {
saveDlg.bringToTop();
} }
if (defCfgName.compareTo(fileName.getFile().getName()) == 0) {
MessageBox mb = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK
| SWT.CANCEL);
mb.setText("Overwrite");
mb.setMessage("The Save As name is the same as the default configuration name. Saving "
+ "will overwrite the default configuration.\n"
+ "Do you wish to continue?");
int result = mb.open();
// If the user selected Cancel then return.
if (result == SWT.CANCEL) {
return;
}
}
scanCfg.saveConfigurationFileAs(scanTable, fileName.getFile().getName());
updateFileButton();
} }
protected void resetButtonForegroundColor(Button btn) { protected void resetButtonForegroundColor(Button btn) {

View file

@ -47,9 +47,10 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Dec 2, 2010 mnash Initial creation * Dec 2, 2010 mnash Initial creation
* *
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue * 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
* 24 Jul 2013 #2143 skorolev Changes for non-blocking dialog.
* *
* </pre> * </pre>
* *
@ -59,30 +60,56 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
public class SCANAlarmsDlg extends CaveSWTDialog { public class SCANAlarmsDlg extends CaveSWTDialog {
/**
* Scrolled Composite
*/
private ScrolledComposite sc; private ScrolledComposite sc;
/**
* Button Composite
*/
private Composite btnComp; private Composite btnComp;
/**
* Button Width
*/
private int buttonWidth = 150; private int buttonWidth = 150;
/**
* SCAN Alarm Alert Manager
*/
private SCANAlarmAlertManager mgr; private SCANAlarmAlertManager mgr;
/**
* SCAN Tables
*/
private ScanTables type; private ScanTables type;
/**
* Clear All Button
*/
private Button clearAllBtn; private Button clearAllBtn;
/**
* Site
*/
private String site; private String site;
/** /**
* Constructor
*
* @param parentShell * @param parentShell
*/ */
protected SCANAlarmsDlg(Shell parentShell, ScanTables scanTable, String site) { protected SCANAlarmsDlg(Shell parentShell, ScanTables scanTable, String site) {
super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE); super(parentShell, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
this.site = site; this.site = site;
type = scanTable; type = scanTable;
mgr = SCANAlarmAlertManager.getInstance(site); mgr = SCANAlarmAlertManager.getInstance(site);
} }
/* (non-Javadoc)
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org.eclipse.swt.widgets.Shell)
*/
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
if (type == ScanTables.CELL) { if (type == ScanTables.CELL) {
@ -96,6 +123,11 @@ public class SCANAlarmsDlg extends CaveSWTDialog {
createClearAllButton(shell); createClearAllButton(shell);
} }
/**
* Create Alarm Buttons.
*
* @param shell
*/
private void createAlarmButtons(final Shell shell) { private void createAlarmButtons(final Shell shell) {
Composite comp = new Composite(shell, SWT.NONE); Composite comp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(1, false); GridLayout gl = new GridLayout(1, false);
@ -168,7 +200,7 @@ public class SCANAlarmsDlg extends CaveSWTDialog {
btn.dispose(); btn.dispose();
btnComp.layout(); btnComp.layout();
if (mgr.getAlertedAlarms(site, type).size() <= 0) { if (mgr.getAlertedAlarms(site, type).size() <= 0) {
shell.dispose(); close();
} }
} }
}); });
@ -190,6 +222,11 @@ public class SCANAlarmsDlg extends CaveSWTDialog {
sc.layout(); sc.layout();
} }
/**
* Create "Clear All" Button
*
* @param shell
*/
private void createClearAllButton(final Shell shell) { private void createClearAllButton(final Shell shell) {
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gd.widthHint = buttonWidth + 30; gd.widthHint = buttonWidth + 30;
@ -208,12 +245,8 @@ public class SCANAlarmsDlg extends CaveSWTDialog {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
mgr.clearAlertedAlarms(site, type); mgr.clearAlertedAlarms(site, type);
shell.dispose(); close();
} }
}); });
} }
public void closeDisplay() {
shell.dispose();
}
} }

View file

@ -76,6 +76,7 @@ import com.raytheon.uf.viz.monitor.scan.data.UnwarnedCell;
import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlarmType; import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlarmType;
import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlertedAlarms; import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlertedAlarms;
import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/** /**
* This class displays the CELL table dialog. * This class displays the CELL table dialog.
@ -92,7 +93,8 @@ import com.raytheon.viz.ui.EditorUtil;
* some bad code, and some code cleanup. * some bad code, and some code cleanup.
* 06 Jun 2013 #2065 lvenable Added code to alert the user to use the clear * 06 Jun 2013 #2065 lvenable Added code to alert the user to use the clear
* button if they want to close the dialog. * button if they want to close the dialog.
* Jul 24, 2013 2218 mpduff Method signature changed. * Jul 24, 2013 #2218 mpduff Method signature changed.
* Jul 26, 2013 #2143 skorolev Changes for non-blocking dialogs.
* *
* </pre> * </pre>
* *
@ -488,11 +490,22 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
alarmBtn.addSelectionListener(new SelectionAdapter() { alarmBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
if(alarmDlg==null || alarmDlg.isDisposed()){
alarmDlg = new SCANAlarmsDlg(shell, ScanTables.CELL, site); alarmDlg = new SCANAlarmsDlg(shell, ScanTables.CELL, site);
alarmDlg.setCloseCallback(new ICloseCallback(){
@Override
public void dialogClosed(Object returnValue) {
if (!alarmBtn.isDisposed()
&& (mgr.getAlertedAlarmCount(site, scanTable) == 0)) {
turnOffAlarm();
}
}
});
alarmDlg.open(); alarmDlg.open();
if (!alarmBtn.isDisposed() } else {
&& (mgr.getAlertedAlarmCount(site, scanTable) == 0)) { alarmDlg.bringToTop();
turnOffAlarm();
} }
} }
}); });
@ -755,13 +768,22 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
* Display the Attributes dialog. * Display the Attributes dialog.
*/ */
private void displayAttributesDialog() { private void displayAttributesDialog() {
if ((attributeDlg == null) if (attributeDlg == null
|| (attributeDlg.getParent().isDisposed() == true)) { || attributeDlg.getParent().isDisposed() == true) {
attributeDlg = new SCANAttributesDlg(shell, scanTable, this); attributeDlg = new SCANAttributesDlg(shell, scanTable, this);
attributeDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(attributeDlg);
attributeDlg = null;
}
});
registerDialog(attributeDlg); registerDialog(attributeDlg);
attributeDlg.open(); attributeDlg.open();
attributeDlg = null; } else {
unregisterDialog(attributeDlg); attributeDlg.bringToTop();
} }
} }
@ -771,10 +793,19 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
private void displayColorThresholdDialog() { private void displayColorThresholdDialog() {
if (colorThresholdDlg == null) { if (colorThresholdDlg == null) {
colorThresholdDlg = new SCANColorThreshDlg(shell, scanTable, this); colorThresholdDlg = new SCANColorThreshDlg(shell, scanTable, this);
colorThresholdDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(colorThresholdDlg);
colorThresholdDlg = null;
}
});
registerDialog(colorThresholdDlg); registerDialog(colorThresholdDlg);
colorThresholdDlg.open(); colorThresholdDlg.open();
unregisterDialog(colorThresholdDlg); } else {
colorThresholdDlg = null; colorThresholdDlg.bringToTop();
} }
} }
@ -782,12 +813,21 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
* Display the Storm Cell dialog. * Display the Storm Cell dialog.
*/ */
private void displayStormCellDialog() { private void displayStormCellDialog() {
if (scidDlg == null) { if (scidDlg == null || scidDlg.isDisposed()) {
scidDlg = new StormCellIdDisplayDlg(shell, this); scidDlg = new StormCellIdDisplayDlg(shell, this);
scidDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(scidDlg);
scidDlg = null;
}
});
registerDialog(scidDlg); registerDialog(scidDlg);
scidDlg.open(); scidDlg.open();
unregisterDialog(scidDlg); } else {
scidDlg = null; scidDlg.bringToTop();
} }
} }
@ -795,12 +835,21 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
* Display the Alarm threshold dialog. * Display the Alarm threshold dialog.
*/ */
private void displayAlarmThresholdDialog() { private void displayAlarmThresholdDialog() {
if (alarmThreshDlg == null) { if (alarmThreshDlg == null || alarmThreshDlg.isDisposed()) {
alarmThreshDlg = new SCANAlarmThreshDlg(site, shell, scanTable); alarmThreshDlg = new SCANAlarmThreshDlg(site, shell, scanTable);
alarmThreshDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(alarmThreshDlg);
alarmThreshDlg = null;
}
});
registerDialog(alarmThreshDlg); registerDialog(alarmThreshDlg);
alarmThreshDlg.open(); alarmThreshDlg.open();
unregisterDialog(alarmThreshDlg);
alarmThreshDlg = null; } else {
alarmThreshDlg.bringToTop();
} }
} }
@ -808,13 +857,22 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
* Display the Alarm Time Limit dialog. * Display the Alarm Time Limit dialog.
*/ */
private void displayAlarmTimeLimitDialog() { private void displayAlarmTimeLimitDialog() {
if (alarmTimeLimitDlg == null) { if (alarmTimeLimitDlg == null || alarmTimeLimitDlg.isDisposed()) {
alarmTimeLimitDlg = new SCANAlarmTimeLimitDlg(shell, scanTable, alarmTimeLimitDlg = new SCANAlarmTimeLimitDlg(shell, scanTable,
this.site); this.site);
alarmTimeLimitDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(alarmTimeLimitDlg);
alarmTimeLimitDlg = null;
}
});
registerDialog(alarmTimeLimitDlg); registerDialog(alarmTimeLimitDlg);
alarmTimeLimitDlg.open(); alarmTimeLimitDlg.open();
unregisterDialog(alarmTimeLimitDlg); } else {
alarmTimeLimitDlg = null; alarmTimeLimitDlg.bringToTop();
} }
} }
@ -822,36 +880,50 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
* Display the Unwarned Alarm dialog. * Display the Unwarned Alarm dialog.
*/ */
private void displayUnwarnedAlarmDialog() { private void displayUnwarnedAlarmDialog() {
if (unwarnedAlarmDlg == null) { if (unwarnedAlarmDlg == null || unwarnedAlarmDlg.isDisposed()) {
unwarnedAlarmDlg = new SCANUnwarnedDlg(shell); unwarnedAlarmDlg = new SCANUnwarnedDlg(shell);
registerDialog(unwarnedAlarmDlg); unwarnedAlarmDlg.setCloseCallback(new ICloseCallback() {
Boolean okSelected = (Boolean) unwarnedAlarmDlg.open();
// The check box is a toggle... so capture the toggled state. @Override
Boolean isEnabled = unwarnedChk.getEnabled(); public void dialogClosed(Object returnValue) {
// The check box is a toggle... so capture the toggled
// state.
Boolean isEnabled = unwarnedChk.getEnabled();
if (returnValue instanceof Boolean) {
Boolean okSelected = (Boolean) returnValue;
if (okSelected) {
if ((scanCfg.getUnwarnedConfig().getUnwarnedTor() == false)
&& (scanCfg.getUnwarnedConfig()
.getUnwarnedSvr() == false)) {
unwarnedChk.setSelection(false);
} else {
unwarnedChk.setSelection(true);
}
} else if ((scanCfg.getUnwarnedConfig()
.getUnwarnedTor() == true)
&& (scanCfg.getUnwarnedConfig()
.getUnwarnedSvr() == true)) {
unwarnedChk.setSelection(true);
} else {
// If the checkbox should not change state, reverse
// the effect
// of the toggle behavior inherent to the checkbox.
unwarnedChk.setSelection(!isEnabled);
}
}
unregisterDialog(unwarnedAlarmDlg);
unwarnedAlarmDlg = null;
if (okSelected == true) { IMonitorConfigurationEvent imce = new IMonitorConfigurationEvent(
if ((scanCfg.getUnwarnedConfig().getUnwarnedTor() == false) SCANCellTableDlg.this);
&& (scanCfg.getUnwarnedConfig().getUnwarnedSvr() == false)) { SCANCellTableDlg.this.fireConfigUpdate(imce);
unwarnedChk.setSelection(false);
} else {
unwarnedChk.setSelection(true);
} }
} else if ((scanCfg.getUnwarnedConfig().getUnwarnedTor() == true) });
&& (scanCfg.getUnwarnedConfig().getUnwarnedSvr() == true)) {
unwarnedChk.setSelection(true);
} else {
// If the checkbox should not change state, reverse the effect
// of the toggle behavior inherent to the checkbox.
unwarnedChk.setSelection(!isEnabled);
}
unwarnedAlarmDlg = null; registerDialog(unwarnedAlarmDlg);
unregisterDialog(unwarnedAlarmDlg); unwarnedAlarmDlg.open();
} else {
IMonitorConfigurationEvent imce = new IMonitorConfigurationEvent( unwarnedAlarmDlg.bringToTop();
this);
this.fireConfigUpdate(imce);
} }
} }
@ -859,13 +931,21 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
* Display the Create and Edit Trend Set dialog. * Display the Create and Edit Trend Set dialog.
*/ */
private void displayCreateEditTrendDialog() { private void displayCreateEditTrendDialog() {
if (editTrendDlg == null) { if (editTrendDlg == null || editTrendDlg.isDisposed()) {
editTrendDlg = new EditCreateTrendDlg(shell, scanTable); editTrendDlg = new EditCreateTrendDlg(shell, scanTable);
editTrendDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
updateDefineActiveTrendMenu();
editTrendDlg = null;
unregisterDialog(editTrendDlg);
}
});
registerDialog(editTrendDlg); registerDialog(editTrendDlg);
editTrendDlg.open(); editTrendDlg.open();
updateDefineActiveTrendMenu(); } else {
editTrendDlg = null; editTrendDlg.bringToTop();
unregisterDialog(editTrendDlg);
} }
} }
@ -1010,7 +1090,7 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
@Override @Override
public void shellDisposeDialog() { public void shellDisposeDialog() {
killDialog = true; killDialog = true;
shell.dispose(); close();
} }
/** /**
@ -1223,6 +1303,9 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
// nop op // nop op
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.ITableAction#centerByStormId(java.lang.String)
*/
@Override @Override
public void centerByStormId(String stormId) { public void centerByStormId(String stormId) {
fireRecenter(stormId, scanTable, site); fireRecenter(stormId, scanTable, site);
@ -1280,6 +1363,12 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
} }
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#
* displayTrendSetGraphs(java.lang.String)
*/
@Override @Override
public void displayTrendSetGraphs(String ident) { public void displayTrendSetGraphs(String ident) {
scanTableComp.displayTrendSetGraphFromMap(ident); scanTableComp.displayTrendSetGraphFromMap(ident);

View file

@ -59,6 +59,7 @@ import com.raytheon.uf.viz.monitor.scan.commondialogs.TimeHeightDlg;
* Jun 04, 2013 #1984 lvenable Save images instead of disposing them when setting * Jun 04, 2013 #1984 lvenable Save images instead of disposing them when setting
* the table column images. This is to fix the Windows * the table column images. This is to fix the Windows
* issue on the images being blank and throwing errors. * issue on the images being blank and throwing errors.
* Jul 30, 2013 #2143 skorolev Changes for non-blocking dialogs.
* </pre> * </pre>
* *
* @author lvenable * @author lvenable
@ -278,6 +279,7 @@ public class SCANDmdTableComp extends SCANTableTrendGraphLayer implements
timeHeightDlg.open(); timeHeightDlg.open();
} else { } else {
timeHeightDlg.setGraphData(graphData, ident, attrName); timeHeightDlg.setGraphData(graphData, ident, attrName);
timeHeightDlg.bringToTop();
} }
} }

View file

@ -77,6 +77,7 @@ import com.raytheon.uf.viz.monitor.scan.commondialogs.SCANColorThreshDlg;
import com.raytheon.uf.viz.monitor.scan.data.ScanDataGenerator; import com.raytheon.uf.viz.monitor.scan.data.ScanDataGenerator;
import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlarmType; import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlarmType;
import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/** /**
* Main dialog for the SCAN DMD table. * Main dialog for the SCAN DMD table.
@ -94,6 +95,7 @@ import com.raytheon.viz.ui.EditorUtil;
* 06 Jun 2013 #2065 lvenable Added code to alert the user to use the clear * 06 Jun 2013 #2065 lvenable Added code to alert the user to use the clear
* button if they want to close the dialog. * button if they want to close the dialog.
* Jul 24, 2013 2218 mpduff Change method signature. * Jul 24, 2013 2218 mpduff Change method signature.
* Jul 26, 2013 #2143 skorolev Changes for non-blocking dialogs.
* *
* </pre> * </pre>
* *
@ -517,15 +519,24 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
alarmBtn.addSelectionListener(new SelectionAdapter() { alarmBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
if ((alarmsDlg != null) && alarmsDlg.isOpen()) { if(alarmsDlg==null || alarmsDlg.isDisposed()){
alarmsDlg = new SCANAlarmsDlg(shell, ScanTables.DMD, site);
alarmsDlg.setCloseCallback(new ICloseCallback(){
@Override
public void dialogClosed(Object returnValue) {
if (!alarmBtn.isDisposed()
&& mgr.getAlertedAlarms(site, scanTable).isEmpty()) {
turnOffAlarm();
}
}
});
alarmsDlg.open();
} else {
alarmsDlg.close(); alarmsDlg.close();
} }
alarmsDlg = new SCANAlarmsDlg(shell, ScanTables.DMD, site);
alarmsDlg.open();
if (!alarmBtn.isDisposed()
&& mgr.getAlertedAlarms(site, scanTable).isEmpty()) {
turnOffAlarm();
}
} }
}); });
@ -690,13 +701,21 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
* Display the Create/Edit trend dialog. * Display the Create/Edit trend dialog.
*/ */
private void displayCreateEditTrendDialog() { private void displayCreateEditTrendDialog() {
if (editTrendDlg == null) { if (editTrendDlg == null || editTrendDlg.isDisposed()) {
editTrendDlg = new EditCreateTrendDlg(shell, scanTable); editTrendDlg = new EditCreateTrendDlg(shell, scanTable);
editTrendDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
updateDefineActiveTrendMenu();
unregisterDialog(editTrendDlg);
editTrendDlg = null;
}
});
registerDialog(editTrendDlg); registerDialog(editTrendDlg);
editTrendDlg.open(); editTrendDlg.open();
updateDefineActiveTrendMenu(); } else {
unregisterDialog(editTrendDlg); editTrendDlg.bringToTop();
editTrendDlg = null;
} }
} }
@ -707,10 +726,19 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
if (alarmTimeLimitDlg == null) { if (alarmTimeLimitDlg == null) {
alarmTimeLimitDlg = new SCANAlarmTimeLimitDlg(shell, scanTable, alarmTimeLimitDlg = new SCANAlarmTimeLimitDlg(shell, scanTable,
this.site); this.site);
alarmTimeLimitDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(alarmTimeLimitDlg);
alarmTimeLimitDlg = null;
}
});
registerDialog(alarmTimeLimitDlg); registerDialog(alarmTimeLimitDlg);
alarmTimeLimitDlg.open(); alarmTimeLimitDlg.open();
unregisterDialog(alarmTimeLimitDlg); } else {
alarmTimeLimitDlg = null; alarmTimeLimitDlg.bringToTop();
} }
} }
@ -720,10 +748,18 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
private void displayAlarmThresholdDialog() { private void displayAlarmThresholdDialog() {
if (alarmThreshDlg == null) { if (alarmThreshDlg == null) {
alarmThreshDlg = new SCANAlarmThreshDlg(site, shell, scanTable); alarmThreshDlg = new SCANAlarmThreshDlg(site, shell, scanTable);
alarmThreshDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(alarmThreshDlg);
alarmThreshDlg = null;
}
});
registerDialog(alarmThreshDlg); registerDialog(alarmThreshDlg);
alarmThreshDlg.open(); alarmThreshDlg.open();
unregisterDialog(alarmThreshDlg); } else {
alarmThreshDlg = null; alarmThreshDlg.bringToTop();
} }
} }
@ -731,12 +767,20 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
* Display the filter dialog. * Display the filter dialog.
*/ */
private void displayFilterDialog() { private void displayFilterDialog() {
if (displayFilterDlg == null) { if (displayFilterDlg == null || displayFilterDlg.isDisposed()) {
displayFilterDlg = new DmdDisplayFilterDlg(shell, this); displayFilterDlg = new DmdDisplayFilterDlg(shell, this);
displayFilterDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(displayFilterDlg);
displayFilterDlg = null;
}
});
registerDialog(displayFilterDlg); registerDialog(displayFilterDlg);
displayFilterDlg.open(); displayFilterDlg.open();
unregisterDialog(displayFilterDlg); } else {
displayFilterDlg = null; displayFilterDlg.bringToTop();
} }
} }
@ -861,13 +905,22 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
* Display the attributes dialog. * Display the attributes dialog.
*/ */
private void displayAttributesDialog() { private void displayAttributesDialog() {
if ((attributeDlg == null) if ((attributeDlg == null || attributeDlg.isDisposed())
|| (attributeDlg.getParent().isDisposed() == true)) { || (attributeDlg.getParent().isDisposed() == true)) {
attributeDlg = new SCANAttributesDlg(shell, scanTable, this); attributeDlg = new SCANAttributesDlg(shell, scanTable, this);
attributeDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(attributeDlg);
attributeDlg = null;
}
});
registerDialog(attributeDlg); registerDialog(attributeDlg);
attributeDlg.open(); attributeDlg.open();
unregisterDialog(attributeDlg); } else {
attributeDlg = null; attributeDlg.bringToTop();
} }
} }
@ -875,12 +928,21 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
* Display the color threshold dialog. * Display the color threshold dialog.
*/ */
private void displayColorThresholdDialog() { private void displayColorThresholdDialog() {
if (colorThresholdDlg == null) { if (colorThresholdDlg == null || colorThresholdDlg.isDisposed()) {
colorThresholdDlg = new SCANColorThreshDlg(shell, scanTable, this); colorThresholdDlg = new SCANColorThreshDlg(shell, scanTable, this);
colorThresholdDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(colorThresholdDlg);
colorThresholdDlg = null;
}
});
registerDialog(colorThresholdDlg); registerDialog(colorThresholdDlg);
colorThresholdDlg.open(); colorThresholdDlg.open();
unregisterDialog(colorThresholdDlg); } else {
colorThresholdDlg = null; colorThresholdDlg.bringToTop();
} }
} }
@ -912,7 +974,7 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
public void shellDisposeDialog() { public void shellDisposeDialog() {
killDialog = true; killDialog = true;
shell.dispose(); close();
elevationLabelColor.dispose(); elevationLabelColor.dispose();
} }
@ -1040,6 +1102,13 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
fireRecenter(ident, scanTable, site); fireRecenter(ident, scanTable, site);
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.scan.tables.ITableAction#centerByStormId(
* java.lang.String)
*/
@Override @Override
public void centerByStormId(String stormId) { public void centerByStormId(String stormId) {
// no op // no op
@ -1241,11 +1310,22 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
return ScanMonitor.getInstance().getGraphData(type, site, field, ident); return ScanMonitor.getInstance().getGraphData(type, site, field, ident);
} }
/**
* Alarm Selection
*
* @param ident
*/
public void alarmSelection(String ident) { public void alarmSelection(String ident) {
dmdTableComp.alarmSelection(ident); dmdTableComp.alarmSelection(ident);
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#turnOffAlarm()
*/
@Override @Override
public void turnOffAlarm() { public void turnOffAlarm() {
if (alarmBtn != null && !alarmBtn.isDisposed()) { if (alarmBtn != null && !alarmBtn.isDisposed()) {
@ -1254,6 +1334,12 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
mgr.setRing(false); mgr.setRing(false);
} }
/*
* (non-Javadoc)
*
* @see
* com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#turnOnAlarm()
*/
@Override @Override
public void turnOnAlarm() { public void turnOnAlarm() {
if (alarmBtn != null && !alarmBtn.isDisposed()) { if (alarmBtn != null && !alarmBtn.isDisposed()) {

View file

@ -59,6 +59,7 @@ import com.raytheon.uf.viz.monitor.scan.commondialogs.SCANAlarmTimeLimitDlg;
import com.raytheon.uf.viz.monitor.scan.commondialogs.SCANAttributesDlg; import com.raytheon.uf.viz.monitor.scan.commondialogs.SCANAttributesDlg;
import com.raytheon.uf.viz.monitor.scan.commondialogs.SCANColorThreshDlg; import com.raytheon.uf.viz.monitor.scan.commondialogs.SCANColorThreshDlg;
import com.raytheon.uf.viz.monitor.scan.data.ScanDataGenerator; import com.raytheon.uf.viz.monitor.scan.data.ScanDataGenerator;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/** /**
* *
@ -71,6 +72,7 @@ import com.raytheon.uf.viz.monitor.scan.data.ScanDataGenerator;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 29, 2013 #1945 lvenable Code cleanup for SCAN performance. * Apr 29, 2013 #1945 lvenable Code cleanup for SCAN performance.
* 24 Jul 2013 #2143 skorolev Changes non-blocking dialogs.
* *
* </pre> * </pre>
* *
@ -135,11 +137,17 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
open(); open();
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#setTableType()
*/
@Override @Override
protected void setTableType() { protected void setTableType() {
scanTable = ScanTables.MESO; scanTable = ScanTables.MESO;
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#initComponents()
*/
@Override @Override
protected void initComponents() { protected void initComponents() {
createTopControls(); createTopControls();
@ -152,6 +160,9 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
} }
/**
* Create Top Controls.
*/
private void createTopControls() { private void createTopControls() {
SCANConfig scanCfg = SCANConfig.getInstance(); SCANConfig scanCfg = SCANConfig.getInstance();
MesoConfigMgr mesoCfgMgr = (MesoConfigMgr) scanCfg MesoConfigMgr mesoCfgMgr = (MesoConfigMgr) scanCfg
@ -273,12 +284,8 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
tipsChk.addSelectionListener(new SelectionAdapter() { tipsChk.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
System.out.println(tipsChk.getSelection());
SCANConfig.getInstance().setShowTips(scanTable, SCANConfig.getInstance().setShowTips(scanTable,
tipsChk.getSelection()); tipsChk.getSelection());
System.out
.println(SCANConfig.getInstance().showTips(scanTable));
System.out.println(scanTable.name());
scanTableComp.updateColumnTips(); scanTableComp.updateColumnTips();
} }
}); });
@ -291,6 +298,9 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
timeLbl.setLayoutData(gd); timeLbl.setLayoutData(gd);
} }
/**
* Create Meso Table
*/
private void createMesoTable() { private void createMesoTable() {
scanTableComp = new SCANMesoTableComp(shell, tableData, this, site); scanTableComp = new SCANMesoTableComp(shell, tableData, this, site);
} }
@ -305,6 +315,9 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
rankPopupMenu = new Menu(rankBtn); rankPopupMenu = new Menu(rankBtn);
} }
/**
* Create File Popup Menu
*/
private void createFilePopupMenu() { private void createFilePopupMenu() {
filePopupMenu = new Menu(fileBtn); filePopupMenu = new Menu(fileBtn);
@ -358,6 +371,9 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
fileBtn.setMenu(filePopupMenu); fileBtn.setMenu(filePopupMenu);
} }
/**
* Create Configurations Popup Menu
*/
private void createConfigurationsPopupMenu() { private void createConfigurationsPopupMenu() {
configPopupMenu = new Menu(configBtn); configPopupMenu = new Menu(configBtn);
@ -388,38 +404,77 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
configBtn.setMenu(configPopupMenu); configBtn.setMenu(configPopupMenu);
} }
/**
* Display Attributes Dialog.
*/
private void displayAttributesDialog() { private void displayAttributesDialog() {
if ((attributeDlg == null) if ((attributeDlg == null)
|| (attributeDlg.getParent().isDisposed() == true)) { || (attributeDlg.getParent().isDisposed() == true)) {
attributeDlg = new SCANAttributesDlg(shell, scanTable, this); attributeDlg = new SCANAttributesDlg(shell, scanTable, this);
attributeDlg.setCloseCallback(new ICloseCallback(){
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(attributeDlg);
attributeDlg = null;
}
});
registerDialog(attributeDlg); registerDialog(attributeDlg);
attributeDlg.open(); attributeDlg.open();
unregisterDialog(attributeDlg); } else {
attributeDlg = null; attributeDlg.bringToTop();
} }
} }
/**
* Display Alarm Time LimitDialog
*/
private void displayAlarmTimeLimitDialog() { private void displayAlarmTimeLimitDialog() {
if (alarmTimeLimitDlg == null) { if (alarmTimeLimitDlg == null) {
alarmTimeLimitDlg = new SCANAlarmTimeLimitDlg(shell, scanTable, alarmTimeLimitDlg = new SCANAlarmTimeLimitDlg(shell, scanTable,
this.site); this.site);
alarmTimeLimitDlg.setCloseCallback(new ICloseCallback(){
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(alarmTimeLimitDlg);
alarmTimeLimitDlg = null;
}
});
registerDialog(alarmTimeLimitDlg); registerDialog(alarmTimeLimitDlg);
alarmTimeLimitDlg.open(); alarmTimeLimitDlg.open();
unregisterDialog(alarmTimeLimitDlg); } else {
alarmTimeLimitDlg = null; alarmTimeLimitDlg.bringToTop();
} }
} }
/**
* Display Color Threshold Dialog.
*/
private void displayColorThresholdDialog() { private void displayColorThresholdDialog() {
if (colorThresholdDlg == null) { if (colorThresholdDlg == null) {
colorThresholdDlg = new SCANColorThreshDlg(shell, scanTable, this); colorThresholdDlg = new SCANColorThreshDlg(shell, scanTable, this);
colorThresholdDlg.setCloseCallback(new ICloseCallback(){
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(colorThresholdDlg);
colorThresholdDlg = null;
}
});
registerDialog(colorThresholdDlg); registerDialog(colorThresholdDlg);
colorThresholdDlg.open(); colorThresholdDlg.open();
unregisterDialog(colorThresholdDlg); } else {
colorThresholdDlg = null; colorThresholdDlg.bringToTop();
} }
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#handleRankMenuEvent(org.eclipse.swt.events.SelectionEvent)
*/
@Override @Override
protected void handleRankMenuEvent(SelectionEvent event) { protected void handleRankMenuEvent(SelectionEvent event) {
String rank = ((MenuItem) event.getSource()).getText(); String rank = ((MenuItem) event.getSource()).getText();
@ -436,6 +491,9 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
scanTableComp.sortTableColumnByIndex(colIndex); scanTableComp.sortTableColumnByIndex(colIndex);
} }
/**
* Update Time Label.
*/
private void updateTimeLabel() { private void updateTimeLabel() {
if (currentTime == null) { if (currentTime == null) {
timeLbl.setText("*** NO TIME ***"); timeLbl.setText("*** NO TIME ***");
@ -449,26 +507,37 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
} }
} }
/**
* Unregister Dialog From Monitor.
*/
private void unregisterDialogFromMonitor() { private void unregisterDialogFromMonitor() {
this.fireDialogShutdown(this); this.fireDialogShutdown(this);
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#shellDisposeAction()
*/
@Override @Override
protected void shellDisposeAction() { protected void shellDisposeAction() {
shell.addDisposeListener(new DisposeListener() { shell.addDisposeListener(new DisposeListener() {
@Override @Override
public void widgetDisposed(DisposeEvent e) { public void widgetDisposed(DisposeEvent e) {
System.out.println("MESO dialog DISPOSED");
unregisterDialogFromMonitor(); unregisterDialogFromMonitor();
} }
}); });
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#shellDisposeDialog()
*/
@Override @Override
public void shellDisposeDialog() { public void shellDisposeDialog() {
shell.dispose(); close();
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#setShellText()
*/
@Override @Override
protected void setShellText() { protected void setShellText() {
if (!shell.isDisposed()) { if (!shell.isDisposed()) {
@ -476,11 +545,17 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
} }
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.ITableAction#sortedColumn(java.lang.String)
*/
@Override @Override
public void sortedColumn(String columnName) { public void sortedColumn(String columnName) {
rankBtn.setText("Rank: " + columnName); rankBtn.setText("Rank: " + columnName);
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#notify(com.raytheon.uf.viz.monitor.events.IMonitorEvent)
*/
@Override @Override
public void notify(IMonitorEvent me) { public void notify(IMonitorEvent me) {
if (me.getSource() instanceof IMonitor) { if (me.getSource() instanceof IMonitor) {
@ -511,27 +586,42 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
} }
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.ITableAction#centerByIdent(java.lang.String)
*/
@Override @Override
public void centerByIdent(String ident) { public void centerByIdent(String ident) {
fireRecenter(ident, ScanTables.MESO, site); fireRecenter(ident, ScanTables.MESO, site);
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.ITableAction#centerByStormId(java.lang.String)
*/
@Override @Override
public void centerByStormId(String stormId) { public void centerByStormId(String stormId) {
fireRecenter(stormId, ScanTables.CELL, site); fireRecenter(stormId, ScanTables.CELL, site);
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.commondialogs.IRequestTrendGraphData#getCurrentDate()
*/
@Override @Override
public Date getCurrentDate() { public Date getCurrentDate() {
return currentTime; return currentTime;
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.ITableAction#getTrendSetName()
*/
@Override @Override
public String getTrendSetName() { public String getTrendSetName() {
// Not used... // Not used...
return null; return null;
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.commondialogs.IAttributeUpdate#attributeUpdates(boolean[])
*/
@Override @Override
public void attributeUpdates(boolean[] visibleAttrs) { public void attributeUpdates(boolean[] visibleAttrs) {
SCANConfig scanCfg = SCANConfig.getInstance(); SCANConfig scanCfg = SCANConfig.getInstance();
@ -541,6 +631,9 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
createRankPopupMenu(rankPopupMenu, rankBtn); createRankPopupMenu(rankPopupMenu, rankBtn);
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.commondialogs.IThresholdUpdate#thresholdsUpdated(java.lang.String, double, double, double)
*/
@Override @Override
public void thresholdsUpdated(String attrName, double upper, double mid, public void thresholdsUpdated(String attrName, double upper, double mid,
double lower) { double lower) {
@ -572,6 +665,9 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
fireThresholdUpdate(new IMonitorThresholdEvent(this)); fireThresholdUpdate(new IMonitorThresholdEvent(this));
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#updateAfterConfigLoad()
*/
@Override @Override
protected void updateAfterConfigLoad() { protected void updateAfterConfigLoad() {
/* /*
@ -593,6 +689,9 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#displayTrendSetGraphs(java.lang.String)
*/
@Override @Override
public void displayTrendSetGraphs(String ident) { public void displayTrendSetGraphs(String ident) {
// NOT USED // NOT USED
@ -618,11 +717,17 @@ public class SCANMesoTableDlg extends AbstractTableDlg implements
return false; return false;
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#turnOffAlarm()
*/
@Override @Override
public void turnOffAlarm() { public void turnOffAlarm() {
mgr.setRing(false); mgr.setRing(false);
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#turnOnAlarm()
*/
@Override @Override
public void turnOnAlarm() { public void turnOnAlarm() {
mgr.setRing(true); mgr.setRing(true);

View file

@ -58,6 +58,7 @@ import com.raytheon.uf.viz.monitor.scan.commondialogs.SCANAlarmTimeLimitDlg;
import com.raytheon.uf.viz.monitor.scan.commondialogs.SCANAttributesDlg; import com.raytheon.uf.viz.monitor.scan.commondialogs.SCANAttributesDlg;
import com.raytheon.uf.viz.monitor.scan.commondialogs.SCANColorThreshDlg; import com.raytheon.uf.viz.monitor.scan.commondialogs.SCANColorThreshDlg;
import com.raytheon.uf.viz.monitor.scan.data.ScanDataGenerator; import com.raytheon.uf.viz.monitor.scan.data.ScanDataGenerator;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
/** /**
* *
@ -70,6 +71,7 @@ import com.raytheon.uf.viz.monitor.scan.data.ScanDataGenerator;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Apr 29, 2013 #1945 lvenable Code cleanup for SCAN performance. * Apr 29, 2013 #1945 lvenable Code cleanup for SCAN performance.
* 24 Jul 2013 #2143 skorolev Changes for non-blocking dialogs.
* *
* </pre> * </pre>
* *
@ -127,11 +129,17 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
open(); open();
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#setTableType()
*/
@Override @Override
protected void setTableType() { protected void setTableType() {
scanTable = ScanTables.TVS; scanTable = ScanTables.TVS;
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#initComponents()
*/
@Override @Override
protected void initComponents() { protected void initComponents() {
createTopControls(); createTopControls();
@ -143,6 +151,9 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
createRankPopupMenu(rankPopupMenu, rankBtn); createRankPopupMenu(rankPopupMenu, rankBtn);
} }
/**
* Create Top Controls.
*/
private void createTopControls() { private void createTopControls() {
SCANConfig scanCfg = SCANConfig.getInstance(); SCANConfig scanCfg = SCANConfig.getInstance();
TvsConfigMgr tvsCfgMgr = (TvsConfigMgr) scanCfg TvsConfigMgr tvsCfgMgr = (TvsConfigMgr) scanCfg
@ -264,12 +275,8 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
tipsChk.addSelectionListener(new SelectionAdapter() { tipsChk.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
System.out.println(tipsChk.getSelection());
SCANConfig.getInstance().setShowTips(scanTable, SCANConfig.getInstance().setShowTips(scanTable,
tipsChk.getSelection()); tipsChk.getSelection());
System.out
.println(SCANConfig.getInstance().showTips(scanTable));
System.out.println(scanTable.name());
scanTableComp.updateColumnTips(); scanTableComp.updateColumnTips();
} }
}); });
@ -282,6 +289,9 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
timeLbl.setLayoutData(gd); timeLbl.setLayoutData(gd);
} }
/**
* Create TVS Table.
*/
private void createTvsTable() { private void createTvsTable() {
scanTableComp = new SCANTvsTableComp(shell, tableData, this, site); scanTableComp = new SCANTvsTableComp(shell, tableData, this, site);
} }
@ -296,6 +306,9 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
rankPopupMenu = new Menu(rankBtn); rankPopupMenu = new Menu(rankBtn);
} }
/**
* Create File Popup Menu.
*/
private void createFilePopupMenu() { private void createFilePopupMenu() {
filePopupMenu = new Menu(fileBtn); filePopupMenu = new Menu(fileBtn);
@ -349,6 +362,9 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
fileBtn.setMenu(filePopupMenu); fileBtn.setMenu(filePopupMenu);
} }
/**
* Create Configurations Popup Menu.
*/
private void createConfigurationsPopupMenu() { private void createConfigurationsPopupMenu() {
configPopupMenu = new Menu(configBtn); configPopupMenu = new Menu(configBtn);
@ -379,38 +395,77 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
configBtn.setMenu(configPopupMenu); configBtn.setMenu(configPopupMenu);
} }
/**
* Display Attributes Dialog.
*/
private void displayAttributesDialog() { private void displayAttributesDialog() {
if ((attributeDlg == null) if ((attributeDlg == null)
|| (attributeDlg.getParent().isDisposed() == true)) { || (attributeDlg.getParent().isDisposed() == true)) {
attributeDlg = new SCANAttributesDlg(shell, scanTable, this); attributeDlg = new SCANAttributesDlg(shell, scanTable, this);
attributeDlg.setCloseCallback(new ICloseCallback(){
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(attributeDlg);
attributeDlg = null;
}
});
registerDialog(attributeDlg); registerDialog(attributeDlg);
attributeDlg.open(); attributeDlg.open();
unregisterDialog(attributeDlg); } else {
attributeDlg = null; attributeDlg.bringToTop();
} }
} }
/**
* Display Alarm Time Limit Dialog.
*/
private void displayAlarmTimeLimitDialog() { private void displayAlarmTimeLimitDialog() {
if (alarmTimeLimitDlg == null) { if (alarmTimeLimitDlg == null) {
alarmTimeLimitDlg = new SCANAlarmTimeLimitDlg(shell, scanTable, alarmTimeLimitDlg = new SCANAlarmTimeLimitDlg(shell, scanTable,
this.site); this.site);
alarmTimeLimitDlg.setCloseCallback(new ICloseCallback(){
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(alarmTimeLimitDlg);
alarmTimeLimitDlg = null;
}
});
registerDialog(alarmTimeLimitDlg); registerDialog(alarmTimeLimitDlg);
alarmTimeLimitDlg.open(); alarmTimeLimitDlg.open();
unregisterDialog(alarmTimeLimitDlg); } else {
alarmTimeLimitDlg = null; alarmTimeLimitDlg.bringToTop();
} }
} }
/**
* Display Color Threshold Dialog.
*/
private void displayColorThresholdDialog() { private void displayColorThresholdDialog() {
if (colorThresholdDlg == null) { if (colorThresholdDlg == null) {
colorThresholdDlg = new SCANColorThreshDlg(shell, scanTable, this); colorThresholdDlg = new SCANColorThreshDlg(shell, scanTable, this);
colorThresholdDlg.setCloseCallback(new ICloseCallback(){
@Override
public void dialogClosed(Object returnValue) {
unregisterDialog(colorThresholdDlg);
colorThresholdDlg = null;
}
});
registerDialog(colorThresholdDlg); registerDialog(colorThresholdDlg);
colorThresholdDlg.open(); colorThresholdDlg.open();
unregisterDialog(colorThresholdDlg); } else {
colorThresholdDlg = null; colorThresholdDlg.bringToTop();
} }
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#handleRankMenuEvent(org.eclipse.swt.events.SelectionEvent)
*/
@Override @Override
protected void handleRankMenuEvent(SelectionEvent event) { protected void handleRankMenuEvent(SelectionEvent event) {
String rank = ((MenuItem) event.getSource()).getText(); String rank = ((MenuItem) event.getSource()).getText();
@ -427,6 +482,9 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
scanTableComp.sortTableColumnByIndex(colIndex); scanTableComp.sortTableColumnByIndex(colIndex);
} }
/**
* Update Time Label.
*/
private void updateTimeLabel() { private void updateTimeLabel() {
if (currentTime == null) { if (currentTime == null) {
timeLbl.setText("*** NO TIME ***"); timeLbl.setText("*** NO TIME ***");
@ -438,10 +496,16 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
timeLbl.setText(dateFmt.format(currentTime)); timeLbl.setText(dateFmt.format(currentTime));
} }
/**
* Unregister Dialog From Monitor.
*/
private void unregisterDialogFromMonitor() { private void unregisterDialogFromMonitor() {
this.fireDialogShutdown(this); this.fireDialogShutdown(this);
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#shellDisposeAction()
*/
@Override @Override
protected void shellDisposeAction() { protected void shellDisposeAction() {
shell.addDisposeListener(new DisposeListener() { shell.addDisposeListener(new DisposeListener() {
@ -459,11 +523,17 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
}); });
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#shellDisposeDialog()
*/
@Override @Override
public void shellDisposeDialog() { public void shellDisposeDialog() {
shell.dispose(); close();
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#setShellText()
*/
@Override @Override
protected void setShellText() { protected void setShellText() {
if (!shell.isDisposed()) { if (!shell.isDisposed()) {
@ -471,11 +541,17 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
} }
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.ITableAction#sortedColumn(java.lang.String)
*/
@Override @Override
public void sortedColumn(String columnName) { public void sortedColumn(String columnName) {
rankBtn.setText("Rank: " + columnName); rankBtn.setText("Rank: " + columnName);
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#notify(com.raytheon.uf.viz.monitor.events.IMonitorEvent)
*/
@Override @Override
public void notify(IMonitorEvent me) { public void notify(IMonitorEvent me) {
if (me.getSource() instanceof IMonitor) { if (me.getSource() instanceof IMonitor) {
@ -520,27 +596,42 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
ScanTables.TVS, site, time))); ScanTables.TVS, site, time)));
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.ITableAction#centerByIdent(java.lang.String)
*/
@Override @Override
public void centerByIdent(String ident) { public void centerByIdent(String ident) {
fireRecenter(ident, ScanTables.TVS, site); fireRecenter(ident, ScanTables.TVS, site);
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.ITableAction#centerByStormId(java.lang.String)
*/
@Override @Override
public void centerByStormId(String stormId) { public void centerByStormId(String stormId) {
fireRecenter(stormId, ScanTables.CELL, site); fireRecenter(stormId, ScanTables.CELL, site);
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.commondialogs.IRequestTrendGraphData#getCurrentDate()
*/
@Override @Override
public Date getCurrentDate() { public Date getCurrentDate() {
return currentTime; return currentTime;
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.ITableAction#getTrendSetName()
*/
@Override @Override
public String getTrendSetName() { public String getTrendSetName() {
// Not used... // Not used...
return null; return null;
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.commondialogs.IAttributeUpdate#attributeUpdates(boolean[])
*/
@Override @Override
public void attributeUpdates(boolean[] visibleAttrs) { public void attributeUpdates(boolean[] visibleAttrs) {
SCANConfig scanCfg = SCANConfig.getInstance(); SCANConfig scanCfg = SCANConfig.getInstance();
@ -550,6 +641,9 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
createRankPopupMenu(rankPopupMenu, rankBtn); createRankPopupMenu(rankPopupMenu, rankBtn);
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.commondialogs.IThresholdUpdate#thresholdsUpdated(java.lang.String, double, double, double)
*/
@Override @Override
public void thresholdsUpdated(String attrName, double upper, double mid, public void thresholdsUpdated(String attrName, double upper, double mid,
double lower) { double lower) {
@ -560,6 +654,9 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
fireThresholdUpdate(new IMonitorThresholdEvent(this)); fireThresholdUpdate(new IMonitorThresholdEvent(this));
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#updateAfterConfigLoad()
*/
@Override @Override
protected void updateAfterConfigLoad() { protected void updateAfterConfigLoad() {
/* /*
@ -580,6 +677,9 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
} }
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#displayTrendSetGraphs(java.lang.String)
*/
@Override @Override
public void displayTrendSetGraphs(String ident) { public void displayTrendSetGraphs(String ident) {
// NOT USED // NOT USED
@ -607,11 +707,17 @@ public class SCANTvsTableDlg extends AbstractTableDlg implements
return false; return false;
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#turnOffAlarm()
*/
@Override @Override
public void turnOffAlarm() { public void turnOffAlarm() {
mgr.setRing(false); mgr.setRing(false);
} }
/* (non-Javadoc)
* @see com.raytheon.uf.viz.monitor.scan.tables.AbstractTableDlg#turnOnAlarm()
*/
@Override @Override
public void turnOnAlarm() { public void turnOnAlarm() {
mgr.setRing(true); mgr.setRing(true);