Issue #1812 - Scan/DMD trend graphs and trend sets graphs update on threshold changes.

Change-Id: I1150f365ef7b67a198f57cca85859f6767eb0234

Former-commit-id: 0ba05ec6e5 [formerly 540524941d] [formerly e4ffefa649] [formerly 09feff70e0 [formerly e4ffefa649 [formerly 8ddcbfac38c225c6771e97de738125a1149ae1c4]]]
Former-commit-id: 09feff70e0
Former-commit-id: f337379307c42237568f779a8b1424b7176cd91b [formerly a45389f735]
Former-commit-id: 524dfa985f
This commit is contained in:
Mike Duff 2013-03-21 12:18:58 -05:00
parent 5be0b04905
commit 01374e2b4e
2 changed files with 128 additions and 100 deletions

View file

@ -35,10 +35,25 @@ import com.raytheon.uf.common.monitor.scan.config.SCANConfigEnums.ScanTables;
import com.raytheon.uf.viz.monitor.scan.TrendGraphData; import com.raytheon.uf.viz.monitor.scan.TrendGraphData;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
public class TrendGraphDlg extends CaveSWTDialog //implements ICommonDialogAction /**
{ * Scan/DMD Trend Graph Dialog.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 21, 2013 1812 mpduff Redraw now updates with new data.
*
* </pre>
*
* @author lvenable
* @version 1.0
*/
public class TrendGraphDlg extends CaveSWTDialog {
private ScanTables scanTable; private final ScanTables scanTable;
private Combo identCbo; private Combo identCbo;
@ -50,24 +65,34 @@ public class TrendGraphDlg extends CaveSWTDialog //implements ICommonDialogActio
private TrendGraphCanvas trendGraphCanvas; private TrendGraphCanvas trendGraphCanvas;
private ITrendGraphUpdate updateCallback; private final ITrendGraphUpdate updateCallback;
private IRequestTrendGraphData requestDataCallback; private final IRequestTrendGraphData requestDataCallback;
// private LinkedHashMap<Date, Double> dataMap;
private TrendGraphData trendGraphData; private TrendGraphData trendGraphData;
private String[] identArray; private final String[] identArray;
private Integer vcp; private final Integer vcp;
/**
* Constructor.
*
* @param parentShell
* @param scanTable
* @param ident
* @param attrName
* @param updateCallback
* @param requestDataCallback
* @param identArray
* @param vcp
*/
public TrendGraphDlg(Shell parentShell, ScanTables scanTable, String ident, public TrendGraphDlg(Shell parentShell, ScanTables scanTable, String ident,
String attrName, ITrendGraphUpdate updateCallback, String attrName, ITrendGraphUpdate updateCallback,
IRequestTrendGraphData requestDataCallback, String[] identArray, IRequestTrendGraphData requestDataCallback, String[] identArray,
Integer vcp) Integer vcp) {
{ super(parentShell, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK
super(parentShell, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK | CAVE.INDEPENDENT_SHELL); | CAVE.INDEPENDENT_SHELL);
setText(scanTable.name() + " Trend Graph"); setText(scanTable.name() + " Trend Graph");
this.scanTable = scanTable; this.scanTable = scanTable;
@ -76,7 +101,7 @@ public class TrendGraphDlg extends CaveSWTDialog //implements ICommonDialogActio
this.updateCallback = updateCallback; this.updateCallback = updateCallback;
this.requestDataCallback = requestDataCallback; this.requestDataCallback = requestDataCallback;
this.identArray = identArray; this.identArray = identArray;
this.vcp=vcp; this.vcp = vcp;
} }
@Override @Override
@ -92,7 +117,7 @@ public class TrendGraphDlg extends CaveSWTDialog //implements ICommonDialogActio
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
trendGraphData = requestDataCallback.requestTrendGraphData(scanTable, trendGraphData = requestDataCallback.requestTrendGraphData(scanTable,
attrName, ident); attrName, ident);
createTopControls(); createTopControls();
createGraphCanvas(); createGraphCanvas();
} }
@ -135,8 +160,8 @@ public class TrendGraphDlg extends CaveSWTDialog //implements ICommonDialogActio
private void createGraphCanvas() { private void createGraphCanvas() {
trendGraphCanvas = new TrendGraphCanvas(shell, trendGraphData, trendGraphCanvas = new TrendGraphCanvas(shell, trendGraphData,
requestDataCallback.getCurrentDate(), scanTable, requestDataCallback.getCurrentDate(), scanTable, attrName, vcp,
attrName,vcp,requestDataCallback,ident); requestDataCallback, ident);
} }
private void populateIdentCombo() { private void populateIdentCombo() {
@ -165,8 +190,8 @@ public class TrendGraphDlg extends CaveSWTDialog //implements ICommonDialogActio
trendGraphData = requestDataCallback.requestTrendGraphData(scanTable, trendGraphData = requestDataCallback.requestTrendGraphData(scanTable,
attrName, ident); attrName, ident);
trendGraphCanvas.updateAttribute(attrName, trendGraphData, requestDataCallback trendGraphCanvas.updateAttribute(attrName, trendGraphData,
.getCurrentDate()); requestDataCallback.getCurrentDate());
trendGraphCanvas.setIndent(ident); trendGraphCanvas.setIndent(ident);
} }
@ -177,31 +202,33 @@ public class TrendGraphDlg extends CaveSWTDialog //implements ICommonDialogActio
trendGraphData = requestDataCallback.requestTrendGraphData(scanTable, trendGraphData = requestDataCallback.requestTrendGraphData(scanTable,
attrName, ident); attrName, ident);
trendGraphCanvas.updateAttribute(attrName, trendGraphData, requestDataCallback trendGraphCanvas.updateAttribute(attrName, trendGraphData,
.getCurrentDate()); requestDataCallback.getCurrentDate());
} }
/** /**
* Update the trend graph data so the latest data can be displayed. * Update the trend graph data so the latest data can be displayed.
*
* @return true if item is to be disposed * @return true if item is to be disposed
*/ */
public boolean updateTrendGraph() public boolean updateTrendGraph() {
{
trendGraphData = requestDataCallback.requestTrendGraphData(scanTable, trendGraphData = requestDataCallback.requestTrendGraphData(scanTable,
attrName, ident); attrName, ident);
trendGraphCanvas.updateAttribute(attrName, trendGraphData, requestDataCallback trendGraphCanvas.updateAttribute(attrName, trendGraphData,
.getCurrentDate()); requestDataCallback.getCurrentDate());
if (requestDataCallback.cellValid(this.ident) == false) { if (requestDataCallback.cellValid(this.ident) == false) {
return true; return true;
} }
return false; return false;
} }
public void redrawTrendGraph() /**
{ * Redraw the graphs with updated data.
trendGraphCanvas.redrawCanvas(); */
public void redrawTrendGraph() {
updateTrendGraph();
} }
public void displayDialog() { public void displayDialog() {
@ -211,24 +238,12 @@ public class TrendGraphDlg extends CaveSWTDialog //implements ICommonDialogActio
public boolean dialogIsDisposed() { public boolean dialogIsDisposed() {
return shell.isDisposed(); return shell.isDisposed();
} }
/** /**
* Overriding the dispose method to notify that the trend graph is closing. * Overriding the dispose method to notify that the trend graph is closing.
*/ */
@Override @Override
protected void disposed() protected void disposed() {
{
this.updateCallback.trendGraphClosing(this); this.updateCallback.trendGraphClosing(this);
} }
// @Override
// public void closeDialog() {
// this.updateCallback.trendGraphClosing(this);
// shell.dispose();
// }
//
// @Override
// public boolean isDisposed() {
// return shell.isDisposed();
// }
} }

