diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/ColorLegendComp.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/ColorLegendComp.java index d8d2a75c27..8a9e474d35 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/ColorLegendComp.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/ColorLegendComp.java @@ -20,7 +20,7 @@ package com.raytheon.viz.hydro.flashfloodguidance; -import java.util.ArrayList; +import java.util.List; import org.eclipse.swt.SWT; import org.eclipse.swt.events.DisposeEvent; @@ -48,6 +48,7 @@ import com.raytheon.uf.viz.core.RGBColors; * ------------ ---------- ----------- -------------------------- * 29 NOV 2007 373 lvenable Initial creation * 12 Oct 2009 2256 mpduff Implmented the code. + * 07 Feb 2012 1578 rferrel Code clean up non-blocking dialogs. * * * @@ -119,7 +120,7 @@ public class ColorLegendComp extends Composite { /** * Array of legend color bar data. */ - private ArrayList barDataArray; + private List barDataArray; /** * Constructor. @@ -130,7 +131,7 @@ public class ColorLegendComp extends Composite { * Array of legend color bar data. */ public ColorLegendComp(Composite parent, - ArrayList barDataArray) { + List barDataArray) { super(parent, SWT.NONE); this.parent = parent; @@ -152,7 +153,7 @@ public class ColorLegendComp extends Composite { * Array of legend color bar data. */ public ColorLegendComp(Composite parent, String title, - ArrayList barDataArray) { + List barDataArray) { super(parent, SWT.NONE); this.parent = parent; @@ -196,7 +197,8 @@ public class ColorLegendComp extends Composite { if ((font != null) && (font.isDisposed() == false)) { font.dispose(); } - if ((currentColor != null) && (currentColor.isDisposed() == false)) { + if ((currentColor != null) + && (currentColor.isDisposed() == false)) { currentColor.dispose(); } } @@ -219,7 +221,7 @@ public class ColorLegendComp extends Composite { if ((productText == null) || (productText.length() < 1)) { return; } - + // Draw the FFG line text e.gc.drawString(ffgLineText, 3, 0, true); @@ -251,8 +253,8 @@ public class ColorLegendComp extends Composite { + "-- setting color to white..."); currentColor = new Color(parent.getDisplay(), 255, 255, 255); } else { - currentColor = new Color(parent.getDisplay(), RGBColors - .getRGBColor(barData.getColorName())); + currentColor = new Color(parent.getDisplay(), + RGBColors.getRGBColor(barData.getColorName())); } e.gc.setBackground(currentColor); @@ -272,8 +274,8 @@ public class ColorLegendComp extends Composite { String barText; if (i == 0) { - barText = String.format(">= %5.2f---", barData - .getDuration()); + barText = String.format(">= %5.2f---", + barData.getDuration()); textY += 11; } else if (barData.getDuration() == -8888) { double duration = lowestValue;// - 0.01; @@ -283,32 +285,32 @@ public class ColorLegendComp extends Composite { barText = " MISSING"; textY += 2; } else { - barText = String.format(" %5.2f---", barData - .getDuration()); + barText = String.format(" %5.2f---", + barData.getDuration()); textY += 11; } e.gc.drawString(barText, 3, textY, true); } } - + /** * Set the text to display above the legend color bar. * * @param line1 - * The first line of text + * The first line of text * @param line2 - * The second line of text + * The second line of text */ public void setDisplayText(String line1, String line2) { if ((line1 != null) && (line1.length() > 0)) { ffgLineText = line1; } - + if ((line2 != null) && (line2.length() > 0)) { productText = line2; } - + legendCanvas.redraw(); } } diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceAction.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceAction.java index 870ae495b2..b6f21ec22d 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceAction.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceAction.java @@ -39,6 +39,7 @@ import org.eclipse.ui.PlatformUI; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 6/27/06 lvenable Initial Creation. + * 02/07/2013 1758 rferrel Changes for non-blocking FlashFloodGuidanceDlg. * * * @@ -46,15 +47,25 @@ import org.eclipse.ui.PlatformUI; * */ public class FlashFloodGuidanceAction extends AbstractHandler { + private FlashFloodGuidanceDlg flashFloodDlg; - @Override - public Object execute(ExecutionEvent arg0) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - FlashFloodGuidanceDlg flashFloodDlg = new FlashFloodGuidanceDlg(shell); - flashFloodDlg.open(); + /* + * (non-Javadoc) + * + * @see + * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands + * .ExecutionEvent) + */ + @Override + public Object execute(ExecutionEvent arg0) throws ExecutionException { + if (flashFloodDlg == null) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + flashFloodDlg = new FlashFloodGuidanceDlg(shell); + } + flashFloodDlg.open(); - return null; - } + return null; + } } diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceDlg.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceDlg.java index 5f6efb7dad..1df12500b3 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceDlg.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/flashfloodguidance/FlashFloodGuidanceDlg.java @@ -75,6 +75,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * ------------ ---------- ----------- -------------------------- * 29 NOV 2007 373 lvenable Initial creation. * 13 Oct 2009 2256 mpduff Implement the dialog. + * 07 Feb 2013 1578 rferrel Changes for non-blocking dialog. * * * @@ -266,12 +267,17 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { * Parent shell. */ public FlashFloodGuidanceDlg(Shell parent) { - super(parent); + super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK); setText("Flash Flood Guidance"); waitCursor = parent.getDisplay().getSystemCursor(SWT.CURSOR_WAIT); arrowCursor = parent.getDisplay().getSystemCursor(SWT.CURSOR_ARROW); } + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout() + */ @Override protected Layout constructShellLayout() { // Create the main layout for the shell. @@ -281,11 +287,23 @@ public class FlashFloodGuidanceDlg 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) { font = new Font(shell.getDisplay(), "Monospace", 11, SWT.NORMAL); @@ -696,22 +714,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { java.util.List colorSet = HydroDisplayManager.getInstance() .getFFGColorMap(user_id, "FFG", duration); - // NamedColorUseSet pColorUseSet = null; - // java.util.List pColorSetGroup = new - // ArrayList(); - // - // pColorUseSet = new NamedColorUseSet("FFG1", "Flash Flood Guidance", - // FFGConstants.FFG_LEVELS, FFGConstants.FFG, "GRAY30", "GRAY10", - // 3600); - // pColorSetGroup.add(pColorUseSet); - // - // ArrayList colorSet = (ArrayList) - // GetColorValues - // // .get_colorvalues(user_id, app_name, "FFG1", 3600, "E", - // .get_colorvalues(user_id, app_name, "FFG", 3600, "E", - // pColorSetGroup); - - ArrayList list = new ArrayList(); + java.util.List list = new ArrayList(); list.add(new ColorLegendBarData(colorSet.get(7).getId() .getThresholdValue(), colorSet.get(7).getColorname() .getColorName())); @@ -781,7 +784,7 @@ public class FlashFloodGuidanceDlg extends CaveSWTDialog { private void readGriddedFfgProduct() { FlashFloodGuidanceDataManager dman = FlashFloodGuidanceDataManager .getInstance(); - ArrayList list = new ArrayList(); + java.util.List list = new ArrayList(); Map sortedMap = new HashMap(); dataMap.clear();