Merge "Issue #1353 Changes for non-blocking AlertAlarmValuesDlg, GetAppsDefaults, SHEFAppsDefaultsDlg and BestEstimateQpeDlg." into development

Former-commit-id: 3a4eb415f2 [formerly 59b2cf8872] [formerly 8e7143967b [formerly 050d9cebb8de520c7ed0d27c686ebf84dc6d084c]]
Former-commit-id: 8e7143967b
Former-commit-id: f3b9d1cb38
This commit is contained in:
Lee Venable 2012-12-10 11:28:34 -06:00 committed by Gerrit Code Review
commit 17b9e0077c
7 changed files with 175 additions and 157 deletions

View file

@ -36,6 +36,7 @@ import org.eclipse.ui.PlatformUI;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 6/27/07 lvenable Initial creation. * 6/27/07 lvenable Initial creation.
* 12/05/12 1353 rferrel Changes for non-blocking AlertAlarmValuesDlg.
* *
* </pre> * </pre>
* *
@ -43,13 +44,16 @@ import org.eclipse.ui.PlatformUI;
* *
*/ */
public class AlertAlarmValuesAction extends AbstractHandler { public class AlertAlarmValuesAction extends AbstractHandler {
private AlertAlarmValuesDlg alertAlarmDlg;
@Override @Override
public Object execute(ExecutionEvent arg0) throws ExecutionException { public Object execute(ExecutionEvent arg0) throws ExecutionException {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() if (alertAlarmDlg == null) {
.getShell(); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
AlertAlarmValuesDlg alertAlarmDlg = new AlertAlarmValuesDlg(shell); .getShell();
alertAlarmDlg = new AlertAlarmValuesDlg(shell);
}
alertAlarmDlg.open(); alertAlarmDlg.open();
return null; return null;

View file

@ -27,8 +27,8 @@ import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.LOWER_CHECKS
import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.ROC_CHECKSTR; import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.ROC_CHECKSTR;
import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.UPPER_CHECKSTR; import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.UPPER_CHECKSTR;
import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.alertAlarmTimeFormat; import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.alertAlarmTimeFormat;
import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.dbDatabaseFormat;
import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.db2DatabaseFormat; import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.db2DatabaseFormat;
import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.dbDatabaseFormat;
import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.smallerTime; import static com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.smallerTime;
import java.util.ArrayList; import java.util.ArrayList;
@ -53,6 +53,9 @@ import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery; import com.raytheon.uf.viz.core.catalog.DirectDbQuery;
import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage; import com.raytheon.uf.viz.core.catalog.DirectDbQuery.QueryLanguage;
import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.exception.VizException;
@ -60,7 +63,7 @@ import com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.AaOption;
import com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.CheckOption; import com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.CheckOption;
import com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.TypeOption; import com.raytheon.viz.hydro.alertalarm.AlertAlarmConstants.TypeOption;
import com.raytheon.viz.hydro.timeseries.TimeSeriesDlg; import com.raytheon.viz.hydro.timeseries.TimeSeriesDlg;
import com.raytheon.viz.hydro.timeseries.util.*; import com.raytheon.viz.hydro.timeseries.util.TimeSeriesUtil;
import com.raytheon.viz.hydrocommon.HydroConstants; import com.raytheon.viz.hydrocommon.HydroConstants;
import com.raytheon.viz.hydrocommon.datamanager.IhfsAlertalarmvalData; import com.raytheon.viz.hydrocommon.datamanager.IhfsAlertalarmvalData;
import com.raytheon.viz.hydrocommon.datamanager.IhfsLocdatalimitsData; import com.raytheon.viz.hydrocommon.datamanager.IhfsLocdatalimitsData;
@ -79,6 +82,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* May, 2011 9359 Jingtao Deng Updated queryLocdatalimits(), check locdatalimits table * May, 2011 9359 Jingtao Deng Updated queryLocdatalimits(), check locdatalimits table
* first, is not existing, check for datalimits table as defaults. * first, is not existing, check for datalimits table as defaults.
* Both not existing, set as MISSING * Both not existing, set as MISSING
* Dec 07, 2012 1353 rferrel Make dialog non-blocking.
* *
* </pre> * </pre>
* *
@ -88,6 +92,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
*/ */
public class AlertAlarmValuesDlg extends CaveSWTDialog implements public class AlertAlarmValuesDlg extends CaveSWTDialog implements
IhfsAlertalarmvalData, IhfsLocdatalimitsData { IhfsAlertalarmvalData, IhfsLocdatalimitsData {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(AlertAlarmValuesDlg.class);
/** /**
* Font used for the data list. * Font used for the data list.
@ -128,6 +134,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
* List containing valid times in database format. * List containing valid times in database format.
*/ */
private java.util.List<String> dataValidTimes = new ArrayList<String>(); private java.util.List<String> dataValidTimes = new ArrayList<String>();
private java.util.List<String> dataBasisTimes = new ArrayList<String>(); private java.util.List<String> dataBasisTimes = new ArrayList<String>();
/** /**
@ -194,8 +201,9 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
* Currently selected location ID. * Currently selected location ID.
*/ */
private String selectedLid; private String selectedLid;
private String selectedPe; private String selectedPe;
private String selectedDur; private String selectedDur;
/** /**
@ -206,7 +214,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
*/ */
public AlertAlarmValuesDlg(Shell parent) { public AlertAlarmValuesDlg(Shell parent) {
super(parent); super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText("Alert and Alarm Data Values"); setText("Alert and Alarm Data Values");
} }
@ -494,19 +502,15 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
if (locationRdo.getSelection()) { if (locationRdo.getSelection()) {
if (getType() != TypeOption.FCST) { if (getType() != TypeOption.FCST) {
myQuery myQuery.append(" order by aav.lid, aav.validtime desc, aav.ts asc, aav.basistime desc");
.append(" order by aav.lid, aav.validtime desc, aav.ts asc, aav.basistime desc");
} else { } else {
myQuery myQuery.append(" order by aav.lid, aav.validtime asc, aav.ts asc, aav.basistime desc");
.append(" order by aav.lid, aav.validtime asc, aav.ts asc, aav.basistime desc");
} }
} else { } else {
if (getType() != TypeOption.FCST) { if (getType() != TypeOption.FCST) {
myQuery myQuery.append(" order by aav.validtime desc, aav.lid, aav.basistime desc");
.append(" order by aav.validtime desc, aav.lid, aav.basistime desc");
} else { } else {
myQuery myQuery.append(" order by aav.validtime asc, aav.lid, aav.basistime desc");
.append(" order by aav.validtime asc, aav.lid, aav.basistime desc");
} }
} }
@ -514,7 +518,6 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
smallerTime.setTimeZone(TimeZone.getTimeZone("UTC")); smallerTime.setTimeZone(TimeZone.getTimeZone("UTC"));
dbDatabaseFormat.setTimeZone(TimeZone.getTimeZone("UTC")); dbDatabaseFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
db2DatabaseFormat.setTimeZone(TimeZone.getTimeZone("UTC")); db2DatabaseFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
try { try {
dataList.removeAll(); dataList.removeAll();
@ -527,7 +530,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
/* /*
* don't bother showing the following fields: probability value, * don't bother showing the following fields: probability value,
* shef revision code, action time. If aa_check is not 'roc' or * shef revision code, action time. If aa_check is not 'roc' or
* 'diff', then assign the value of * 'roc' or 'diff' as "--". * 'diff', then assign the value of * 'roc' or 'diff' as "--".
*/ */
if ((rowData[8].toString().trim().equals("roc")) if ((rowData[8].toString().trim().equals("roc"))
@ -553,25 +556,26 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
basisTimeValue = smallerTime.format((Date) rowData[11]); basisTimeValue = smallerTime.format((Date) rowData[11]);
} }
String QcSymbol=TimeSeriesUtil.buildQcSymbol(Long.parseLong(rowData[7].toString())); String QcSymbol = TimeSeriesUtil.buildQcSymbol(Long
.parseLong(rowData[7].toString()));
tmpStr = String.format(fmtStr, rowData[0].toString(), tmpStr = String.format(fmtStr, rowData[0].toString(),
rowData[12].toString(), rowData[1].toString(), rowData[12].toString(), rowData[1].toString(),
rowData[2], rowData[3].toString(), rowData[4] rowData[2], rowData[3].toString(),
.toString(), rowData[5], supplValue, rowData[4].toString(), rowData[5], supplValue,
QcSymbol, rowData[8].toString(), rowData[9] QcSymbol, rowData[8].toString(), rowData[9].toString(),
.toString(), smallerTime smallerTime.format((Date) rowData[10]), basisTimeValue,
.format((Date) rowData[10]), basisTimeValue, rowData[11].toString());
rowData[11].toString());
/* load the list strings. */ /* load the list strings. */
dataList.add(tmpStr); dataList.add(tmpStr);
dataList.setSelection(0); dataList.setSelection(0);
dataValidTimes.add(dbDatabaseFormat.format((Date) rowData[10])); dataValidTimes.add(dbDatabaseFormat.format((Date) rowData[10]));
dataBasisTimes.add(db2DatabaseFormat.format((Date) rowData[11])); dataBasisTimes
} .add(db2DatabaseFormat.format((Date) rowData[11]));
}
} catch (VizException e) { } catch (VizException e) {
e.printStackTrace(); statusHandler.handle(Priority.PROBLEM, e.getMessage(), e);
} }
} }
@ -632,7 +636,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
} }
} }
} catch (VizException e) { } catch (VizException e) {
e.printStackTrace(); statusHandler.handle(Priority.PROBLEM, e.getMessage(), e);
} }
} }
@ -641,26 +645,25 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
* Prompts the user to delete the current record * Prompts the user to delete the current record
*/ */
private void deleteRecord() { private void deleteRecord() {
if (dataList.getSelectionIndex() != -1) { if (dataList.getSelectionIndex() != -1) {
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION | SWT.OK
| SWT.CANCEL); | SWT.CANCEL);
mb.setText("Delete Confirmation"); mb.setText("Delete Confirmation");
mb.setMessage("Do you wish to delete this entry?"); mb.setMessage("Do you wish to delete this entry?");
int result = mb.open(); int result = mb.open();
if (result == SWT.OK) { if (result == SWT.OK) {
try{ try {
deleteAlertalarmvalSelected(dataList.getSelectionIndex()); deleteAlertalarmvalSelected(dataList.getSelectionIndex());
queryAlertalarmval(); queryAlertalarmval();
} catch (VizException e) { } catch (VizException e) {
MessageBox mbFail = new MessageBox(shell, SWT.ICON_ERROR MessageBox mbFail = new MessageBox(shell, SWT.ICON_ERROR
| SWT.OK); | SWT.OK);
mbFail.setText("Unable to Delete"); mbFail.setText("Unable to Delete");
mbFail.setMessage("Unable to Delete Record"); mbFail.setMessage("Unable to Delete Record");
mbFail.open(); mbFail.open();
statusHandler.handle(Priority.PROBLEM, e.getMessage(), e);
e.printStackTrace();
} }
} }
} else { } else {
@ -670,12 +673,13 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
mb.open(); mb.open();
} }
} }
// ------------------------------------------------------------ // ------------------------------------------------------------
// Delete the selected item in the data list from alertalarmval. // Delete the selected item in the data list from alertalarmval.
// ------------------------------------------------------------ // ------------------------------------------------------------
@Override @Override
public void deleteAlertalarmvalSelected(int alertAlarmIndex) throws VizException { public void deleteAlertalarmvalSelected(int alertAlarmIndex)
throws VizException {
// Query 'alertalarmval' table in ihfs database and delete selected item // Query 'alertalarmval' table in ihfs database and delete selected item
// using SQL. // using SQL.
StringBuilder myQuery = new StringBuilder( StringBuilder myQuery = new StringBuilder(
@ -696,13 +700,13 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
myQuery.append(selectedLid); myQuery.append(selectedLid);
myQuery.append("')"); myQuery.append("')");
myQuery.append(" AND "); myQuery.append(" AND ");
// String selectedPe = selectedItems[index++]; // String selectedPe = selectedItems[index++];
selectedPe = selectedItems[index++]; selectedPe = selectedItems[index++];
myQuery.append("(aav.pe = '"); myQuery.append("(aav.pe = '");
myQuery.append(selectedPe); myQuery.append(selectedPe);
myQuery.append("')"); myQuery.append("')");
myQuery.append(" AND "); myQuery.append(" AND ");
// String selectedDur = selectedItems[index++]; // String selectedDur = selectedItems[index++];
selectedDur = selectedItems[index++]; selectedDur = selectedItems[index++];
myQuery.append("(aav.dur = '"); myQuery.append("(aav.dur = '");
myQuery.append(selectedDur); myQuery.append(selectedDur);
@ -738,16 +742,16 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
myQuery.append("(aav.basistime = '"); myQuery.append("(aav.basistime = '");
myQuery.append(basisTimeStr); myQuery.append(basisTimeStr);
myQuery.append("')"); myQuery.append("')");
// ------------------------------------------------------------- // -------------------------------------------------------------
// Query the Alertalarmval Table in the IHFS database using SQL. // Query the Alertalarmval Table in the IHFS database using SQL.
// ------------------------------------------------------------- // -------------------------------------------------------------
try { try {
int status = DirectDbQuery.executeStatement(myQuery.toString(), HydroConstants.IHFS, DirectDbQuery.executeStatement(myQuery.toString(),
QueryLanguage.SQL); HydroConstants.IHFS, QueryLanguage.SQL);
} catch (VizException e) { } catch (VizException e) {
e.printStackTrace(); statusHandler.handle(Priority.PROBLEM, e.getMessage(), e);
} }
} }
@ -759,20 +763,21 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
@Override @Override
public void queryLocdatalimits() { public void queryLocdatalimits() {
//retrieve from location based locdatalimits table // retrieve from location based locdatalimits table
StringBuilder myQuery = new StringBuilder( StringBuilder myQuery = new StringBuilder(
"select ldl.alert_upper_limit, ldl.alert_lower_limit, ldl.alert_roc_limit, ldl.alert_diff_limit, ldl.alarm_upper_limit, ldl.alarm_lower_limit, ldl.alarm_roc_limit, ldl.alarm_diff_limit from locdatalimits ldl"); "select ldl.alert_upper_limit, ldl.alert_lower_limit, ldl.alert_roc_limit, ldl.alert_diff_limit, ldl.alarm_upper_limit, ldl.alarm_lower_limit, ldl.alarm_roc_limit, ldl.alarm_diff_limit from locdatalimits ldl");
ArrayList<Object[]> loclimitData; ArrayList<Object[]> loclimitData;
myQuery.append(" where ldl.lid = '"); myQuery.append(" where ldl.lid = '");
myQuery.append(selectedLid); myQuery.append(selectedLid);
myQuery.append("'"); myQuery.append("'");
Boolean loclimitsFound = true; Boolean loclimitsFound = true;
Boolean deflimitsFound = true; Boolean deflimitsFound = true;
//retrieve from general datalimits table // retrieve from general datalimits table
StringBuilder dlQuery = new StringBuilder("select dl.alert_upper_limit, dl.alert_lower_limit, dl.alert_roc_limit, dl.alert_diff_limit, dl.alarm_upper_limit, dl.alarm_lower_limit, dl.alarm_roc_limit, dl.alarm_diff_limit from datalimits dl"); StringBuilder dlQuery = new StringBuilder(
"select dl.alert_upper_limit, dl.alert_lower_limit, dl.alert_roc_limit, dl.alert_diff_limit, dl.alarm_upper_limit, dl.alarm_lower_limit, dl.alarm_roc_limit, dl.alarm_diff_limit from datalimits dl");
ArrayList<Object[]> dataLimits; ArrayList<Object[]> dataLimits;
dlQuery.append(" where dl.pe = '"); dlQuery.append(" where dl.pe = '");
dlQuery.append(selectedPe); dlQuery.append(selectedPe);
@ -780,49 +785,48 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
dlQuery.append(" and dl.dur = '"); dlQuery.append(" and dl.dur = '");
dlQuery.append(selectedDur); dlQuery.append(selectedDur);
dlQuery.append("'"); dlQuery.append("'");
// ------------------------------------------------------------- // -------------------------------------------------------------
// Query the Locdatalimits Table in the IHFS database using SQL. // Query the Locdatalimits Table in the IHFS database using SQL.
// ------------------------------------------------------------- // -------------------------------------------------------------
try { try {
loclimitData = (ArrayList<Object[]>) DirectDbQuery.executeQuery( loclimitData = (ArrayList<Object[]>) DirectDbQuery.executeQuery(
myQuery.toString(), HydroConstants.IHFS, QueryLanguage.SQL); myQuery.toString(), HydroConstants.IHFS, QueryLanguage.SQL);
//if location specific range is not found, check the default range*/
if (loclimitData.size() == 0)
{
loclimitsFound = false;
try {
dataLimits = (ArrayList<Object[]>) DirectDbQuery.executeQuery(
dlQuery.toString(), HydroConstants.IHFS, QueryLanguage.SQL);
if (dataLimits.size() == 0)
deflimitsFound = false;
else
{
deflimitsFound = true;
for (Object[] rowData : dataLimits) {
setField(alertUpperLbl, (Double) rowData[0]);
setField(alertLowerLbl, (Double) rowData[1]);
setField(alertRocLbl, (Double) rowData[2]);
setField(alertDiffLbl, (Double) rowData[3]);
setField(alarmUpperLbl, (Double) rowData[4]); // if location specific range is not found, check the default
setField(alarmLowerLbl, (Double) rowData[5]); // range*/
setField(alarmRocLbl, (Double) rowData[6]); if (loclimitData.size() == 0) {
setField(alarmDiffLbl, (Double) rowData[7]); loclimitsFound = false;
return; try {
} dataLimits = (ArrayList<Object[]>) DirectDbQuery
} .executeQuery(dlQuery.toString(),
HydroConstants.IHFS, QueryLanguage.SQL);
} catch (VizException e) { if (dataLimits.size() == 0)
e.printStackTrace(); deflimitsFound = false;
} else {
deflimitsFound = true;
for (Object[] rowData : dataLimits) {
setField(alertUpperLbl, (Double) rowData[0]);
setField(alertLowerLbl, (Double) rowData[1]);
setField(alertRocLbl, (Double) rowData[2]);
setField(alertDiffLbl, (Double) rowData[3]);
setField(alarmUpperLbl, (Double) rowData[4]);
setField(alarmLowerLbl, (Double) rowData[5]);
setField(alarmRocLbl, (Double) rowData[6]);
setField(alarmDiffLbl, (Double) rowData[7]);
return;
}
}
} catch (VizException e) {
statusHandler.handle(Priority.PROBLEM, e.getMessage(), e);
}
} }
// location specific range is found // location specific range is found
if (loclimitsFound) { if (loclimitsFound) {
for (Object[] rowData : loclimitData) { for (Object[] rowData : loclimitData) {
setField(alertUpperLbl, (Double) rowData[0]); setField(alertUpperLbl, (Double) rowData[0]);
@ -836,21 +840,21 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
setField(alarmDiffLbl, (Double) rowData[7]); setField(alarmDiffLbl, (Double) rowData[7]);
} }
} }
// both location specific range and default range are not found, set to MISSING // both location specific range and default range are not found, set
else if (!deflimitsFound) // to MISSING
{ else if (!deflimitsFound) {
alertUpperLbl.setText(" MISSING "); alertUpperLbl.setText(" MISSING ");
alertLowerLbl.setText(" MISSING "); alertLowerLbl.setText(" MISSING ");
alertRocLbl.setText(" MISSING "); alertRocLbl.setText(" MISSING ");
alertDiffLbl.setText(" MISSING "); alertDiffLbl.setText(" MISSING ");
alarmUpperLbl.setText(" MISSING "); alarmUpperLbl.setText(" MISSING ");
alarmLowerLbl.setText(" MISSING "); alarmLowerLbl.setText(" MISSING ");
alarmRocLbl.setText(" MISSING "); alarmRocLbl.setText(" MISSING ");
alarmDiffLbl.setText(" MISSING "); alarmDiffLbl.setText(" MISSING ");
} }
} catch (VizException e) { } catch (VizException e) {
e.printStackTrace(); statusHandler.handle(Priority.PROBLEM, e.getMessage(), e);
} }
} }
@ -1065,7 +1069,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
deleteBtn.addSelectionListener(new SelectionAdapter() { deleteBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
deleteRecord(); deleteRecord();
} }
}); });
@ -1077,7 +1081,7 @@ public class AlertAlarmValuesDlg extends CaveSWTDialog implements
closeBtn.addSelectionListener(new SelectionAdapter() { closeBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
shell.dispose(); close();
} }
}); });
} }