View file

@ -40,11 +40,25 @@ import com.raytheon.uf.common.monitor.scan.config.TrendSetConfigMgr;
import com.raytheon.uf.viz.monitor.scan.TrendGraphData; import com.raytheon.uf.viz.monitor.scan.TrendGraphData;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
public class TrendSetsGraphDlg extends CaveSWTDialog // implements /**
// ICommonDialogAction * Scan/DMD Trend Sets Graph Dialog.
{ *
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Mar 21, 2013 1812 mpduff Redraw now updates with new data.
*
* </pre>
*
* @author lvenable
* @version 1.0
*/
public class TrendSetsGraphDlg extends CaveSWTDialog {
private ScanTables scanTable; private final ScanTables scanTable;
private Combo identCbo; private Combo identCbo;
@ -56,15 +70,15 @@ public class TrendSetsGraphDlg extends CaveSWTDialog // implements
private TrendSetConfigMgr trendCfgMgr; private TrendSetConfigMgr trendCfgMgr;
private ITrendSetsGraphUpdate updateCallback; private final ITrendSetsGraphUpdate updateCallback;
private IRequestTrendGraphData requestDataCallback; private final IRequestTrendGraphData requestDataCallback;
// private LinkedHashMap<Date, Double> dataMap; // private LinkedHashMap<Date, Double> dataMap;
private LinkedHashMap<String, TrendGraphData> trendSetData; private LinkedHashMap<String, TrendGraphData> trendSetData;
private String[] identArray; private final String[] identArray;
private String[] attrArray; private String[] attrArray;
@ -72,14 +86,27 @@ public class TrendSetsGraphDlg extends CaveSWTDialog // implements
private HashMap<String, TrendGraphCanvas> canvasMap; private HashMap<String, TrendGraphCanvas> canvasMap;
private Integer vcp; private final Integer vcp;
/**
* Constructor.
*
* @param parentShell
* @param scanTable
* @param ident
* @param trendSetName
* @param updateCallback
* @param requestDataCallback
* @param identArray
* @param vcp
*/
public TrendSetsGraphDlg(Shell parentShell, ScanTables scanTable, public TrendSetsGraphDlg(Shell parentShell, ScanTables scanTable,
String ident, String trendSetName, String ident, String trendSetName,
ITrendSetsGraphUpdate updateCallback, ITrendSetsGraphUpdate updateCallback,
IRequestTrendGraphData requestDataCallback, String[] identArray, IRequestTrendGraphData requestDataCallback, String[] identArray,
Integer vcp) { Integer vcp) {
super(parentShell, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK | CAVE.INDEPENDENT_SHELL); super(parentShell, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK
| CAVE.INDEPENDENT_SHELL);
setText(scanTable.name() + " Trend Graph"); setText(scanTable.name() + " Trend Graph");
this.scanTable = scanTable; this.scanTable = scanTable;
@ -153,7 +180,6 @@ public class TrendSetsGraphDlg extends CaveSWTDialog // implements
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
shell.dispose(); shell.dispose();
// closeDialog();
} }
}); });
} }
@ -223,11 +249,10 @@ public class TrendSetsGraphDlg extends CaveSWTDialog // implements
trendSetData.clear(); trendSetData.clear();
// Loop through all of the attributes and call update and store the data // Loop through all of the attributes and call update and store the data
// map for // map for each attribute
// each attribute
for (String attr : attrArray) { for (String attr : attrArray) {
TrendGraphData tgd = requestDataCallback TrendGraphData tgd = requestDataCallback.requestTrendGraphData(
.requestTrendGraphData(scanTable, attr, ident); scanTable, attr, ident);
trendSetData.put(attr, tgd); trendSetData.put(attr, tgd);
// Call the update call back so the table can manage this dialog. // Call the update call back so the table can manage this dialog.
@ -252,8 +277,8 @@ public class TrendSetsGraphDlg extends CaveSWTDialog // implements
for (String attr : attrArray) { for (String attr : attrArray) {
System.out.println("Change trend set - attr = " + attr); System.out.println("Change trend set - attr = " + attr);
TrendGraphData tgd = requestDataCallback TrendGraphData tgd = requestDataCallback.requestTrendGraphData(
.requestTrendGraphData(scanTable, attr, ident); scanTable, attr, ident);
trendSetData.put(attr, tgd); trendSetData.put(attr, tgd);
} }
@ -272,36 +297,35 @@ public class TrendSetsGraphDlg extends CaveSWTDialog // implements
* @return true if item is to be disposed * @return true if item is to be disposed
*/ */
public boolean updateTrendSetsGraph() { public boolean updateTrendSetsGraph() {
trendSetData.clear(); trendSetData.clear();
// Loop through all of the attributes and call update and store the data // Loop through all of the attributes and call update and store the data
// map for // map for
// each attribute // each attribute
for (String attr : attrArray) { for (String attr : attrArray) {
TrendGraphData tgd = requestDataCallback TrendGraphData tgd = requestDataCallback.requestTrendGraphData(
.requestTrendGraphData(scanTable, attr, ident); scanTable, attr, ident);
trendSetData.put(attr, tgd); trendSetData.put(attr, tgd);
// Call the update call back so the table can manage this dialog. // Call the update call back so the table can manage this dialog.
this.updateCallback.trendSetGraphChanged(ident, trendSetName, this); this.updateCallback.trendSetGraphChanged(ident, trendSetName, this);
// Update the canvas with the new data // Update the canvas with the new data
canvasMap.get(attr).updateAttribute(attr, tgd, canvasMap.get(attr).updateAttribute(attr, tgd,
requestDataCallback.getCurrentDate()); requestDataCallback.getCurrentDate());
} }
if (requestDataCallback.cellValid(this.ident) == false) { if (requestDataCallback.cellValid(this.ident) == false) {
return true; return true;
} }
return false; return false;
} }
/**
* Redraw the graphs with updated data.
*/
public void redrawTrendGraph() { public void redrawTrendGraph() {
for (String key : canvasMap.keySet()) { updateTrendSetsGraph();
if (canvasMap.get(key) != null) {
canvasMap.get(key).redrawCanvas();
}
}
} }
public void displayDialog() { public void displayDialog() {
@ -319,15 +343,4 @@ public class TrendSetsGraphDlg extends CaveSWTDialog // implements
protected void disposed() { protected void disposed() {
this.updateCallback.trendSetGraphClosing(this); this.updateCallback.trendSetGraphClosing(this);
} }
// @Override
// public void closeDialog() {
// this.updateCallback.trendSetGraphClosing(this);
// shell.dispose();
// }
//
// @Override
// public boolean isDisposed() {
// return shell.isDisposed();
// }
} }