Issue #1351. Changes for non-blocking dialog MonitorDisplayThreshDlg. Changes according to comments. Deleted unused file.
Change-Id: I62f1d4ad30ca4ed120c0ca94abf140a1e0b90ce6 Former-commit-id:1a510a9f61
[formerly c063c2bdb4d4cc7c59917e9882fe78cabb63c06d] Former-commit-id:48f074eb72
This commit is contained in:
parent
80c743ac8b
commit
829899374d
17 changed files with 458 additions and 565 deletions
|
@ -25,8 +25,6 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonitoringAreaConfigDlg;
|
||||
|
||||
/**
|
||||
|
@ -49,18 +47,13 @@ import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonitoringAreaConfigDlg;
|
|||
|
||||
public class FogAreaConfigAction extends AbstractHandler {
|
||||
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(FogAreaConfigAction.class);
|
||||
|
||||
private FogMonitoringAreaConfigDlg areaDialog;
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
if (areaDialog == null || areaDialog.getShell() == null
|
||||
|| areaDialog.isDisposed()) {
|
||||
if (areaDialog == null) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
areaDialog = new FogMonitoringAreaConfigDlg(shell,
|
||||
"Fog Monitor Area Configuration");
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ import com.raytheon.uf.viz.monitor.fog.FogMonitor;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 20, 2009 1999 grichard Initial creation.
|
||||
* Dec 6, 2012 #1351 skorolev Cleaned code
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,7 +49,6 @@ public class FogMonitorAction extends AbstractHandler {
|
|||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
System.out.println("Activating/Action for FOG...");
|
||||
FogMonitor fog = FogMonitor.getInstance();
|
||||
|
||||
if (fog.getZoneDialog() == null || fog.getZoneDialog().isDisposed()) {
|
||||
|
|
|
@ -38,6 +38,7 @@ import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonDispThreshDlg;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 19 2009 3963 dhladky Initial creation.
|
||||
* Dec 6 2012 #1351 skorolev Changes for non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -48,24 +49,16 @@ import com.raytheon.uf.viz.monitor.fog.ui.dialogs.FogMonDispThreshDlg;
|
|||
public class FogThresholdAlertVisConfigAction extends AbstractHandler {
|
||||
|
||||
private FogMonDispThreshDlg fogMonitorDlg;
|
||||
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
System.out.println("Activating/Action the FOG Alrt Vis Config...");
|
||||
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
|
||||
if (fogMonitorDlg == null)
|
||||
{
|
||||
fogMonitorDlg = new FogMonDispThreshDlg(shell, CommonConfig.AppName.FOG, DataUsageKey.MONITOR);
|
||||
fogMonitorDlg.open();
|
||||
fogMonitorDlg = null;
|
||||
if (fogMonitorDlg == null) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
fogMonitorDlg = new FogMonDispThreshDlg(shell,
|
||||
CommonConfig.AppName.FOG, DataUsageKey.MONITOR);
|
||||
}
|
||||
|
||||
// figure out what to do here in the future
|
||||
fogMonitorDlg.open();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -30,81 +30,126 @@ import com.raytheon.uf.viz.monitor.fog.threshold.FogThresholdMgr;
|
|||
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg;
|
||||
|
||||
public class FogMonDispThreshDlg extends MonitorDisplayThreshDlg
|
||||
{
|
||||
/**
|
||||
* Fog Monitor/Display Threshold Dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 7, 2012 #1351 skorolev Cleaned up code.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author skorolev
|
||||
* @version 1.0
|
||||
*/
|
||||
public class FogMonDispThreshDlg extends MonitorDisplayThreshDlg {
|
||||
/** Display Meteo Table **/
|
||||
FogDisplayMeteoTab displayMeteoTab;
|
||||
|
||||
/** Display Wind Table **/
|
||||
FogDisplayWindTab displayWindTab;
|
||||
|
||||
/** Monitor Meteo Table **/
|
||||
FogMonitorMeteoTab monitorMeteoTab;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param parent
|
||||
* @param appName
|
||||
* @param displayType
|
||||
*/
|
||||
public FogMonDispThreshDlg(Shell parent, CommonConfig.AppName appName,
|
||||
DataUsageKey displayType)
|
||||
{
|
||||
DataUsageKey displayType) {
|
||||
super(parent, appName, displayType);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg#createTabItems
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected void createTabItems()
|
||||
{
|
||||
if (displayType == DataUsageKey.DISPLAY)
|
||||
{
|
||||
protected void createTabItems() {
|
||||
if (displayType == DataUsageKey.DISPLAY) {
|
||||
createDisplayTabs();
|
||||
}
|
||||
else if (displayType == DataUsageKey.MONITOR)
|
||||
{
|
||||
} else if (displayType == DataUsageKey.MONITOR) {
|
||||
createMonitorTabs();
|
||||
}
|
||||
}
|
||||
|
||||
private void createDisplayTabs()
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates Display Tables.
|
||||
*/
|
||||
private void createDisplayTabs() {
|
||||
|
||||
TabItem meteoTab = new TabItem(tabFolder, SWT.NONE);
|
||||
meteoTab.setText("Meteo");
|
||||
displayMeteoTab = new FogDisplayMeteoTab(tabFolder, displayType);
|
||||
meteoTab.setControl(displayMeteoTab);
|
||||
|
||||
|
||||
TabItem windTab = new TabItem(tabFolder, SWT.NONE);
|
||||
windTab.setText("Wind");
|
||||
displayWindTab = new FogDisplayWindTab(tabFolder, displayType);
|
||||
windTab.setControl(displayWindTab);
|
||||
windTab.setControl(displayWindTab);
|
||||
}
|
||||
|
||||
private void createMonitorTabs()
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates Monitor Tables.
|
||||
*/
|
||||
private void createMonitorTabs() {
|
||||
TabItem meteoTab = new TabItem(tabFolder, SWT.NONE);
|
||||
meteoTab.setText("Meteo");
|
||||
monitorMeteoTab = new FogMonitorMeteoTab(tabFolder, displayType);
|
||||
meteoTab.setControl(monitorMeteoTab);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg#
|
||||
* commitChangeAction()
|
||||
*/
|
||||
@Override
|
||||
protected void commitChangeAction()
|
||||
{
|
||||
if (displayType == DataUsageKey.DISPLAY)
|
||||
{
|
||||
protected void commitChangeAction() {
|
||||
if (displayType == DataUsageKey.DISPLAY) {
|
||||
displayMeteoTab.commitDataToXML();
|
||||
displayWindTab.commitDataToXML();
|
||||
|
||||
|
||||
FogMonitor.getInstance().thresholdUpdate(null);
|
||||
}
|
||||
else if (displayType == DataUsageKey.MONITOR)
|
||||
{
|
||||
} else if (displayType == DataUsageKey.MONITOR) {
|
||||
monitorMeteoTab.commitDataToXML();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg#
|
||||
* getThresholdMgr()
|
||||
*/
|
||||
@Override
|
||||
protected AbstractThresholdMgr getThresholdMgr()
|
||||
{
|
||||
protected AbstractThresholdMgr getThresholdMgr() {
|
||||
FogThresholdMgr ftm = FogThresholdMgr.getInstance();
|
||||
return ftm;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg#
|
||||
* reloadThresholds()
|
||||
*/
|
||||
@Override
|
||||
protected void reloadThresholds()
|
||||
{
|
||||
protected void reloadThresholds() {
|
||||
displayMeteoTab.reloadData();
|
||||
displayWindTab.reloadData();
|
||||
displayWindTab.reloadData();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
|
|||
* Jun 16, 2012 14386 zhao Modified the notify method
|
||||
* Oct 30, 2012 skorolev Changed HashMap to Map
|
||||
* Nov 11, 2012 1297 skorolev Added initiateProdArray
|
||||
* Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -103,9 +104,8 @@ public class FogZoneTableDlg extends ZoneTableDlg {
|
|||
if (fogThreshDlg == null) {
|
||||
fogThreshDlg = new FogMonDispThreshDlg(getParent().getShell(),
|
||||
CommonConfig.AppName.FOG, DataUsageKey.DISPLAY);
|
||||
fogThreshDlg.open();
|
||||
fogThreshDlg = null;
|
||||
}
|
||||
fogThreshDlg.open();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -51,7 +51,6 @@ public class SafeSeasAction extends AbstractHandler {
|
|||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
System.out.println("Activating/Action for Safeseas...");
|
||||
|
||||
SafeSeasMonitor monitor = SafeSeasMonitor.getInstance();
|
||||
if (monitor.getZoneDialog() == null
|
||||
|
|
|
@ -25,8 +25,6 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSMonitoringAreaConfigDlg;
|
||||
|
||||
/**
|
||||
|
@ -49,17 +47,13 @@ import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSMonitoringAreaConfigDlg
|
|||
|
||||
public class SafeseasAreaConfigAction extends AbstractHandler {
|
||||
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SafeseasAreaConfigAction.class);
|
||||
|
||||
private SSMonitoringAreaConfigDlg configDlg;
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
if (configDlg == null || configDlg.getShell() == null
|
||||
|| configDlg.isDisposed()) {
|
||||
if (configDlg == null) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
configDlg = new SSMonitoringAreaConfigDlg(shell,
|
||||
"SAFESEAS Monitor Area Configuration");
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSDispMonThreshDlg;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 19 2009 3963 dhladky Initial creation.
|
||||
* Dec 6 2012 #1351 skorolev Changes for non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -46,26 +47,20 @@ import com.raytheon.uf.viz.monitor.safeseas.ui.dialogs.SSDispMonThreshDlg;
|
|||
*/
|
||||
|
||||
public class SafeseasThresholdAlertVisConfigAction extends AbstractHandler {
|
||||
|
||||
|
||||
private SSDispMonThreshDlg ssMonitorDlg;
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
System.out.println("Activating/Action the SafeSeas Alrt Vis Config...");
|
||||
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
|
||||
if (ssMonitorDlg == null)
|
||||
{
|
||||
ssMonitorDlg = new SSDispMonThreshDlg(shell, CommonConfig.AppName.SAFESEAS, DataUsageKey.MONITOR);
|
||||
ssMonitorDlg.open();
|
||||
ssMonitorDlg = null;
|
||||
if (ssMonitorDlg == null) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
ssMonitorDlg = new SSDispMonThreshDlg(shell,
|
||||
CommonConfig.AppName.SAFESEAS, DataUsageKey.MONITOR);
|
||||
|
||||
}
|
||||
|
||||
ssMonitorDlg.open();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,104 +30,154 @@ import com.raytheon.uf.viz.monitor.safeseas.threshold.SSThresholdMgr;
|
|||
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg;
|
||||
|
||||
public class SSDispMonThreshDlg extends MonitorDisplayThreshDlg
|
||||
{
|
||||
/**
|
||||
* Configure SAFESEAS Display/Monitor Threshold Dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 7, 2012 #1351 skorolev Changes for non-blocking dialog.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SSDispMonThreshDlg extends MonitorDisplayThreshDlg {
|
||||
/** Display Product Table **/
|
||||
private SSDisplayProductTab displayProductTab;
|
||||
|
||||
/** Display Wind Table **/
|
||||
private SSDisplayWindTab displayWindTab;
|
||||
|
||||
/** Display Meteo Table **/
|
||||
private SSDisplayMeteoTab displayMeteoTab;
|
||||
|
||||
/** Display Swell Table **/
|
||||
private SSDisplaySwellTab displaySwellTab;
|
||||
|
||||
/** Monitor Meteo Table **/
|
||||
private SSMonitorMeteoTab monitorMeteoTab;
|
||||
|
||||
/** Monitor Swell Table **/
|
||||
private SSMonitorSwellTab monitorSwellTab;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param parent
|
||||
* @param appName
|
||||
* @param duKey
|
||||
* Data Usage Key
|
||||
*/
|
||||
public SSDispMonThreshDlg(Shell parent, CommonConfig.AppName appName,
|
||||
DataUsageKey duKey)
|
||||
{
|
||||
DataUsageKey duKey) {
|
||||
super(parent, appName, duKey);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg#createTabItems
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected void createTabItems()
|
||||
{
|
||||
if (displayType == DataUsageKey.DISPLAY)
|
||||
{
|
||||
protected void createTabItems() {
|
||||
if (displayType == DataUsageKey.DISPLAY) {
|
||||
createDisplayTabs();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
createMonitorTabs();
|
||||
}
|
||||
}
|
||||
|
||||
private void createDisplayTabs()
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates Display Tables
|
||||
*/
|
||||
private void createDisplayTabs() {
|
||||
TabItem productTab = new TabItem(tabFolder, SWT.NONE);
|
||||
productTab.setText("Product");
|
||||
displayProductTab = new SSDisplayProductTab(tabFolder, displayType);
|
||||
productTab.setControl(displayProductTab);
|
||||
|
||||
|
||||
TabItem windTab = new TabItem(tabFolder, SWT.NONE);
|
||||
windTab.setText("Wind");
|
||||
displayWindTab = new SSDisplayWindTab(tabFolder, displayType);
|
||||
windTab.setControl(displayWindTab);
|
||||
|
||||
|
||||
TabItem meteoTab = new TabItem(tabFolder, SWT.NONE);
|
||||
meteoTab.setText("Meteo");
|
||||
displayMeteoTab = new SSDisplayMeteoTab(tabFolder, displayType);
|
||||
meteoTab.setControl(displayMeteoTab);
|
||||
|
||||
|
||||
TabItem swellTab = new TabItem(tabFolder, SWT.NONE);
|
||||
swellTab.setText("Swell");
|
||||
displaySwellTab = new SSDisplaySwellTab(tabFolder, displayType);
|
||||
swellTab.setControl(displaySwellTab);
|
||||
}
|
||||
|
||||
private void createMonitorTabs()
|
||||
{
|
||||
|
||||
/**
|
||||
* Creates Monitor Tables
|
||||
*/
|
||||
private void createMonitorTabs() {
|
||||
TabItem meteoTab = new TabItem(tabFolder, SWT.NONE);
|
||||
meteoTab.setText("Meteo");
|
||||
monitorMeteoTab = new SSMonitorMeteoTab(tabFolder, displayType);
|
||||
meteoTab.setControl(monitorMeteoTab);
|
||||
|
||||
|
||||
TabItem swellTab = new TabItem(tabFolder, SWT.NONE);
|
||||
swellTab.setText("Swell");
|
||||
monitorSwellTab = new SSMonitorSwellTab(tabFolder, displayType);
|
||||
swellTab.setControl(monitorSwellTab);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg#
|
||||
* commitChangeAction()
|
||||
*/
|
||||
@Override
|
||||
protected void commitChangeAction()
|
||||
{
|
||||
if (displayType == DataUsageKey.DISPLAY)
|
||||
{
|
||||
protected void commitChangeAction() {
|
||||
if (displayType == DataUsageKey.DISPLAY) {
|
||||
displayProductTab.commitDataToXML();
|
||||
displayWindTab.commitDataToXML();
|
||||
displayMeteoTab.commitDataToXML();
|
||||
displaySwellTab.commitDataToXML();
|
||||
|
||||
|
||||
SafeSeasMonitor.getInstance().thresholdUpdate(null);
|
||||
}
|
||||
else if (displayType == DataUsageKey.MONITOR)
|
||||
{
|
||||
} else if (displayType == DataUsageKey.MONITOR) {
|
||||
monitorMeteoTab.commitDataToXML();
|
||||
monitorSwellTab.commitDataToXML();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg#
|
||||
* getThresholdMgr()
|
||||
*/
|
||||
@Override
|
||||
protected AbstractThresholdMgr getThresholdMgr()
|
||||
{
|
||||
protected AbstractThresholdMgr getThresholdMgr() {
|
||||
SSThresholdMgr sstm = SSThresholdMgr.getInstance();
|
||||
return sstm;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg#
|
||||
* reloadThresholds()
|
||||
*/
|
||||
@Override
|
||||
protected void reloadThresholds()
|
||||
{
|
||||
protected void reloadThresholds() {
|
||||
displayProductTab.reloadData();
|
||||
displayWindTab.reloadData();
|
||||
displayMeteoTab.reloadData();
|
||||
displaySwellTab.reloadData();
|
||||
displaySwellTab.reloadData();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ import com.raytheon.uf.viz.monitor.util.MonitorConfigConstants;
|
|||
* Dec 30, 2009 3424 zhao use ObMultiHrsReports for obs data archive
|
||||
* Oct 30, 2012 1297 skorolev Changed HashMap to Map
|
||||
* Nov 10, 2012 1297 skorolev Added initiateProdArray
|
||||
* Dec 7, 2012 #1351 skorolev Changes for non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -127,9 +128,8 @@ public class SSZoneTableDlg extends ZoneTableDlg {
|
|||
if (ssThreshDlg == null) {
|
||||
ssThreshDlg = new SSDispMonThreshDlg(getParent().getShell(),
|
||||
CommonConfig.AppName.SAFESEAS, DataUsageKey.DISPLAY);
|
||||
ssThreshDlg.open();
|
||||
ssThreshDlg = null;
|
||||
}
|
||||
ssThreshDlg.open();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -59,7 +59,6 @@ public class SnowAction extends AbstractHandler {
|
|||
*/
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
System.out.println("Activating/Action for SNOW...");
|
||||
|
||||
SnowMonitor snow = SnowMonitor.getInstance();
|
||||
if (snow.getZoneDialog() == null || snow.getZoneDialog().isDisposed()) {
|
||||
|
|
|
@ -38,6 +38,7 @@ import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonDispThreshDlg;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 19 2009 3963 dhladky Initial creation.
|
||||
* Dec 6 2012 #1351 skorolev Changes for non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -46,27 +47,19 @@ import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonDispThreshDlg;
|
|||
*/
|
||||
|
||||
public class SnowAlertVisThresholdConfigAction extends AbstractHandler {
|
||||
|
||||
|
||||
private SnowMonDispThreshDlg snowMonDispThreshDlg;
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
System.out.println("Activating/Action the Snow Alrt Vis Config...");
|
||||
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
|
||||
|
||||
if (snowMonDispThreshDlg == null)
|
||||
{
|
||||
snowMonDispThreshDlg = new SnowMonDispThreshDlg(shell, CommonConfig.AppName.SNOW, DataUsageKey.MONITOR);
|
||||
snowMonDispThreshDlg.open();
|
||||
snowMonDispThreshDlg = null;
|
||||
if (snowMonDispThreshDlg == null) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
snowMonDispThreshDlg = new SnowMonDispThreshDlg(shell,
|
||||
CommonConfig.AppName.SNOW, DataUsageKey.MONITOR);
|
||||
}
|
||||
|
||||
// figure out what to do here in the future
|
||||
snowMonDispThreshDlg.open();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -25,8 +25,6 @@ import org.eclipse.core.commands.ExecutionException;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonitoringAreaConfigDlg;
|
||||
|
||||
/**
|
||||
|
@ -49,18 +47,13 @@ import com.raytheon.uf.viz.monitor.snow.ui.dialogs.SnowMonitoringAreaConfigDlg;
|
|||
|
||||
public class SnowAreaConfigAction extends AbstractHandler {
|
||||
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SnowAreaConfigAction.class);
|
||||
|
||||
private SnowMonitoringAreaConfigDlg configDlg;
|
||||
|
||||
@Override
|
||||
public Object execute(ExecutionEvent arg0) throws ExecutionException {
|
||||
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
if (configDlg == null || configDlg.getShell() == null
|
||||
|| configDlg.isDisposed()) {
|
||||
if (configDlg == null) {
|
||||
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
|
||||
.getShell();
|
||||
configDlg = new SnowMonitoringAreaConfigDlg(shell,
|
||||
"SNOW Monitor Area Configuration");
|
||||
}
|
||||
|
|
|
@ -1,274 +0,0 @@
|
|||
/**
|
||||
* This software was developed and / or modified by Raytheon Company,
|
||||
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
|
||||
*
|
||||
* U.S. EXPORT CONTROLLED TECHNICAL DATA
|
||||
* This software product contains export-restricted data whose
|
||||
* export/transfer/disclosure is restricted by U.S. law. Dissemination
|
||||
* to non-U.S. persons whether in the United States or abroad requires
|
||||
* an export license or other authorization.
|
||||
*
|
||||
* Contractor Name: Raytheon Company
|
||||
* Contractor Address: 6825 Pine Street, Suite 340
|
||||
* Mail Stop B8
|
||||
* Omaha, NE 68106
|
||||
* 402.291.0100
|
||||
*
|
||||
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
|
||||
* further licensing information.
|
||||
**/
|
||||
package com.raytheon.uf.viz.monitor.snow.ui.dialogs;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.ShellAdapter;
|
||||
import org.eclipse.swt.events.ShellEvent;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.monitor.data.ObConst;
|
||||
import com.raytheon.uf.viz.monitor.listeners.IGuardianListener;
|
||||
import com.raytheon.uf.viz.monitor.snow.SnowMonitor;
|
||||
import com.raytheon.uf.viz.monitor.snow.SnowReportModel;
|
||||
import com.raytheon.uf.viz.monitor.util.MonitorThresholdConfiguration;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
|
||||
/**
|
||||
* The SNOW Dialog Stand-in
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Feb 20, 2009 1999 grichard Initial creation.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author grichard
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class SnowDialog extends CaveSWTDialog implements IGuardianListener {
|
||||
|
||||
/**
|
||||
* Guardian threat message viewer text control.
|
||||
*/
|
||||
private StyledText threatMessageViewerStTxt;
|
||||
|
||||
/**
|
||||
* Guardian threat priority label.
|
||||
*/
|
||||
private Label guardianLbl;
|
||||
|
||||
/**
|
||||
* Large font.
|
||||
*/
|
||||
private Font largeFont;
|
||||
|
||||
/**
|
||||
* Text editor background color.
|
||||
*/
|
||||
private Color editorColor;
|
||||
|
||||
/**
|
||||
* Instance variable for Snow Monitor
|
||||
*/
|
||||
private SnowMonitor snow;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param parent
|
||||
* Parent Shell.
|
||||
*/
|
||||
public SnowDialog(Shell parent) {
|
||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
|
||||
setText("SNOW");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
// Create the main layout for the shell.
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
mainLayout.marginHeight = 5;
|
||||
mainLayout.marginWidth = 5;
|
||||
mainLayout.verticalSpacing = 5;
|
||||
return mainLayout;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void disposed() {
|
||||
largeFont.dispose();
|
||||
editorColor.dispose();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
setReturnValue(false);
|
||||
|
||||
largeFont = new Font(getDisplay(), "Monospace", 10, SWT.NORMAL);
|
||||
|
||||
editorColor = new Color(getDisplay(), 82, 107, 129);
|
||||
|
||||
// Initialize all of the controls and layouts
|
||||
createGuardianControl();
|
||||
createBottomButtons();
|
||||
|
||||
shell.addShellListener(new ShellAdapter() {
|
||||
@Override
|
||||
public void shellClosed(ShellEvent event) {
|
||||
closeDisplay();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the Guardian control.
|
||||
*/
|
||||
private void createGuardianControl() {
|
||||
Composite guardianComp = new Composite(shell, SWT.NONE);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
guardianComp.setLayout(new GridLayout(1, false));
|
||||
guardianComp.setLayoutData(gd);
|
||||
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
gd.heightHint = 25;
|
||||
gd.widthHint = 450;
|
||||
|
||||
guardianLbl = new Label(guardianComp, SWT.CENTER);
|
||||
guardianLbl
|
||||
.setText("The color coded result of this decision assistance tool");
|
||||
guardianLbl.setLayoutData(gd);
|
||||
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
gd.heightHint = 150;
|
||||
gd.widthHint = 450;
|
||||
|
||||
threatMessageViewerStTxt = new StyledText(guardianComp, SWT.BORDER
|
||||
| SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
|
||||
threatMessageViewerStTxt.setWordWrap(true);
|
||||
threatMessageViewerStTxt.setFont(largeFont);
|
||||
threatMessageViewerStTxt.setEditable(false);
|
||||
threatMessageViewerStTxt.setLayoutData(gd);
|
||||
threatMessageViewerStTxt.setBackground(editorColor);
|
||||
threatMessageViewerStTxt.setForeground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_WHITE));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the OK and Cancel buttons.
|
||||
*/
|
||||
private void createBottomButtons() {
|
||||
Composite buttonComp = new Composite(shell, SWT.NONE);
|
||||
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||
buttonComp.setLayout(new GridLayout(2, false));
|
||||
buttonComp.setLayoutData(gd);
|
||||
|
||||
gd = new GridData(80, SWT.DEFAULT);
|
||||
Button okBtn = new Button(buttonComp, SWT.PUSH);
|
||||
okBtn.setText("Start");
|
||||
okBtn.setLayoutData(gd);
|
||||
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
SnowReportModel.getInstance().setSnowDisplay(SnowDialog.this);
|
||||
snow = SnowMonitor.getInstance();
|
||||
snow
|
||||
.readTableConfig(MonitorThresholdConfiguration.SNOW_THRESHOLD_CONFIG);
|
||||
}
|
||||
});
|
||||
|
||||
gd = new GridData(80, SWT.DEFAULT);
|
||||
Button cancelBtn = new Button(buttonComp, SWT.PUSH);
|
||||
cancelBtn.setText("Stop");
|
||||
cancelBtn.setLayoutData(gd);
|
||||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
closeDisplay();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the display.
|
||||
*/
|
||||
public void closeDisplay() {
|
||||
try {
|
||||
// Unregister for all alert notifications on this monitor
|
||||
for (String p : SnowMonitor.pluginName) {
|
||||
snow.stopObserver(p, snow);
|
||||
}
|
||||
// Kill the monitor
|
||||
snow.nullifyMonitor();
|
||||
} catch (NullPointerException e) {
|
||||
// Dispose the dialog
|
||||
shell.dispose();
|
||||
}
|
||||
// Dispose the dialog
|
||||
shell.dispose();
|
||||
}
|
||||
|
||||
/**
|
||||
* This method puts the guardian threat priority in the label
|
||||
*/
|
||||
@Override
|
||||
public void putPriority(ObConst.ThreatLevel threatPriority) {
|
||||
try {
|
||||
switch (threatPriority) {
|
||||
case BLACK:
|
||||
guardianLbl.setBackground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_BLACK));
|
||||
break;
|
||||
case GRAY:
|
||||
guardianLbl.setBackground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_GRAY));
|
||||
break;
|
||||
case GREEN:
|
||||
guardianLbl.setBackground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_GREEN));
|
||||
break;
|
||||
case YELLOW:
|
||||
guardianLbl.setBackground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_YELLOW));
|
||||
break;
|
||||
case RED:
|
||||
guardianLbl.setBackground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_RED));
|
||||
break;
|
||||
default:
|
||||
guardianLbl.setBackground(getDisplay().getSystemColor(
|
||||
SWT.COLOR_GRAY));
|
||||
break;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* This method puts the guardian threat message in the text control
|
||||
*/
|
||||
@Override
|
||||
public void putMessage(String threatMessage) {
|
||||
try {
|
||||
threatMessageViewerStTxt.setText(threatMessage);
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -30,20 +30,54 @@ import com.raytheon.uf.viz.monitor.snow.threshold.SnowThresholdMgr;
|
|||
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg;
|
||||
|
||||
/**
|
||||
* Snow Monitor/Display Threshold Dialog.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Dec 7, 2012 #1351 skorolev Cleaned up code.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author skorolev
|
||||
* @version 1.0
|
||||
*/
|
||||
public class SnowMonDispThreshDlg extends MonitorDisplayThreshDlg {
|
||||
/** Display Product Table. **/
|
||||
private SnowDisplayProductTab displayProductTab;
|
||||
|
||||
/** Display Wind Table **/
|
||||
private SnowDisplayWindTab displayWindTab;
|
||||
|
||||
/** Display Meteo Table **/
|
||||
private SnowDisplayMeteoTab displayMeteoTab;
|
||||
|
||||
/** Monitor Meteo Table **/
|
||||
private SnowMonitorMeteoTab monitorMeteoTab;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param parent
|
||||
* @param appName
|
||||
* @param displayType
|
||||
*/
|
||||
public SnowMonDispThreshDlg(Shell parent, CommonConfig.AppName appName,
|
||||
DataUsageKey displayType) {
|
||||
super(parent, appName, displayType);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg#createTabItems
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
protected void createTabItems() {
|
||||
if (displayType == DataUsageKey.DISPLAY) {
|
||||
|
@ -53,6 +87,9 @@ public class SnowMonDispThreshDlg extends MonitorDisplayThreshDlg {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Display Tables.
|
||||
*/
|
||||
private void createDisplayTabs() {
|
||||
TabItem productTab = new TabItem(tabFolder, SWT.NONE);
|
||||
productTab.setText("Product");
|
||||
|
@ -70,6 +107,9 @@ public class SnowMonDispThreshDlg extends MonitorDisplayThreshDlg {
|
|||
meteoTab.setControl(displayMeteoTab);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates Monitor Tables.
|
||||
*/
|
||||
private void createMonitorTabs() {
|
||||
TabItem meteoTab = new TabItem(tabFolder, SWT.NONE);
|
||||
meteoTab.setText("Meteo");
|
||||
|
@ -77,6 +117,12 @@ public class SnowMonDispThreshDlg extends MonitorDisplayThreshDlg {
|
|||
meteoTab.setControl(monitorMeteoTab);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg#
|
||||
* commitChangeAction()
|
||||
*/
|
||||
@Override
|
||||
protected void commitChangeAction() {
|
||||
if (displayType == DataUsageKey.DISPLAY) {
|
||||
|
@ -86,17 +132,29 @@ public class SnowMonDispThreshDlg extends MonitorDisplayThreshDlg {
|
|||
|
||||
SnowMonitor.getInstance().thresholdUpdate(null);
|
||||
|
||||
} else if (displayType == DataUsageKey.MONITOR) {
|
||||
} else if (displayType == DataUsageKey.MONITOR) {
|
||||
monitorMeteoTab.commitDataToXML();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg#
|
||||
* getThresholdMgr()
|
||||
*/
|
||||
@Override
|
||||
protected AbstractThresholdMgr getThresholdMgr() {
|
||||
SnowThresholdMgr stm = SnowThresholdMgr.getInstance();
|
||||
return stm;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.uf.viz.monitor.ui.dialogs.MonitorDisplayThreshDlg#
|
||||
* reloadThresholds()
|
||||
*/
|
||||
@Override
|
||||
protected void reloadThresholds() {
|
||||
displayProductTab.reloadData();
|
||||
|
|
|
@ -52,6 +52,7 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.ZoneTableDlg;
|
|||
* Dec 18, 2009 3424 zhao use ObMultiHrsReports for obs data archive
|
||||
* July 20,2010 4891 skorolev added code to fireDialogShutdown
|
||||
* Nov. 8, 2012 1297 skorolev Added initiateProdArray method
|
||||
* Dec 7, 2012 1351 skorolev Changes for non-blocking dialogs
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -118,9 +119,8 @@ public class SnowZoneTableDlg extends ZoneTableDlg {
|
|||
if (snowThreshDlg == null) {
|
||||
snowThreshDlg = new SnowMonDispThreshDlg(getParent().getShell(),
|
||||
CommonConfig.AppName.SNOW, DataUsageKey.DISPLAY);
|
||||
snowThreshDlg.open();
|
||||
snowThreshDlg = null;
|
||||
}
|
||||
snowThreshDlg.open();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -26,18 +26,19 @@ import org.eclipse.swt.layout.GridData;
|
|||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Dialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Layout;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.TabFolder;
|
||||
|
||||
import com.raytheon.uf.common.localization.LocalizationFile;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig;
|
||||
import com.raytheon.uf.common.monitor.data.CommonConfig.AppName;
|
||||
import com.raytheon.uf.common.monitor.data.ObConst.DataUsageKey;
|
||||
import com.raytheon.uf.viz.monitor.thresholds.AbstractThresholdMgr;
|
||||
import com.raytheon.uf.viz.monitor.ui.dialogs.LoadSaveDeleteSelectDlg.DialogType;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||
|
||||
/**
|
||||
* Abstract dialog class that is the foundation for the Monitor and Display
|
||||
|
@ -49,7 +50,8 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.LoadSaveDeleteSelectDlg.DialogType
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Apr 6, 2009 lvenable Initial creation
|
||||
* Jun 17, 2010 5551,5548 skorolev Add "Open" and "Help" menu items
|
||||
* Jun 17, 2010 5551,5548 skorolev Add "Open" and "Help" menu itemsec
|
||||
* Dec 6, 2012 #1351 skorolev Changes for non-blocking dialogs.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,37 +59,38 @@ import com.raytheon.uf.viz.monitor.ui.dialogs.LoadSaveDeleteSelectDlg.DialogType
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public abstract class MonitorDisplayThreshDlg extends Dialog {
|
||||
/**
|
||||
* Dialog shell.
|
||||
*/
|
||||
protected Shell shell;
|
||||
|
||||
/**
|
||||
* The display control.
|
||||
*/
|
||||
protected Display display;
|
||||
public abstract class MonitorDisplayThreshDlg extends CaveSWTDialog {
|
||||
|
||||
/**
|
||||
* Tab folder.
|
||||
*/
|
||||
protected TabFolder tabFolder;
|
||||
|
||||
/**
|
||||
* Return value for the open method.
|
||||
*/
|
||||
private Boolean returnValue = false;
|
||||
|
||||
/**
|
||||
* Application name.
|
||||
*/
|
||||
protected CommonConfig.AppName appName;
|
||||
protected AppName appName;
|
||||
|
||||
/**
|
||||
* Display type (Monitor/Display).
|
||||
*/
|
||||
protected DataUsageKey displayType;
|
||||
|
||||
/** File menu Open **/
|
||||
private LoadSaveDeleteSelectDlg openDlg;
|
||||
|
||||
/** File menu Save **/
|
||||
private LoadSaveDeleteSelectDlg saveDlg;
|
||||
|
||||
/** File menu Save As **/
|
||||
private LoadSaveDeleteSelectDlg saveAsDlg;
|
||||
|
||||
/** File menu Select **/
|
||||
private LoadSaveDeleteSelectDlg selectDlg;
|
||||
|
||||
/** File menu Delete **/
|
||||
private LoadSaveDeleteSelectDlg deleteDlg;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -98,70 +101,64 @@ public abstract class MonitorDisplayThreshDlg extends Dialog {
|
|||
* @param displayType
|
||||
* Display type.
|
||||
*/
|
||||
public MonitorDisplayThreshDlg(Shell parent, CommonConfig.AppName appName,
|
||||
public MonitorDisplayThreshDlg(Shell parent, AppName appName,
|
||||
DataUsageKey displayType) {
|
||||
super(parent, 0);
|
||||
|
||||
this.appName = appName;
|
||||
this.displayType = displayType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Open method used to display the dialog.
|
||||
*
|
||||
* @return True/False.
|
||||
*/
|
||||
public Object open() {
|
||||
Shell parent = getParent();
|
||||
display = parent.getDisplay();
|
||||
shell = new Shell(parent, SWT.DIALOG_TRIM);
|
||||
|
||||
// Create the main layout for the shell.
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
mainLayout.marginHeight = 2;
|
||||
mainLayout.marginWidth = 2;
|
||||
mainLayout.verticalSpacing = 2;
|
||||
shell.setLayout(mainLayout);
|
||||
shell.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true, false));
|
||||
|
||||
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK
|
||||
| CAVE.INDEPENDENT_SHELL);
|
||||
// Set the dialog title
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(appName.name()).append(": ");
|
||||
|
||||
if (displayType == DataUsageKey.MONITOR) {
|
||||
sb.append("Configure Monitor Thresholds");
|
||||
} else {
|
||||
sb.append("Configure Display Thresholds");
|
||||
}
|
||||
setText(sb.toString());
|
||||
this.appName = appName;
|
||||
this.displayType = displayType;
|
||||
}
|
||||
|
||||
shell.setText(sb.toString());
|
||||
// Create the main layout for the shell.
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
|
||||
*/
|
||||
@Override
|
||||
protected Layout constructShellLayout() {
|
||||
GridLayout mainLayout = new GridLayout(1, false);
|
||||
mainLayout.marginHeight = 2;
|
||||
mainLayout.marginWidth = 2;
|
||||
mainLayout.verticalSpacing = 2;
|
||||
return mainLayout;
|
||||
}
|
||||
|
||||
// Initialize all of the controls and layouts
|
||||
initializeComponents();
|
||||
|
||||
shell.pack();
|
||||
|
||||
shell.open();
|
||||
while (!shell.isDisposed()) {
|
||||
if (!display.readAndDispatch()) {
|
||||
display.sleep();
|
||||
}
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayoutData()
|
||||
*/
|
||||
@Override
|
||||
protected Object constructShellLayoutData() {
|
||||
return new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the components on the display.
|
||||
*/
|
||||
private void initializeComponents() {
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
|
||||
* .eclipse.swt.widgets.Shell)
|
||||
*/
|
||||
@Override
|
||||
protected void initializeComponents(Shell shell) {
|
||||
createMenu();
|
||||
|
||||
createTabFolder();
|
||||
|
||||
createTabItems();
|
||||
|
||||
createCommitChangesButton();
|
||||
}
|
||||
|
||||
|
@ -176,8 +173,6 @@ public abstract class MonitorDisplayThreshDlg extends Dialog {
|
|||
shell.setMenuBar(menuBar);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the File menu.
|
||||
*
|
||||
|
@ -212,7 +207,7 @@ public abstract class MonitorDisplayThreshDlg extends Dialog {
|
|||
exitMI.setText("Exit");
|
||||
exitMI.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -223,10 +218,10 @@ public abstract class MonitorDisplayThreshDlg extends Dialog {
|
|||
* @param menuBar
|
||||
* Menu bar.
|
||||
*/
|
||||
private void createHelpMenu(Menu menuBar) {
|
||||
private void createHelpMenu(Menu menuBar) {
|
||||
MenuItem helpMenuItem = new MenuItem(menuBar, SWT.CASCADE);
|
||||
helpMenuItem.setText("&Help");
|
||||
// TODO Should be enhanced in the future versions.
|
||||
// TODO Should be enhanced in the future versions.
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -246,7 +241,7 @@ public abstract class MonitorDisplayThreshDlg extends Dialog {
|
|||
menuOpenAction();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
MenuItem saveAsMI = new MenuItem(fileMenu, SWT.NONE);
|
||||
saveAsMI.setText("Save As...");
|
||||
saveAsMI.addSelectionListener(new SelectionAdapter() {
|
||||
|
@ -278,24 +273,26 @@ public abstract class MonitorDisplayThreshDlg extends Dialog {
|
|||
menuDeleteAction();
|
||||
}
|
||||
});
|
||||
|
||||
new MenuItem(fileMenu, SWT.SEPARATOR);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the Monitor menu items under the File menu
|
||||
*
|
||||
* @param fileMenu
|
||||
*/
|
||||
private void createMonitorFileMenuItems(Menu fileMenu) {
|
||||
/*
|
||||
* Create the Display menu items under the File menu
|
||||
*/
|
||||
MenuItem saveMI = new MenuItem(fileMenu, SWT.NONE);
|
||||
saveMI.setText("Save");
|
||||
saveMI.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
menuSaveAction();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the tab folder for the threshold tabs.
|
||||
* Creates the tab folder for the threshold tabs.
|
||||
*/
|
||||
private void createTabFolder() {
|
||||
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
|
||||
|
@ -319,26 +316,43 @@ public abstract class MonitorDisplayThreshDlg extends Dialog {
|
|||
commitBtn.addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
commitChangeAction();
|
||||
shell.dispose();
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Menu Delete Action.
|
||||
*/
|
||||
protected void menuDeleteAction() {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.DELETE, atm.getDisplayThresholdPath(), atm
|
||||
.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
if (deleteDlg == null) {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
deleteDlg = new LoadSaveDeleteSelectDlg(shell, DialogType.DELETE,
|
||||
atm.getDisplayThresholdPath(),
|
||||
atm.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
deleteDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof LocalizationFile) {
|
||||
LocalizationFile fileName = (LocalizationFile) returnValue;
|
||||
doDelete(fileName);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
}
|
||||
deleteDlg.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes file.
|
||||
*
|
||||
* @param fileName
|
||||
*/
|
||||
protected void doDelete(LocalizationFile fileName) {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
boolean deletedUserSelected = atm.deleteFile(fileName);
|
||||
|
||||
if (deletedUserSelected == true) {
|
||||
reloadThresholds();
|
||||
}
|
||||
|
@ -349,30 +363,39 @@ public abstract class MonitorDisplayThreshDlg extends Dialog {
|
|||
*/
|
||||
protected void menuLoadDefaultAction() {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
|
||||
atm.loadDefaultDisplayThreshold();
|
||||
|
||||
reloadThresholds();
|
||||
}
|
||||
|
||||
/**
|
||||
* Menu SaveAs Action.
|
||||
*/
|
||||
protected void menuSaveAsAction() {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.SAVE_AS, atm.getDisplayThresholdPath(), atm
|
||||
.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
if (saveAsDlg == null) {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
saveAsDlg = new LoadSaveDeleteSelectDlg(shell, DialogType.SAVE_AS,
|
||||
atm.getDisplayThresholdPath(),
|
||||
atm.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
saveAsDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof LocalizationFile) {
|
||||
LocalizationFile fileName = (LocalizationFile) returnValue;
|
||||
doSaveAs(fileName);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
saveAsDlg.open();
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
/**
|
||||
* Saves file as ...
|
||||
*
|
||||
* @param fileName
|
||||
*/
|
||||
protected void doSaveAs(LocalizationFile fileName) {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
atm.saveAsDisplayThresholds(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
|
@ -381,23 +404,31 @@ public abstract class MonitorDisplayThreshDlg extends Dialog {
|
|||
* Display thresholds.
|
||||
*/
|
||||
protected void menuSelectAsDefaultAction() {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.SELECT_DEFAULT, atm.getDisplayThresholdPath(), atm
|
||||
.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
if (selectDlg == null) {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
selectDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.SELECT_DEFAULT, atm.getDisplayThresholdPath(),
|
||||
atm.getDefaultFileName(DataUsageKey.DISPLAY));
|
||||
selectDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof LocalizationFile) {
|
||||
LocalizationFile fileName = (LocalizationFile) returnValue;
|
||||
doSelect(fileName);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
selectDlg.open();
|
||||
}
|
||||
|
||||
System.out.println("Selected file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out.println("Selected file name = "
|
||||
+ fileName.getFile().getName());
|
||||
|
||||
/**
|
||||
* Selects default file.
|
||||
*
|
||||
* @param fileName
|
||||
*/
|
||||
protected void doSelect(LocalizationFile fileName) {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
atm.setDefaultDisplayFileName(fileName.getFile().getName());
|
||||
}
|
||||
|
||||
|
@ -406,40 +437,64 @@ public abstract class MonitorDisplayThreshDlg extends Dialog {
|
|||
*/
|
||||
protected void menuSaveAction() {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
|
||||
atm.saveMonitorThresholds();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used for opening threshold file to be used for the Display
|
||||
* thresholds.
|
||||
*/
|
||||
protected void menuOpenAction() {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
|
||||
LoadSaveDeleteSelectDlg lsDlg = new LoadSaveDeleteSelectDlg(shell,
|
||||
DialogType.OPEN, atm.getDisplayThresholdPath(), null);
|
||||
LocalizationFile fileName = (LocalizationFile) lsDlg.open();
|
||||
if (fileName == null) {
|
||||
System.out.println("FileName is null...");
|
||||
return;
|
||||
if (openDlg == null) {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
openDlg = new LoadSaveDeleteSelectDlg(shell, DialogType.OPEN,
|
||||
atm.getDisplayThresholdPath(), null);
|
||||
openDlg.setCloseCallback(new ICloseCallback() {
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof LocalizationFile) {
|
||||
LocalizationFile fileName = (LocalizationFile) returnValue;
|
||||
doOpen(fileName);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
openDlg.open();
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens file.
|
||||
*
|
||||
* @param fileName
|
||||
*/
|
||||
protected void doOpen(LocalizationFile fileName) {
|
||||
AbstractThresholdMgr atm = getThresholdMgr();
|
||||
atm.loadDisplayThreashold(fileName.getFile().getName());
|
||||
reloadThresholds();
|
||||
System.out.println("Opened file absolute path= "
|
||||
+ fileName.getFile().getAbsolutePath());
|
||||
System.out
|
||||
.println("Opened file name = " + fileName.getFile().getName());
|
||||
|
||||
}
|
||||
|
||||
// Abstract method for creating the tab items in the tab folder.
|
||||
|
||||
/**
|
||||
* Abstract method for creating the tab items in the tab folder.
|
||||
* Creates Table Items.
|
||||
*/
|
||||
protected abstract void createTabItems();
|
||||
|
||||
/**
|
||||
* Commit Change Action.
|
||||
*/
|
||||
protected abstract void commitChangeAction();
|
||||
|
||||
/**
|
||||
* Reloads Thresholds.
|
||||
*/
|
||||
protected abstract void reloadThresholds();
|
||||
|
||||
/**
|
||||
* Gets Threshold Manager.
|
||||
*
|
||||
* @return manager
|
||||
*/
|
||||
protected abstract AbstractThresholdMgr getThresholdMgr();
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue