From 8c6e70ccabdce61932e2c48e15d2cc22e40e9202 Mon Sep 17 00:00:00 2001 From: Chip Gobs Date: Mon, 8 Sep 2014 12:06:45 -0400 Subject: [PATCH] VLab Issue #4611 Fixes O&M Redmine DR 14448 - which concerns displaying changes to a color set just after the changes are saved, instead of after the ColorScaleManager is closed. Change-Id: I0156612302853141392c263eab8b54a16c3be7a3 Former-commit-id: 44f6bf08a72b5450d6d0db40ff49dd5123cf811c --- .../colorscalemgr/ColorScaleMgrAction.java | 21 ++++++++- .../colorscalemgr/ColorScaleMgrDlg.java | 27 ++++++++++- .../ui/actions/MPEColorScaleMgrAction.java | 47 ++++++++++++++++++- 3 files changed, 91 insertions(+), 4 deletions(-) diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/colorscalemgr/ColorScaleMgrAction.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/colorscalemgr/ColorScaleMgrAction.java index a03c7eabaa..97f278de2c 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/colorscalemgr/ColorScaleMgrAction.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/colorscalemgr/ColorScaleMgrAction.java @@ -49,7 +49,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * 6/27/06 lvenable Initial Creation. * 04/07/2010 4671 mpduff Have the map update upon closure of the dialog. * 07/02/2013 2088 rferrel Changes for non-blocking ColorScaleMgrDlg. - * + * 9/4/2014 14448 cgobs Make HydroView redisplay after save of color settings in ColorScaleMgr * * * @author lvenable @@ -97,6 +97,25 @@ public class ColorScaleMgrAction extends AbstractHandler { } } }); + + colorScaleDlg.setSaveCallback(new ColorScaleMgrDlg.ISaveCallback() { + + public void execute() { + + HydroDisplayManager displayManager = HydroDisplayManager + .getInstance(); + + boolean dataChanged = true; + displayManager.setColorChanged(dataChanged); + + // redraw the main display + displayManager.setDataChanged(dataChanged); + StationDisplay sd = StationDisplay.getInstance(); + sd.redraw(); + + } + }); + colorScaleDlg.open(); } else { colorScaleDlg.bringToTop(); diff --git a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/colorscalemgr/ColorScaleMgrDlg.java b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/colorscalemgr/ColorScaleMgrDlg.java index 7f5b029bfe..ae067bfac6 100644 --- a/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/colorscalemgr/ColorScaleMgrDlg.java +++ b/cave/com.raytheon.viz.hydrocommon/src/com/raytheon/viz/hydrocommon/colorscalemgr/ColorScaleMgrDlg.java @@ -73,7 +73,8 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * disappearing after save * 01 Jul 2013 2088 rferrel Changes for non-blocking dialogs. * 06 Sep 2013 #2342 lvenable Fixed color memory leaks and a null point exception. - * + * 04 Sep 2014 14448 cgobs Make MPE redisplay after save of color settings in ColorScaleMgr + * * * @author lvenable * @version 1.0 @@ -96,6 +97,19 @@ public class ColorScaleMgrDlg extends CaveSWTDialog { */ private ColorChooserDlg colorDlg; + /** + * callback to be execute upon saving of a color set + * generally used to update the display with the newly-saved color set + */ + private ISaveCallback saveCallback; + + public interface ISaveCallback { + + public void execute(); + + } + + /** * User's name. */ @@ -915,6 +929,7 @@ public class ColorScaleMgrDlg extends CaveSWTDialog { } }; + /** * Update the color label on the display * @@ -2016,9 +2031,17 @@ public class ColorScaleMgrDlg extends CaveSWTDialog { updateDurationCombo(); updateColorValueLabelBar(); - + + if (this.saveCallback != null) { + this.saveCallback.execute(); + } setReturnValue(true); } + + public void setSaveCallback(ISaveCallback iSaveCallback) + { + this.saveCallback = iSaveCallback; + } /** * dataType has changed, update dialog diff --git a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/MPEColorScaleMgrAction.java b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/MPEColorScaleMgrAction.java index 7cd3e6761a..ebc51cb0cd 100644 --- a/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/MPEColorScaleMgrAction.java +++ b/cave/com.raytheon.viz.mpe.ui/src/com/raytheon/viz/mpe/ui/actions/MPEColorScaleMgrAction.java @@ -48,6 +48,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback; * Jan 16, 2014 #2691 lvenable Fixed null pointer exception that occurs when closing * the MPE perspective while the ColorScaleMgrDlg is * visible. + * 04 Sep 2014 14448 cgobs Make MPE redisplay after save of color settings in ColorScaleMgr * * * @author mschenke @@ -103,10 +104,54 @@ public class MPEColorScaleMgrAction extends AbstractHandler { DisplayFieldData dt = MPEDisplayManager.getCurrent() .getDisplayFieldType(); - MPEDisplayManager.getCurrent().displayFieldData(dt); + int displayedAccumHrs = mdm.getDisplayedAccumHrs(); + mdm.displayFieldData(dt,displayedAccumHrs ); } } }); + + + //anonymous class declaration for the purposes of a callback execute upon save to database + colorScaleDlg.setSaveCallback(new ColorScaleMgrDlg.ISaveCallback() { + + public void execute() { + + MPEDisplayManager mdm = MPEDisplayManager.getCurrent(); + + // If the MPE Display Manager is null then return as no + // action is needed. + if (mdm == null) { + return; + } + + + + MPEFieldResource displayedFieldResource = mdm + .getDisplayedFieldResource(); + + if (displayedFieldResource != null) { + MPEFieldResourceData resourceData = displayedFieldResource + .getResourceData(); + displayedFieldResource + .getCapability(ColorMapCapability.class) + .setColorMapParameters( + MPEDisplayManager.createColorMap( + resourceData.getCvUseString(), + resourceData + .getDurationInHours(), + resourceData.getDataUnits(), + resourceData.getDisplayUnits())); + DisplayFieldData dt = MPEDisplayManager.getCurrent() + .getDisplayFieldType(); + + int displayedAccumHrs = mdm.getDisplayedAccumHrs(); + + + mdm.displayFieldData(dt, displayedAccumHrs); + } + } + }); + colorScaleDlg.open(); } else { colorScaleDlg.bringToTop();