Issue #1578 Changes for non-blocking QuestionableBadDataDlg.

Change-Id: I872b351c983a825d646b213bc683f66cc0e13577

Former-commit-id: 81a9bdc034 [formerly 81a9bdc034 [formerly ed0cfb0fd11a1449d2e2f3e5f316181734a25b84]]
Former-commit-id: 33d9e6a001
Former-commit-id: 58c989a3bf
This commit is contained in:
Roger Ferrel 2013-02-07 15:27:55 -06:00
parent 262c99927e
commit c486edab44
4 changed files with 113 additions and 41 deletions

View file

@ -65,7 +65,7 @@ public class PDC_SaveDlg extends CaveSWTDialog {
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(PDC_SaveDlg.class);
/** Tile for Warning message dialog. */
/** Title for Warning message dialog. */
private final String PRESET_ERROR_TITLE = "Invalid Value";
/** Message when invalid new ID. */
@ -77,7 +77,7 @@ public class PDC_SaveDlg extends CaveSWTDialog {
/** Message when invalid new rank. */
private final String PRESET_RANK_ERROR = "Invalid Preset Rank.";
/** Tile for Error dialog when save fails. */
/** Title for Error dialog when save fails. */
private final String ERROR_TITLE = "Error Occurred";
/** Error message when save fails. */

View file

@ -59,6 +59,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 09 sep 2010 5399 lbousaidi changed constructor for both
* openTabularTimeSeries and openGraphTimeSeries
* 05 Feb 2013 1578 rferrel Changes for non-blocking singleton TimeSeriesDlg.
* Changes for non-blocking dialog.
*
* </pre>
*
@ -126,12 +127,12 @@ public class QuestionableBadDataDlg extends CaveSWTDialog {
/**
* Collection of questionable data.
*/
private ArrayList<QuestionableData> questionableData;
private java.util.List<QuestionableData> questionableData;
/**
* Collection of filtered questionable data.
*/
private ArrayList<QuestionableData> filteredQuestionableData;
private java.util.List<QuestionableData> filteredQuestionableData;
/**
* Listener for sort options
@ -145,10 +146,15 @@ public class QuestionableBadDataDlg extends CaveSWTDialog {
* Parent shell.
*/
public QuestionableBadDataDlg(Shell parent) {
super(parent);
super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText("Questionable and Bad Data");
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override
protected Layout constructShellLayout() {
// Create the main layout for the shell.
@ -158,11 +164,23 @@ public class QuestionableBadDataDlg extends CaveSWTDialog {
return mainLayout;
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override
protected void disposed() {
font.dispose();
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override
protected void initializeComponents(Shell shell) {
setReturnValue(false);
@ -186,7 +204,16 @@ public class QuestionableBadDataDlg extends CaveSWTDialog {
createDataListControl();
createDescriptionControl();
createBottomButtons();
}
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
*/
@Override
protected void preOpened() {
super.preOpened();
getData();
}
@ -516,7 +543,8 @@ public class QuestionableBadDataDlg extends CaveSWTDialog {
private void updateDisplayList() {
dataList.removeAll();
ArrayList<QuestionableData> dataToDisplay = (locationChk.getSelection() && (filteredQuestionableData != null)) ? filteredQuestionableData
java.util.List<QuestionableData> dataToDisplay = (locationChk
.getSelection() && (filteredQuestionableData != null)) ? filteredQuestionableData
: questionableData;
if (dataToDisplay.size() == 0) {
@ -543,6 +571,9 @@ public class QuestionableBadDataDlg extends CaveSWTDialog {
}
}
/**
* Updated the QC description for the selected data.
*/
private void updateDescription() {
QuestionableData selectedData = getCurrentlySelectedData();
@ -552,8 +583,11 @@ public class QuestionableBadDataDlg extends CaveSWTDialog {
}
}
/**
* Remove the selected data records.
*/
private void deleteRecords() {
ArrayList<QuestionableData> recordsToDelete = getCurrentlySelectedRange();
java.util.List<QuestionableData> recordsToDelete = getCurrentlySelectedRange();
try {
QuestionableDataManager.getInstance().deleteRecords(
@ -567,6 +601,9 @@ public class QuestionableBadDataDlg extends CaveSWTDialog {
getData();
}
/**
* Display the time series graph for the selected record.
*/
private void openGraphTimeSeries() {
QuestionableData currData = getCurrentlySelectedData();
@ -578,6 +615,9 @@ public class QuestionableBadDataDlg extends CaveSWTDialog {
}
}
/**
* Open time series tabular information for the selected record.
*/
private void openTabularTimeSeries() {
QuestionableData currData = getCurrentlySelectedData();
@ -589,6 +629,11 @@ public class QuestionableBadDataDlg extends CaveSWTDialog {
}
}
/**
* The the data record for the selected line.
*
* @return questionableData
*/
private QuestionableData getCurrentlySelectedData() {
QuestionableData rval = null;
@ -606,7 +651,12 @@ public class QuestionableBadDataDlg extends CaveSWTDialog {
return rval;
}
private ArrayList<QuestionableData> getCurrentlySelectedRange() {
/**
* Get a list of records for the selected line(s).
*
* @return list
*/
private java.util.List<QuestionableData> getCurrentlySelectedRange() {
ArrayList<QuestionableData> rval = new ArrayList<QuestionableData>();
for (int i : dataList.getSelectionIndices()) {
@ -618,7 +668,7 @@ public class QuestionableBadDataDlg extends CaveSWTDialog {
}
private void setMissing() {
ArrayList<QuestionableData> recordsToSetMissing = getCurrentlySelectedRange();
java.util.List<QuestionableData> recordsToSetMissing = getCurrentlySelectedRange();
try {
QuestionableDataManager.getInstance().setMissing(

View file

@ -39,6 +39,7 @@ import org.eclipse.ui.PlatformUI;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 6/27/06 lvenable Initial Creation.
* 02/07/2013 1578 rferrel Changes for non-blocking questionableDlg.
*
* </pre>
*
@ -46,15 +47,25 @@ import org.eclipse.ui.PlatformUI;
*
*/
public class QuestionableDataAction extends AbstractHandler {
private QuestionableBadDataDlg questionableDlg;
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
QuestionableBadDataDlg questionableDlg = new QuestionableBadDataDlg(shell);
questionableDlg.open();
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
* .ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
if (questionableDlg == null) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell();
questionableDlg = new QuestionableBadDataDlg(shell);
}
questionableDlg.open();
return null;
}
return null;
}
}

View file

@ -23,6 +23,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import com.raytheon.uf.common.time.SimulatedTime;
@ -44,6 +45,7 @@ import com.raytheon.viz.hydrocommon.util.HydroQC;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Oct 22, 2008 1636 askripsky Initial Creation
* Feb 07, 2013 1578 rferrel Code cleanup for non-blocing dialogs.
*
* </pre>
*
@ -53,17 +55,12 @@ import com.raytheon.viz.hydrocommon.util.HydroQC;
public class QuestionableDataManager extends PhysicalElementDataManager {
private static QuestionableDataManager manager = null;
/** Singleton instance of this class. */
private static final QuestionableDataManager manager = new QuestionableDataManager();
/** Format to use for time strings. */
private SimpleDateFormat timeFormat;
private static final String SELECT_COLUMNS = "lid, pe, dur, ts, extremum, value, "
+ "shef_qual_code, quality_code, revision, product_id, producttime, postingtime, cast(probability as float), "
+ "validtime, basistime, reject_type, userid";
private static final String SELECT_STATEMENT = "SELECT " + SELECT_COLUMNS
+ " FROM rejecteddata";
/**
* Private constructor.
*/
@ -78,11 +75,7 @@ public class QuestionableDataManager extends PhysicalElementDataManager {
*
* @return manager
*/
public static synchronized QuestionableDataManager getInstance() {
if (manager == null) {
manager = new QuestionableDataManager();
}
public static QuestionableDataManager getInstance() {
return manager;
}
@ -92,11 +85,11 @@ public class QuestionableDataManager extends PhysicalElementDataManager {
* @param sortCriteria
* @param daysBack
*
* @return String[]
* @return list
*/
public ArrayList<QuestionableData> getQuestionableData(
String selectedTable, int daysBack, String sortCriteria) {
ArrayList<QuestionableData> rval = new ArrayList<QuestionableData>();
public List<QuestionableData> getQuestionableData(String selectedTable,
int daysBack, String sortCriteria) {
List<QuestionableData> rval = new ArrayList<QuestionableData>();
PhysicalElementTable tableName = null;
String orderByCriteria = "";
@ -122,7 +115,7 @@ public class QuestionableDataManager extends PhysicalElementDataManager {
orderByCriteria = "quality_code DESC, lid, obstime DESC";
}
ArrayList<Object[]> data = getPhysicalElementData(tableName,
List<Object[]> data = getPhysicalElementData(tableName,
obsTimeConstraint, orderByCriteria);
for (Object[] currData : data) {
@ -132,6 +125,12 @@ public class QuestionableDataManager extends PhysicalElementDataManager {
return rval;
}
/**
* Get the table for the selected PE.
*
* @param selectedPE
* @return
*/
private PhysicalElementTable getSelectedPE(String selectedPE) {
PhysicalElementTable tableName = PhysicalElementTable.agricultural;
@ -184,6 +183,12 @@ public class QuestionableDataManager extends PhysicalElementDataManager {
return tableName;
}
/**
* Create description for the selected data.
*
* @param selectedData
* @return description
*/
public String getDescription(QuestionableData selectedData) {
int qualityCode = selectedData.getQualityCode();
@ -191,13 +196,13 @@ public class QuestionableDataManager extends PhysicalElementDataManager {
if (HydroQC.checkQcBit(HydroQC.REASONRANGE_QC, qualityCode) == false) {
// Get data for the specific pe at the given obs time
ArrayList<DataLimitData> dlData = DataLimitDataManager
.getInstance().getLimits(
List<DataLimitData> dlData = DataLimitDataManager.getInstance()
.getLimits(
selectedData.getLid(),
selectedData.getPe(),
Integer.toString(selectedData.getDur()),
selectedData.getObstime().toString().substring(5,
10));
selectedData.getObstime().toString()
.substring(5, 10));
if (dlData.size() > 0) {
double reasonRangeMax = dlData.get(0).getReasonRangeMax();
@ -237,7 +242,7 @@ public class QuestionableDataManager extends PhysicalElementDataManager {
* @param selectedTable
* @throws VizException
*/
public void deleteRecords(ArrayList<QuestionableData> recordsToDelete,
public void deleteRecords(List<QuestionableData> recordsToDelete,
String selectedTable) throws VizException {
for (QuestionableData currData : recordsToDelete) {
removePhysicalElementData(currData);
@ -265,7 +270,13 @@ public class QuestionableDataManager extends PhysicalElementDataManager {
}
}
public void setMissing(ArrayList<QuestionableData> missingData)
/**
* Change the record's quality code to missing and update the data base.
*
* @param missingData
* @throws VizException
*/
public void setMissing(List<QuestionableData> missingData)
throws VizException {
for (QuestionableData currData : missingData) {
/* set postingtime to current time */