Issue #1353 Changes for non-blocking AttributeThresholdDlg, BasinTrendDlg and ConfigSummaryDlg.

Change-Id: Ie5ed937d78478c91eab84998024ee3347f79c95e

Former-commit-id: d99abd8f22 [formerly 7233f6fd64] [formerly d99abd8f22 [formerly 7233f6fd64] [formerly c30152a13d [formerly ea9896b2e8653b5d521c3f2d4a497116d135ea64]]]
Former-commit-id: c30152a13d
Former-commit-id: b736c70e88 [formerly 2a4a7a605f]
Former-commit-id: c7faa655ec
This commit is contained in:
Roger Ferrel 2012-12-06 13:40:48 -06:00
parent dbf805159d
commit 3afacaa66e
5 changed files with 147 additions and 125 deletions

View file

@ -37,6 +37,23 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.dialogs.FFMPConfig.ThreshColNames;
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML; import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
* FFMP Basin Table Threshold attribute display dialog.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Initial creation
* Dec 6, 2012 1353 rferrel Changes for non-blocking dialog.
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class AttributeThresholdDlg extends CaveSWTDialog { public class AttributeThresholdDlg extends CaveSWTDialog {
private Text upperText; private Text upperText;
@ -61,7 +78,7 @@ public class AttributeThresholdDlg extends CaveSWTDialog {
public AttributeThresholdDlg(Shell parent, ThreshColNames threshCol, public AttributeThresholdDlg(Shell parent, ThreshColNames threshCol,
IThreshDisplay threshActionCB) { IThreshDisplay threshActionCB) {
super(parent); super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
this.threshCol = threshCol; this.threshCol = threshCol;
this.threshActionCB = threshActionCB; this.threshActionCB = threshActionCB;

View file

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

View file

@ -22,11 +22,10 @@ package com.raytheon.uf.viz.monitor.ffmp.ui.dialogs;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.TimeZone; import java.util.TimeZone;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
@ -55,6 +54,23 @@ import com.raytheon.uf.viz.monitor.ffmp.ui.rsc.FFMPResource;
import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML; import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPConfigBasinXML;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
* Display FFMP Basin Trend Graph.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Initial creation
* Dec 6, 2012 1353 rferrel Code clean up for non-blocking dialog.
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class BasinTrendDlg extends CaveSWTDialog { public class BasinTrendDlg extends CaveSWTDialog {
/** /**
* Main composite. * Main composite.
@ -125,12 +141,12 @@ public class BasinTrendDlg extends CaveSWTDialog {
/** /**
* QPFSCAN radio button. * QPFSCAN radio button.
*/ */
private ArrayList<Button> qpfRdos = new ArrayList<Button>(); private List<Button> qpfRdos = new ArrayList<Button>();
/** /**
* RFCFFG radio button. * RFCFFG radio button.
*/ */
private ArrayList<Button> ffgRdos = new ArrayList<Button>(); private List<Button> ffgRdos = new ArrayList<Button>();
/** /**
* Background color for controls and graph. * Background color for controls and graph.
@ -176,11 +192,11 @@ public class BasinTrendDlg extends CaveSWTDialog {
/** /**
* Arrays of buttons for time durations, under-lay, and plots. * Arrays of buttons for time durations, under-lay, and plots.
*/ */
private ArrayList<Button> timeDurationButtons; private List<Button> timeDurationButtons;
private ArrayList<Button> underlayButtons; private List<Button> underlayButtons;
private ArrayList<Button> plotButtons; private List<Button> plotButtons;
/** /**
* Ratio item label. * Ratio item label.
@ -215,7 +231,7 @@ public class BasinTrendDlg extends CaveSWTDialog {
private FFMPResource resource; private FFMPResource resource;
private final ArrayList<ISourceUpdate> sourceListeners = new ArrayList<ISourceUpdate>(); private final List<ISourceUpdate> sourceListeners = new ArrayList<ISourceUpdate>();
/** /**
* Constructor. * Constructor.
@ -236,23 +252,17 @@ public class BasinTrendDlg extends CaveSWTDialog {
this.resource = resource; this.resource = resource;
this.graphData = graphData; this.graphData = graphData;
// try {
// this.graphData = resource.getGraphData(pfaf);
// } catch (VizException e) {
// e.printStackTrace();
// }
this.pfaf = pfaf; this.pfaf = pfaf;
this.vgb = vgb; this.vgb = vgb;
this.currentDate = date; this.currentDate = date;
this.graphData.setDisplayDate(date); this.graphData.setDisplayDate(date);
// Print the graph data
// this.graphData.printGraphData();
} }
/** /*
* Create the layout for the shell. * (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/ */
@Override @Override
protected Layout constructShellLayout() { protected Layout constructShellLayout() {
@ -265,8 +275,12 @@ public class BasinTrendDlg extends CaveSWTDialog {
return mainLayout; return mainLayout;
} }
/** /*
* Initialize the components on the display. * (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/ */
@Override @Override
protected void initializeComponents(Shell shell) { protected void initializeComponents(Shell shell) {
@ -290,22 +304,6 @@ public class BasinTrendDlg extends CaveSWTDialog {
* Set the Basin Trend graphing parameters. * Set the Basin Trend graphing parameters.
*/ */
updateGraph(); updateGraph();
// setBasinTrendGraphParms();
shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
largeLabelFont.dispose();
medLabelFont.dispose();
smallLabelFont.dispose();
bgColor.dispose();
rateColor.dispose();
qpeColor.dispose();
qpfColor.dispose();
guidColor.dispose();
vgbColor.dispose();
}
});
} }
/** /**
@ -349,11 +347,6 @@ public class BasinTrendDlg extends CaveSWTDialog {
colorName = ffmpCfg.getBasinTrendPlotColorName("VGB"); colorName = ffmpCfg.getBasinTrendPlotColorName("VGB");
vgbColor = new Color(getDisplay(), new RGB(135, 206, 235)); vgbColor = new Color(getDisplay(), new RGB(135, 206, 235));
/*
* Get reverse X Axis flag.
*/
// reverseXAxis = ffmpCfg.getFFMPConfigData().getReverseXAxis();
} }
/** /**
@ -584,7 +577,8 @@ public class BasinTrendDlg extends CaveSWTDialog {
.getTableConfigData(resource.getSiteKey()); .getTableConfigData(resource.getSiteKey());
// FfmpTableConfig tableConf = FfmpTableConfig.getInstance(); // FfmpTableConfig tableConf = FfmpTableConfig.getInstance();
String columnName = ffmpTableCfgData.getTableColumnAttr( String columnName = ffmpTableCfgData.getTableColumnAttr(
ffmpTableCfgData.getTableColumnKeys()[3]).getColumnNameWithSpace(); ffmpTableCfgData.getTableColumnKeys()[3])
.getColumnNameWithSpace();
String qpfType = columnName.substring(0, columnName.indexOf(" ")); String qpfType = columnName.substring(0, columnName.indexOf(" "));
int i = 0; int i = 0;
@ -804,10 +798,23 @@ public class BasinTrendDlg extends CaveSWTDialog {
}); });
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override @Override
protected void disposed() { protected void disposed() {
// FFMPConfig.getInstance().getFFMPConfigData().setReverseXAxis(false);
sourceListeners.clear(); sourceListeners.clear();
largeLabelFont.dispose();
medLabelFont.dispose();
smallLabelFont.dispose();
bgColor.dispose();
rateColor.dispose();
qpeColor.dispose();
qpfColor.dispose();
guidColor.dispose();
vgbColor.dispose();
} }
/** /**
@ -958,14 +965,10 @@ public class BasinTrendDlg extends CaveSWTDialog {
updatePlotSelection(plotBtn, false); updatePlotSelection(plotBtn, false);
} }
// TODO : moved code outside of loop
// updateColorLegend();
// updateGraph();
} }
if (guidSrc != null) { if (guidSrc != null) {
for (Button ffg: ffgRdos) { for (Button ffg : ffgRdos) {
if (ffg.getText().equalsIgnoreCase(guidSrc)) { if (ffg.getText().equalsIgnoreCase(guidSrc)) {
ffg.setSelection(true); ffg.setSelection(true);
} else { } else {
@ -1164,7 +1167,8 @@ public class BasinTrendDlg extends CaveSWTDialog {
* Set the basin trend graph parameters from the configuration. * Set the basin trend graph parameters from the configuration.
*/ */
private void setBasinTrendGraphParms() { private void setBasinTrendGraphParms() {
FFMPConfigBasinXML configBasin = FFMPConfig.getInstance().getFFMPConfigData(); FFMPConfigBasinXML configBasin = FFMPConfig.getInstance()
.getFFMPConfigData();
/* /*
* Time duration * Time duration
*/ */
@ -1187,7 +1191,7 @@ public class BasinTrendDlg extends CaveSWTDialog {
} }
if ((underlay == Underlays.DIFF) || (underlay == Underlays.RATIO)) { if ((underlay == Underlays.DIFF) || (underlay == Underlays.RATIO)) {
String guidSource = null; String guidSource = null;
for (Button ffg: ffgRdos) { for (Button ffg : ffgRdos) {
if (ffg.getSelection()) { if (ffg.getSelection()) {
guidSource = ffg.getText(); guidSource = ffg.getText();
} }
@ -1196,7 +1200,8 @@ public class BasinTrendDlg extends CaveSWTDialog {
guidSource = ffgRdos.get(0).getText(); guidSource = ffgRdos.get(0).getText();
} }
if (guidSource != null) { if (guidSource != null) {
configBasin.setUnderlay(underlay.getUnderlayName() + "," + guidSource); configBasin.setUnderlay(underlay.getUnderlayName() + ","
+ guidSource);
} else { } else {
configBasin.setUnderlay(underlay.getUnderlayName()); configBasin.setUnderlay(underlay.getUnderlayName());
} }

View file

@ -20,9 +20,9 @@
package com.raytheon.uf.viz.monitor.ffmp.ui.dialogs; package com.raytheon.uf.viz.monitor.ffmp.ui.dialogs;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener; import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.events.MouseTrackListener;
import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Color;
@ -33,21 +33,28 @@ import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Shell;
public class ConfigSummaryDlg extends Dialog implements MouseListener, import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
MouseTrackListener {
/**
* Dialog shell.
*/
private Shell shell;
/** /**
* The display control. * Display FFMP Basin Table's configuration summary data.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Initial creation
* Dec 6, 2012 1353 rferrel Convert to CaveSWTDialog and made non-blocking.
* </pre>
*
* @author rferrel
* @version 1.0
*/ */
private Display display; public class ConfigSummaryDlg extends CaveSWTDialog {
/** /**
* Canvas to display the information. * Canvas to display the information.
@ -132,8 +139,8 @@ public class ConfigSummaryDlg extends Dialog implements MouseListener,
/** /**
* Data labels. * Data labels.
*/ */
String[] dataLabels = new String[] { "Layer", "Link to Frame", private final String[] dataLabels = new String[] { "Layer",
"Worst Case", "Zoom: Maintain Layer", "Link to Frame", "Worst Case", "Zoom: Maintain Layer",
"Zoom: only Basins in Parent", "Include CWAs", "D2D Click Action", "Zoom: only Basins in Parent", "Include CWAs", "D2D Click Action",
"D2D Display Type", "Auto-Refresh" }; "D2D Display Type", "Auto-Refresh" };
@ -149,7 +156,7 @@ public class ConfigSummaryDlg extends Dialog implements MouseListener,
*/ */
public ConfigSummaryDlg(Shell parent, Point controlLocation, public ConfigSummaryDlg(Shell parent, Point controlLocation,
ConfigSummaryData cfgSumData) { ConfigSummaryData cfgSumData) {
super(parent, 0); super(parent, SWT.NO_TRIM, CAVE.DO_NOT_BLOCK);
this.controlLoc = controlLocation; this.controlLoc = controlLocation;
this.cfgSumData = cfgSumData; this.cfgSumData = cfgSumData;
@ -157,15 +164,15 @@ public class ConfigSummaryDlg extends Dialog implements MouseListener,
cfgData = this.cfgSumData.getDisplayData(); cfgData = this.cfgSumData.getDisplayData();
} }
/** /*
* Open method to show the dialog. * (non-Javadoc)
* *
* @return Null. * @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/ */
public Object open() { @Override
Shell parent = getParent(); protected void initializeComponents(Shell shell) {
display = parent.getDisplay();
shell = new Shell(parent, SWT.NO_TRIM);
// Create the main layout for the shell. // Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false); GridLayout mainLayout = new GridLayout(1, false);
@ -175,25 +182,10 @@ public class ConfigSummaryDlg extends Dialog implements MouseListener,
// Initialize all of the controls and layouts // Initialize all of the controls and layouts
initializeComponents(); initializeComponents();
shell.pack();
shell.setLocation(controlLoc.x - 100, controlLoc.y - 100);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
leftSideColor.dispose();
rightSideColor.dispose();
textFont.dispose();
return null;
} }
private void initializeComponents() { private void initializeComponents() {
Display display = shell.getDisplay();
/* /*
* Setup the font and colors. * Setup the font and colors.
*/ */
@ -227,8 +219,21 @@ public class ConfigSummaryDlg extends Dialog implements MouseListener,
* Add mouse listeners to the canvas so it will be closed when the user * Add mouse listeners to the canvas so it will be closed when the user
* moves the mouse outside the dialog or it is clicked. * moves the mouse outside the dialog or it is clicked.
*/ */
canvas.addMouseTrackListener(this); canvas.addMouseTrackListener(new MouseTrackAdapter() {
canvas.addMouseListener(this);
@Override
public void mouseExit(MouseEvent e) {
close();
}
});
canvas.addMouseListener(new MouseAdapter() {
@Override
public void mouseDown(MouseEvent e) {
close();
}
});
} }
/** /**
@ -238,6 +243,7 @@ public class ConfigSummaryDlg extends Dialog implements MouseListener,
* Graphic context. * Graphic context.
*/ */
private void drawCanvas(GC gc) { private void drawCanvas(GC gc) {
Display display = shell.getDisplay();
gc.setFont(textFont); gc.setFont(textFont);
gc.setTextAntialias(SWT.ON); gc.setTextAntialias(SWT.ON);
@ -300,6 +306,7 @@ public class ConfigSummaryDlg extends Dialog implements MouseListener,
* Make the calculation used for draw the data on the canvas. * Make the calculation used for draw the data on the canvas.
*/ */
private void makeCalculations() { private void makeCalculations() {
Display display = shell.getDisplay();
Image image = new Image(display, 100, 100); Image image = new Image(display, 100, 100);
GC gc = new GC(image); GC gc = new GC(image);
gc.setFont(textFont); gc.setFont(textFont);
@ -331,34 +338,26 @@ public class ConfigSummaryDlg extends Dialog implements MouseListener,
+ (spaceBetweenText * dataLabels.length - 1); + (spaceBetweenText * dataLabels.length - 1);
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
*/
@Override @Override
public void mouseDoubleClick(MouseEvent e) { protected void preOpened() {
// do nothing super.preOpened();
shell.setLocation(controlLoc.x - 100, controlLoc.y - 100);
} }
/*
* (non-Javadoc)
*
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
*/
@Override @Override
public void mouseDown(MouseEvent e) { protected void disposed() {
shell.dispose(); leftSideColor.dispose();
} rightSideColor.dispose();
textFont.dispose();
@Override
public void mouseUp(MouseEvent e) {
// do nothing
}
@Override
public void mouseEnter(MouseEvent e) {
// do nothing
}
@Override
public void mouseExit(MouseEvent e) {
shell.dispose();
}
@Override
public void mouseHover(MouseEvent e) {
// do nothing
} }
} }

View file

@ -1144,6 +1144,9 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
Point buttonLoc = getDisplay().map(configSummaryBtn, null, x, Point buttonLoc = getDisplay().map(configSummaryBtn, null, x,
y + configSummaryBtn.getSize().y); y + configSummaryBtn.getSize().y);
// Create each time since data may have changed. Since the dialog closes
// with either a mouse click or moving the mouse off the dialog nothing
// can be done by the user until the non-blocking dialog is close.
ConfigSummaryDlg cfgSumDlg = new ConfigSummaryDlg(shell, buttonLoc, ConfigSummaryDlg cfgSumDlg = new ConfigSummaryDlg(shell, buttonLoc,
cfgSumData); cfgSumData);
cfgSumDlg.open(); cfgSumDlg.open();
@ -1254,13 +1257,11 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
} }
private void displayThresholdsDialog(ThreshColNames colName) { private void displayThresholdsDialog(ThreshColNames colName) {
if ((attrThreshDlg == null) || (attrThreshDlg.isDisposed() == true)) { if (attrThreshDlg == null) {
attrThreshDlg = new AttributeThresholdDlg(shell, colName, this); attrThreshDlg = new AttributeThresholdDlg(shell, colName, this);
attrThreshDlg.open();
attrThreshDlg = null;
} else {
attrThreshDlg.newThreshold(colName);
} }
attrThreshDlg.open();
attrThreshDlg.newThreshold(colName);
} }
/** /**