View file

@ -35,6 +35,8 @@ import org.eclipse.ui.PlatformUI;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 26, 2011 mpduff Initial creation * Jan 26, 2011 mpduff Initial creation
* Dec 06, 2012 1353 rferrel Changes for non blocking GetAppsDefaults.
* Changes for non blocking SHEFAppsDefaultsDlg.
* *
* </pre> * </pre>
* *
@ -43,6 +45,9 @@ import org.eclipse.ui.PlatformUI;
*/ */
public class AppsDefaultsAction extends AbstractHandler { public class AppsDefaultsAction extends AbstractHandler {
private GetAppsDefaults gad;
private SHEFAppsDefaultsDlg dlg;
/* /*
* (non-Javadoc) * (non-Javadoc)
@ -57,11 +62,15 @@ public class AppsDefaultsAction extends AbstractHandler {
.getShell(); .getShell();
String action = event.getParameter("Action"); String action = event.getParameter("Action");
if (action.equals("gad")) { if (action.equals("gad")) {
GetAppsDefaults gad = new GetAppsDefaults(shell); if (gad == null) {
gad = new GetAppsDefaults(shell);
}
gad.open(); gad.open();
} else { } else {
SHEFAppsDefaultsDlg dlg = new SHEFAppsDefaultsDlg(shell); if (dlg == null) {
dlg.open(); dlg = new SHEFAppsDefaultsDlg(shell);
}
dlg.open();
} }
return null; return null;
} }

View file

@ -21,7 +21,6 @@ package com.raytheon.viz.hydro.appsdefaults;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.Font;
@ -37,20 +36,21 @@ import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/** /**
* TODO Add Description * Dialog to allow user to display desired application defaults.
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 26, 2011 mpduff Initial creation * Jan 26, 2011 mpduff Initial creation
* * Dec 07, 2012 1353 rferrel Make dialog non-blocking.
*
* </pre> * </pre>
* *
* @author mpduff * @author mpduff
* @version 1.0 * @version 1.0
*/ */
public class GetAppsDefaults extends CaveSWTDialog { public class GetAppsDefaults extends CaveSWTDialog {
@ -63,17 +63,17 @@ public class GetAppsDefaults extends CaveSWTDialog {
* The text area. * The text area.
*/ */
private Text textArea; private Text textArea;
/** /**
* The search text field. * The search text field.
*/ */
private Text searchField; private Text searchField;
/** /**
* The search button. * The search button.
*/ */
private Button searchButton; private Button searchButton;
private AppsDefaults appsDef = AppsDefaults.getInstance(); private AppsDefaults appsDef = AppsDefaults.getInstance();
/** /**
@ -83,7 +83,7 @@ public class GetAppsDefaults extends CaveSWTDialog {
* Parent shell. * Parent shell.
*/ */
public GetAppsDefaults(Shell parent) { public GetAppsDefaults(Shell parent) {
super(parent); super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText("GAD"); setText("GAD");
} }
@ -109,15 +109,16 @@ public class GetAppsDefaults extends CaveSWTDialog {
textArea.setFont(font); textArea.setFont(font);
textArea.setEditable(false); textArea.setEditable(false);
textArea.setLayoutData(gd); textArea.setLayoutData(gd);
textArea.getVerticalBar().setSelection(textArea.getVerticalBar().getMaximum()); textArea.getVerticalBar().setSelection(
textArea.getVerticalBar().getMaximum());
// Initialize search area // Initialize search area
Composite searchComp = new Composite(shell, SWT.NONE); Composite searchComp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(3, false); GridLayout gl = new GridLayout(3, false);
searchComp.setLayout(gl); searchComp.setLayout(gl);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false); gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
searchComp.setLayoutData(gd); searchComp.setLayoutData(gd);
gd = new GridData(35, SWT.DEFAULT); gd = new GridData(35, SWT.DEFAULT);
gd.widthHint = 175; gd.widthHint = 175;
Label l = new Label(searchComp, SWT.NONE); Label l = new Label(searchComp, SWT.NONE);
@ -127,34 +128,27 @@ public class GetAppsDefaults extends CaveSWTDialog {
searchField.setLayoutData(gd); searchField.setLayoutData(gd);
searchField.setEditable(true); searchField.setEditable(true);
searchField.setFocus(); searchField.setFocus();
searchField.addKeyListener(new KeyListener() { searchField.addKeyListener(new org.eclipse.swt.events.KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
}
@Override @Override
public void keyReleased(KeyEvent e) { public void keyReleased(KeyEvent e) {
if ((e.keyCode == 13) || (e.keyCode == 16777296)) { if ((e.keyCode == 13) || (e.keyCode == 16777296)) {
gad(); gad();
} }
} }
}); });
gd = new GridData(35, SWT.DEFAULT); gd = new GridData(35, SWT.DEFAULT);
gd.widthHint = 65; gd.widthHint = 65;
searchButton = new Button(searchComp, SWT.NONE); searchButton = new Button(searchComp, SWT.NONE);
searchButton.setText("Search"); searchButton.setText("Search");
searchButton.setLayoutData(gd); searchButton.setLayoutData(gd);
searchButton.addSelectionListener(new SelectionAdapter() { searchButton.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
gad(); gad();
} }
}); });
// Close button // Close button
Composite centeredComp = new Composite(shell, SWT.NONE); Composite centeredComp = new Composite(shell, SWT.NONE);
GridLayout gl2 = new GridLayout(1, false); GridLayout gl2 = new GridLayout(1, false);
@ -169,11 +163,11 @@ public class GetAppsDefaults extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() { closeBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
shell.dispose(); close();
} }
}); });
} }
private void gad() { private void gad() {
String token = searchField.getText(); String token = searchField.getText();
if ((token != null) && (token.length() > 0)) { if ((token != null) && (token.length() > 0)) {

View file

@ -41,6 +41,9 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.common.ohd.AppsDefaults; import com.raytheon.uf.common.ohd.AppsDefaults;
import com.raytheon.uf.common.serialization.SerializationException; import com.raytheon.uf.common.serialization.SerializationException;
import com.raytheon.uf.common.serialization.SerializationUtil; import com.raytheon.uf.common.serialization.SerializationUtil;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/** /**
@ -53,6 +56,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Jan 26, 2011 mpduff Initial creation * Jan 26, 2011 mpduff Initial creation
* Dec 07, 2012 1353 rferrel Make non-blocking dialog.
* *
* </pre> * </pre>
* *
@ -61,6 +65,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
*/ */
public class SHEFAppsDefaultsDlg extends CaveSWTDialog { public class SHEFAppsDefaultsDlg extends CaveSWTDialog {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(SHEFAppsDefaultsDlg.class);
private final String CONFIG_FILE_NAME = "hydro" + File.separatorChar private final String CONFIG_FILE_NAME = "hydro" + File.separatorChar
+ "shefGadTokens.xml"; + "shefGadTokens.xml";
@ -83,7 +90,7 @@ public class SHEFAppsDefaultsDlg extends CaveSWTDialog {
* Parent shell. * Parent shell.
*/ */
public SHEFAppsDefaultsDlg(Shell parent) { public SHEFAppsDefaultsDlg(Shell parent) {
super(parent); super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText("SHEF Apps_defaults Settings"); setText("SHEF Apps_defaults Settings");
populateTokenList(); populateTokenList();
} }
@ -166,13 +173,14 @@ public class SHEFAppsDefaultsDlg extends CaveSWTDialog {
if (file != null) { if (file != null) {
configPath = file.getAbsolutePath(); configPath = file.getAbsolutePath();
try { try {
SHEFAppsDefaultsXML xml = (SHEFAppsDefaultsXML) SerializationUtil SHEFAppsDefaultsXML xml = SerializationUtil
.jaxbUnmarshalFromXmlFile(configPath); .jaxbUnmarshalFromXmlFile(SHEFAppsDefaultsXML.class,
for (String token: xml.getTokenList()) { configPath);
for (String token : xml.getTokenList()) {
tokenList.add(token); tokenList.add(token);
} }
} catch (SerializationException e) { } catch (SerializationException e) {
e.printStackTrace(); statusHandler.handle(Priority.PROBLEM, e.getMessage(), e);
} }
} else { } else {
MessageBox messageBox = new MessageBox(this.getParent(), SWT.ERROR); MessageBox messageBox = new MessageBox(this.getParent(), SWT.ERROR);
@ -189,9 +197,6 @@ public class SHEFAppsDefaultsDlg extends CaveSWTDialog {
*/ */
@Override @Override
protected void disposed() { protected void disposed() {
super.disposed(); font.dispose();
if (font.isDisposed() == false) {
font.dispose();
}
} }
} }

View file

@ -40,6 +40,7 @@ import org.eclipse.ui.PlatformUI;
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* 6/27/06 randerso Initial Creation. * 6/27/06 randerso Initial Creation.
* 8/24/2009 2258 mpduff Removed not implemented message. * 8/24/2009 2258 mpduff Removed not implemented message.
* 12/05/1212 1363 rferrel Changes for non-blocking BestEstimateQpeDlg.
* *
* </pre> * </pre>
* *
@ -47,12 +48,15 @@ import org.eclipse.ui.PlatformUI;
* *
*/ */
public class BestEstimateQpeAction extends AbstractHandler { public class BestEstimateQpeAction extends AbstractHandler {
private BestEstimateQpeDlg bestEstimateDlg;
@Override @Override
public Object execute(ExecutionEvent arg0) throws ExecutionException { public Object execute(ExecutionEvent arg0) throws ExecutionException {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() if (bestEstimateDlg == null) {
.getShell(); Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
BestEstimateQpeDlg bestEstimateDlg = new BestEstimateQpeDlg(shell); .getShell();
bestEstimateDlg = new BestEstimateQpeDlg(shell);
}
bestEstimateDlg.open(); bestEstimateDlg.open();
return null; return null;

View file

@ -46,6 +46,9 @@ import org.eclipse.swt.widgets.Scale;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.common.time.SimulatedTime;
import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IDisplayPaneContainer;
import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.IDescriptor;
@ -67,6 +70,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 29 NOV 2007 373 lvenable Initial creation. * 29 NOV 2007 373 lvenable Initial creation.
* 21 May 2009 mpduff Fixed typo in window title. * 21 May 2009 mpduff Fixed typo in window title.
* 24 Aug 2009 2258 mpduff Implemented dialog functionality. * 24 Aug 2009 2258 mpduff Implemented dialog functionality.
* 07 Dec 2012 1353 rferrel Make dialog non-blocking.
* *
* </pre> * </pre>
* *
@ -75,6 +79,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* *
*/ */
public class BestEstimateQpeDlg extends CaveSWTDialog { public class BestEstimateQpeDlg extends CaveSWTDialog {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(BestEstimateQpeDlg.class);
/** /**
* QPE source Local radio button. * QPE source Local radio button.
@ -231,11 +237,6 @@ public class BestEstimateQpeDlg extends CaveSWTDialog {
*/ */
private Calendar cal = new GregorianCalendar(); private Calendar cal = new GregorianCalendar();
/**
* Currently looping flag.
*/
private boolean looping = false;
/** /**
* Constructor. * Constructor.
* *
@ -243,7 +244,7 @@ public class BestEstimateQpeDlg extends CaveSWTDialog {
* Parent shell. * Parent shell.
*/ */
public BestEstimateQpeDlg(Shell parent) { public BestEstimateQpeDlg(Shell parent) {
super(parent); super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText("Display Best Estimate QPE"); setText("Display Best Estimate QPE");
cal.setTimeZone(TimeZone.getTimeZone("GMT")); cal.setTimeZone(TimeZone.getTimeZone("GMT"));
dateTimeFmt.setTimeZone(TimeZone.getTimeZone("GMT")); dateTimeFmt.setTimeZone(TimeZone.getTimeZone("GMT"));
@ -711,7 +712,6 @@ public class BestEstimateQpeDlg extends CaveSWTDialog {
.getActiveVizContainer(); .getActiveVizContainer();
if (container != null) { if (container != null) {
container.getLoopProperties().setLooping(false); container.getLoopProperties().setLooping(false);
looping = false;
} }
} }
}); });
@ -734,7 +734,7 @@ public class BestEstimateQpeDlg extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() { closeBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
shell.dispose(); close();
} }
}); });
} }
@ -786,10 +786,8 @@ public class BestEstimateQpeDlg extends CaveSWTDialog {
displayManager.setLabels(labelsChk.getSelection()); displayManager.setLabels(labelsChk.getSelection());
try { try {
displayManager.displayQPE(); displayManager.displayQPE();
looping = true;
} catch (VizException e) { } catch (VizException e) {
// TODO Auto-generated catch block statusHandler.handle(Priority.PROBLEM, e.getMessage(), e);
e.printStackTrace();
} }
} }
} }