From a5be98d6dea63caef7f009ca9e66e634275d6ea0 Mon Sep 17 00:00:00 2001 From: Steve Harris Date: Wed, 7 Nov 2012 12:41:20 -0600 Subject: [PATCH] 12.12.1-1 baseline Former-commit-id: e4bd20a515e904cc9e4405b55a1ffe1c9e50995c [formerly e4bd20a515e904cc9e4405b55a1ffe1c9e50995c [formerly 7699acd8cfc5cfa4e902ba98d5fdc2f7c474a535]] Former-commit-id: e1498006c7235696878e459454f1a22a7e86a2cc Former-commit-id: 214fcd3b630630a482a8735e53437a7f3d9b123c --- cave/build/cave/memorySettings.xml | 2 +- .../python/toolpy/UseMetarForPrevailing.py | 8 +- .../textUtilities/regular/FWS_Overrides.py | 9 +- .../uf/viz/core/maps/rsc/DbMapResource.java | 5 +- .../META-INF/spring/viz.xml | 2 + .../alerts/DataCubeAlertMessageParser.java | 58 +- .../procedures/AlterBundleChangeEvent.java | 49 + .../AlterBundleContributorAdapter.java | 143 ++ .../IAlterBundleChangeListener.java | 42 + .../procedures/IAlterBundleContributor.java | 33 +- .../rsc/AbstractRequestableResourceData.java | 80 +- .../viz/d2d/ui/actions/AddAWIPSProcedure.java | 5 +- .../d2d/ui/actions/DeleteAWIPSProcedure.java | 44 +- .../ui/actions/DisplayPropertiesAction.java | 6 +- .../d2d/ui/actions/OpenAWIPSProcedure.java | 51 +- .../viz/d2d/ui/actions/ShowHistoryList.java | 12 +- .../viz/d2d/ui/actions/ShowPrintDialog.java | 12 +- .../ui/dialogs/DisplayPropertiesDialog.java | 9 +- .../viz/d2d/ui/dialogs/ImageBlinkDialog.java | 37 +- .../uf/viz/d2d/ui/dialogs/PrintDialog.java | 124 +- .../ui/dialogs/procedures/AlterBundleDlg.java | 75 +- .../ui/dialogs/procedures/HistoryListDlg.java | 51 +- .../ui/dialogs/procedures/ProcedureDlg.java | 133 +- .../dialogs/procedures/ProcedureListDlg.java | 41 +- .../d2d/ui/map/CreateProjectionHandler.java | 32 +- .../map/actions/SetBackgroundColorAction.java | 12 +- .../ui/actions/NewDerivedParameterAction.java | 12 +- .../ext/KmlColormappedImageExtension.java | 5 +- .../ext/KmlGroundOverlayGenerator.java | 18 +- .../graphics/ext/KmlMosaicImageExtension.java | 7 +- .../graphics/ext/KmlRasterImageExtension.java | 5 +- .../viz/monitor/trendplot/TrendPlotDlg.java | 14 +- .../viz/points/ui/layer/PointsToolLayer.java | 1 + .../products/ui/BaseRadarProductUI.java | 64 +- .../ThinClientLocalizationInitializer.java | 10 +- .../raytheon/viz/alerts/jobs/AutoUpdater.java | 82 +- .../raytheon/viz/aviation/AviationAction.java | 12 +- .../viz/aviation/AviationComponent.java | 8 +- .../raytheon/viz/aviation/AviationDialog.java | 79 +- .../viz/aviation/AvnconfigAction.java | 7 +- .../viz/aviation/AvnconfigComponent.java | 8 +- .../raytheon/viz/aviation/AvnconfigDlg.java | 116 +- .../viz/aviation/CigVisDistComponent.java | 7 +- .../viz/aviation/CigVisTrendComponent.java | 8 +- .../raytheon/viz/aviation/MetarComponent.java | 7 +- .../viz/aviation/WindRoseComponent.java | 7 +- .../climatedata/ClimateDataMenuDlg.java | 101 +- .../climatedata/ClimateHistoryDlg.java | 4 +- .../aviation/climatedata/GenScriptsDlg.java | 18 +- .../aviation/climatedata/NCDCInvHistDlg.java | 45 +- .../climatology/CigVisDistributionDlg.java | 22 +- .../aviation/climatology/CigVisTrendDlg.java | 20 +- .../aviation/climatology/ClimateMenuDlg.java | 48 +- .../climatology/MetarDisplayDialog.java | 24 +- .../climatology/WeatherPlotDialog.java | 57 +- .../climatology/WindRoseConfigDlg.java | 4 +- .../aviation/climatology/WindRosePlotDlg.java | 68 +- .../viz/aviation/editor/LoaderDialog.java | 4 +- .../viz/aviation/editor/QcDialog.java | 8 +- .../aviation/editor/TafViewerEditorDlg.java | 704 +++++----- .../viz/aviation/observer/SendDialog.java | 85 +- .../viz/aviation/observer/TafMonitorDlg.java | 137 +- .../aviation/resource/ResourceEditorDlg.java | 30 +- .../resource/ResourceEditorHelpDlg.java | 26 +- .../viz/aviation/utility/AlertDialog.java | 3 +- .../viz/aviation/utility/BackupDialog.java | 4 +- .../aviation/utility/TimeSelectorDialog.java | 4 +- .../utility/TransmissionQueueDlg.java | 61 +- .../utility/TransmissionViewerDlg.java | 20 +- .../viz/avnconfig/FindReplaceDlg.java | 4 +- .../raytheon/viz/avnconfig/HelpUsageDlg.java | 3 +- .../viz/avnconfig/MessageStatusComp.java | 25 +- .../viz/avnconfig/MessageViewerDlg.java | 15 +- .../viz/avnconfig/MonitoringCriteriaDlg.java | 60 +- .../com/raytheon/viz/avnconfig/OpenDlg.java | 242 ++++ .../viz/avnconfig/TafProductConfigDlg.java | 67 +- .../viz/avnconfig/TafSiteInfoEditorDlg.java | 116 +- .../viz/avnconfig/TextEditorSetupDlg.java | 139 +- .../ToolsAlterBundleContributor.java | 152 ++- .../viz/core/rsc/hdf5/MemoryBasedTileSet.java | 37 +- cave/com.raytheon.viz.gfe/plugin.xml | 26 +- .../viz/gfe/ActivateSiteComponent.java | 4 +- .../viz/gfe/ServiceBackupComponent.java | 5 +- .../gfe/actions/DisplayAttributesAction.java | 21 +- .../gfe/actions/FormatterlauncherAction.java | 32 +- .../actions/ShowAutoSaveIntervalDialog.java | 65 +- .../viz/gfe/actions/ShowBreakLock.java | 18 +- .../viz/gfe/actions/ShowCopyGridsDialog.java | 49 +- .../actions/ShowCreateFromScratchDialog.java | 16 +- .../gfe/actions/ShowDefineRefSetDialog.java | 7 +- .../ShowDefineSamplesLatLongAction.java | 17 +- .../actions/ShowDeleteSampleSetDialog.java | 67 +- .../ShowDeleteSelectionTimeRangeDialog.java | 48 +- .../gfe/actions/ShowEditActionsDialog.java | 7 +- .../actions/ShowGridsInterpolationDialog.java | 43 +- .../ShowHiddenWeatherElementDialog.java | 28 +- .../gfe/actions/ShowLoadSampleSetDialog.java | 161 ++- .../gfe/actions/ShowProcessMonitorDialog.java | 17 +- .../gfe/actions/ShowProductScriptsDialog.java | 16 +- .../viz/gfe/actions/ShowPublishDialog.java | 23 +- .../gfe/actions/ShowRefSetAreaAppearance.java | 16 +- .../gfe/actions/ShowRevertForecastDialog.java | 16 +- .../gfe/actions/ShowSaveForecastDialog.java | 16 +- .../gfe/actions/ShowSaveSampleSetDialog.java | 73 +- .../ShowSaveSelectionTimeRangeDialog.java | 17 +- .../ShowSetInterpolationAlgorithmDialog.java | 17 +- .../gfe/actions/ShowSiteActivationDlg.java | 16 +- ...owTemporalEditorRangeStatisticsDialog.java | 18 +- .../actions/ShowTimeScalePeriodsDialog.java | 24 +- .../viz/gfe/dialogs/CopyGridsDialog.java | 3 +- .../gfe/dialogs/CreateFromScratchDialog.java | 19 +- .../viz/gfe/dialogs/DefineRefSetDialog.java | 82 +- .../DefineSamplesViaLatLongDialog.java | 3 +- .../gfe/dialogs/DisplayAttributesDialog.java | 5 +- .../viz/gfe/dialogs/EditActionsDialog.java | 37 +- .../gfe/dialogs/FormatterLauncherDialog.java | 181 +-- .../gfe/dialogs/GridsInterpolateDialog.java | 3 +- .../dialogs/HiddenWeatherElementDialog.java | 30 +- .../viz/gfe/dialogs/ProductScriptsDialog.java | 160 ++- .../viz/gfe/dialogs/PublishDialog.java | 9 +- .../gfe/dialogs/RefSetAppearanceDialog.java | 5 +- .../viz/gfe/dialogs/SampleSetDialog.java | 17 +- .../SaveDeleteEditAreaGroupDialog.java | 18 +- .../viz/gfe/dialogs/SaveDeleteRefDialog.java | 33 +- .../gfe/dialogs/SaveDeleteSelectTRDialog.java | 9 +- .../gfe/dialogs/TimeScalePeriodsDialog.java | 3 +- .../viz/gfe/dialogs/WERevertDialog.java | 5 +- .../viz/gfe/dialogs/sbu/ServiceBackupDlg.java | 20 +- .../gfe/dialogs/sbu/SiteActivationDlg.java | 4 +- .../gfe/edittool/sample/SamplePainter.java | 6 +- .../gfe/gridmanager/action/GFEFrameTool.java | 24 +- .../perspective/GFEPerspectiveManager.java | 12 +- .../colorbar/ChangeColorMapRangeAction.java | 53 +- .../inv/GribDataCubeAlertMessageParser.java | 58 +- .../viz/grid/rsc/GridResourceData.java | 12 - .../timeseries/TimeSeriesDisplayCanvas.java | 13 +- .../viz/pointdata/rsc/PlotResourceData.java | 48 - .../radar/ui/RadarAlterBundleContributor.java | 7 +- .../menus/satellite/baseSatellite.xml | 4 +- .../satellite/rsc/SatBestResResourceData.java | 3 +- .../texteditor/dialogs/AfosBrowserDlg.java | 14 +- .../texteditor/dialogs/TextEditorDialog.java | 290 ++-- .../TextWorkstationComponent.java | 13 +- .../textworkstation/TextWorkstationDlg.java | 17 +- .../awips/AbstractCAVEComponent.java | 62 +- .../awips/AbstractCAVEDialogComponent.java | 54 + .../viz/ui/actions/ImagePropertiesAction.java | 6 +- .../viz/ui/actions/SetBackgroundColor.java | 4 +- .../viz/ui/actions/ShowTimeDialog.java | 5 +- .../viz/ui/cmenu/ChangeColorMapAction.java | 53 +- .../raytheon/viz/ui/cmenu/ImagingAction.java | 14 +- .../viz/ui/cmenu/LabelOffsetAction.java | 21 +- .../viz/ui/dialogs/CaveSWTDialogBase.java | 14 + .../viz/ui/dialogs/CaveSWTWizardDlg.java | 3 +- .../viz/ui/dialogs/ColormapDialog.java | 4 + .../viz/ui/dialogs/ImagingDialog.java | 11 +- .../viz/ui/dialogs/LabelOffsetDialog.java | 6 +- .../viz/ui/dialogs/SWTMessageBox.java | 13 +- .../viz/ui/dialogs/SetTimeDialog.java | 49 +- .../colordialog/BackgroundColorDialog.java | 4 +- .../dialogs/colordialog/ColorEditDialog.java | 58 +- .../colordialog/SaveColorMapDialog.java | 3 +- ...AbstractWorkbenchPartContextActivator.java | 4 +- .../raytheon/viz/ui/statusline/StatBar.java | 3 +- .../viz/ui/statusline/StatusStore.java | 14 +- .../viz/ui/statusline/ViewMessagesDialog.java | 43 +- .../GridAlterBundleContributor.java | 7 +- .../viz/warngen/gui/WarngenDialog.java | 4 + .../viz/warngen/gui/WarngenLayer.java | 35 +- .../viz/warngen/gui/WarngenUIState.java | 30 + edexOsgi/build.edex/esb/conf/spring/edex.xml | 13 +- .../common_static/base/python/gfe/MetLib.py | 2 +- .../edex_static/base/protectedFiles.txt | 3 + .../edex_static/base/smartinit/Init.py | 9 +- .../base/smartinit/RollBackImporter.py | 40 + .../raytheon/edex/services/PersistSrv.java | 60 +- .../base/purge/airepPurgeRules.xml | 12 +- .../base/purge/binlightningPurgeRules.xml | 12 +- .../base/purge/bufrmosAVNPurgeRules.xml | 8 + .../base/purge/bufrmosETAPurgeRules.xml | 9 + .../base/purge/bufrmosGFSPurgeRules.xml | 8 + .../base/purge/bufrmosHPCPurgeRules.xml | 8 + .../base/purge/bufrmosLAMPPurgeRules.xml | 8 + .../base/purge/bufrmosMRFPurgeRules.xml | 8 + .../base/purge/bufrmosNGMPurgeRules.xml | 8 + .../base/purge/bufruaPurgeRules.xml | 12 +- .../base/purge/ccfpPurgeRules.xml | 12 +- .../gfe/server/database/NetCDFUtils.java | 10 +- .../plugin/gfe/smartinit/SmartInitScript.java | 12 +- .../base/purge/goessoundingPurgeRules.xml | 12 +- .../res/spring/grib-request.xml | 6 +- .../edex/plugin/grib/dao/GribDao.java | 133 +- .../handler/DeleteAllModelDataHandler.java | 59 + .../base/purge/gribPurgeRules.xml | 813 ++--------- .../base/grib/parameterInfo/gfs212.xml | 2 +- .../base/purge/ldadhydroPurgeRules.xml | 12 +- .../base/purge/ldadmanualPurgeRules.xml | 12 +- .../base/purge/ldadprofilerPurgeRules.xml | 12 +- .../base/purge/obsPurgeRules.xml | 37 +- .../base/purge/pirepPurgeRules.xml | 12 +- .../base/purge/poessoundingPurgeRules.xml | 12 +- .../base/purge/profilerPurgeRules.xml | 12 +- .../edex/plugin/radar/RadarDecoder.java | 6 +- .../edex/plugin/radar/dao/RadarDao.java | 429 +++--- .../base/purge/radarPurgeRules.xml | 12 +- .../base/purge/reccoPurgeRules.xml | 12 +- .../base/purge/redbookPurgeRules.xml | 1183 ++++------------- .../util/satellite/SatelliteMenuUtil.java | 8 +- .../base/purge/satellitePurgeRules.xml | 684 ++++------ .../base/purge/sfcobsPurgeRules.xml | 131 +- .../edex/plugin/text/dao/TextDao.java | 56 +- .../raytheon/uf/common/comm/HttpClient.java | 111 +- .../dataplugin/ffmp/FFMPDataContainer.java | 587 ++++---- .../request/DeleteAllModelDataRequest.java | 78 ++ .../spatial/projections/GridCoverage.java | 21 +- .../projections/LatLonGridCoverage.java | 11 +- .../uf/common/geospatial/MapUtil.java | 23 +- .../data/AbstractDataWrapper.java | 33 +- .../geospatial/util/WorldWrapCorrector.java | 135 +- .../config/FFMPRetentionTimeManager.java | 25 +- .../FFMPTemplateConfigurationManager.java | 41 +- .../uf/common/pypies/PyPiesDataStore.java | 34 +- .../uf/common/pypies/PypiesProperties.java | 20 - .../DynamicSerializationManager.java | 8 +- ...f.common.serialization.ISerializableObject | 1 - .../uf/edex/database/plugin/PluginDao.java | 1076 ++++++++------- .../edex/database/plugin/PluginFactory.java | 7 +- .../uf/edex/database/purge/PurgeRule.java | 172 +-- .../uf/edex/database/purge/PurgeRuleSet.java | 75 +- .../uf/edex/database/purge/PurgeRuleTree.java | 141 ++ .../base/purge/defaultPurgeRules.xml | 12 +- .../uf/edex/esb/camel/ProcessUtil.java | 32 +- .../maintenance/archive/DatabaseArchiver.java | 24 +- .../base/purge/acarsPurgeRules.xml | 12 +- .../base/purge/acarssoundingPurgeRules.xml | 12 +- .../base/purge/bufrascatPurgeRules.xml | 12 +- .../base/purge/bufrhdwPurgeRules.xml | 12 +- .../base/purge/bufrmthdwPurgeRules.xml | 12 +- .../base/purge/bufrncwfPurgeRules.xml | 12 +- .../base/purge/bufrquikscatPurgeRules.xml | 12 +- .../base/purge/bufrsigwxPurgeRules.xml | 30 +- .../base/purge/bufrssmiPurgeRules.xml | 12 +- .../base/purge/cwaPurgeRules.xml | 12 +- .../base/purge/cwatPurgeRules.xml | 12 +- .../plugin/ffmp/common/FFMPProcessor.java | 10 +- .../base/purge/ffmpPurgeRules.xml | 12 +- .../uf/edex/plugin/fog/FogURIFilter.java | 48 +- .../base/purge/ldadmesonetPurgeRules.xml | 12 +- .../base/purge/lsrPurgeRules.xml | 12 +- .../uf/edex/purgesrv/PurgeRequest.java | 33 +- .../uf/edex/site/SiteAwareRegistry.java | 11 +- .../impl/purgeAllModelData | 51 + .../purgeallmodeldata/purgeAllModelData.py | 77 ++ .../com.raytheon.uf.tools.cli/impl/textdb | 40 +- .../cli/rsyncGridsToCWF.sh | 63 +- .../cli/src/ifpservertext/ifpServerText.py | 4 +- .../cli/src/sendgfemessage/sendGfeMessage.py | 4 +- .../base/purge/airmetPurgeRules.xml | 12 +- .../base/purge/atcfPurgeRules.xml | 10 +- .../base/purge/awwPurgeRules.xml | 12 +- .../base/purge/convsigmetPurgeRules.xml | 12 +- .../base/purge/ffgPurgeRules.xml | 12 +- .../base/purge/idftPurgeRules.xml | 12 +- .../base/purge/intlsigmetPurgeRules.xml | 12 +- .../base/purge/mcidasPurgeRules.xml | 12 +- .../base/purge/mosaicPurgeRules.xml | 12 +- .../base/purge/ncairepPurgeRules.xml | 12 +- .../base/purge/ncccfpPurgeRules.xml | 12 +- .../base/purge/ncgribPurgeRules.xml | 12 +- .../base/purge/ncpafmPurgeRules.xml | 12 +- .../base/purge/ncpirepPurgeRules.xml | 12 +- .../base/purge/ncscatPurgeRules.xml | 12 +- .../base/purge/ncscdPurgeRules.xml | 12 +- .../base/purge/nctafPurgeRules.xml | 12 +- .../base/purge/ncuairPurgeRules.xml | 12 +- .../base/purge/nonconvsigmetPurgeRules.xml | 12 +- .../base/purge/sgwhPurgeRules.xml | 12 +- .../base/purge/sgwhvPurgeRules.xml | 12 +- .../base/purge/sshaPurgeRules.xml | 12 +- .../base/purge/stormTrackPurgeRules.xml | 12 +- .../base/purge/tcmPurgeRules.xml | 12 +- .../base/purge/wcpPurgeRules.xml | 12 +- .../display/rsc/NsharpDataPaneResource.java | 37 +- .../display/rsc/NsharpResourceHandler.java | 3 +- .../rsc/NsharpTimeStnPaneResource.java | 5 +- .../base/purge/regionalsatPurgeRules.xml | 152 +-- .../site/AFC/purge/regionalsatPurgeRules.xml | 152 +-- .../raytheon/uf/common/dataplugin/__init__.py | 3 +- .../gfe/request/AbstractGfeRequest.py | 44 + .../request/ClearPracticeVTECTableRequest.py | 45 + .../common/dataplugin/gfe/request/__init__.py | 4 + .../gfe/server/message/ServerResponse.py | 5 +- .../uf/common/dataplugin/grib/__init__.py | 27 + .../grib/request/DeleteAllModelDataRequest.py | 33 + .../dataplugin/grib/request/__init__.py | 28 + .../configuration/apache/pypies.conf | 3 +- .../patch/etc/pqact.conf.template | 83 +- 297 files changed, 7806 insertions(+), 6755 deletions(-) create mode 100644 cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/AlterBundleChangeEvent.java create mode 100644 cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/AlterBundleContributorAdapter.java create mode 100644 cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/IAlterBundleChangeListener.java create mode 100644 cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/OpenDlg.java create mode 100644 cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEDialogComponent.java create mode 100644 edexOsgi/build.edex/esb/data/utility/edex_static/base/smartinit/RollBackImporter.py create mode 100644 edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosAVNPurgeRules.xml create mode 100644 edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosETAPurgeRules.xml create mode 100644 edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosGFSPurgeRules.xml create mode 100644 edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosHPCPurgeRules.xml create mode 100644 edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosLAMPPurgeRules.xml create mode 100644 edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosMRFPurgeRules.xml create mode 100644 edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosNGMPurgeRules.xml create mode 100644 edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/handler/DeleteAllModelDataHandler.java create mode 100644 edexOsgi/com.raytheon.uf.common.dataplugin.grib/src/com/raytheon/uf/common/dataplugin/grib/request/DeleteAllModelDataRequest.java create mode 100644 edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/purge/PurgeRuleTree.java create mode 100644 edexOsgi/com.raytheon.uf.tools.cli/impl/purgeAllModelData create mode 100644 edexOsgi/com.raytheon.uf.tools.cli/impl/src/purgeallmodeldata/purgeAllModelData.py create mode 100644 pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/AbstractGfeRequest.py create mode 100644 pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/ClearPracticeVTECTableRequest.py create mode 100644 pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/grib/__init__.py create mode 100644 pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/grib/request/DeleteAllModelDataRequest.py create mode 100644 pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/grib/request/__init__.py diff --git a/cave/build/cave/memorySettings.xml b/cave/build/cave/memorySettings.xml index 82f16244c1..3823d5034c 100644 --- a/cave/build/cave/memorySettings.xml +++ b/cave/build/cave/memorySettings.xml @@ -123,7 +123,7 @@ - 2048M + 3072M diff --git a/cave/build/static/common/cave/etc/aviation/python/toolpy/UseMetarForPrevailing.py b/cave/build/static/common/cave/etc/aviation/python/toolpy/UseMetarForPrevailing.py index 6879506dd3..48f6a4b43e 100644 --- a/cave/build/static/common/cave/etc/aviation/python/toolpy/UseMetarForPrevailing.py +++ b/cave/build/static/common/cave/etc/aviation/python/toolpy/UseMetarForPrevailing.py @@ -76,7 +76,10 @@ # Status: TEST # Title: AvnFPS: TAF No Significant Weather (NSW) not QC'd correctly # -# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# Nov 02, 2012 15476 zhao Retrieve latest METAR record from database +## import logging, time import Avn, AvnLib, AvnParser, TafDecoder @@ -104,7 +107,8 @@ def updateTafs(bbb, fcsts): AvnLib.adjustTimes(bbb, taf) evtime=taf['vtime']['str'][5:] - metar = MetarData.retrieve(ident)[0] +# For DR15476: use 'maxSize=0' to indicate that the latest record is to be retrieved + metar = MetarData.retrieve(ident,0)[0] AvnLib.updateTafWithMetar(taf['group'][0]['prev'], metar.dcd) lines = AvnLib.makeTafFromPeriods(ident, bbb, taf['group'], tafDuration=tafDuration, diff --git a/cave/build/static/common/cave/etc/gfe/userPython/textUtilities/regular/FWS_Overrides.py b/cave/build/static/common/cave/etc/gfe/userPython/textUtilities/regular/FWS_Overrides.py index 8784e8406c..dda39378af 100644 --- a/cave/build/static/common/cave/etc/gfe/userPython/textUtilities/regular/FWS_Overrides.py +++ b/cave/build/static/common/cave/etc/gfe/userPython/textUtilities/regular/FWS_Overrides.py @@ -1411,9 +1411,12 @@ class FWS_Overrides: for element, defaultFlag in self._weInfoHiddenList(): if defaultFlag: - self._periodElementDict["Today"].append(element) - self._periodElementDict["Tonight"].append(element) - self._periodElementDict["Tomorrow"].append(element) + if len(self._periodElementDict["Today"]) != 0: + self._periodElementDict["Today"].append(element) + if len(self._periodElementDict["Tonight"]) != 0: + self._periodElementDict["Tonight"].append(element) + if len(self._periodElementDict["Tomorrow"]) != 0: + self._periodElementDict["Tomorrow"].append(element) self._periodAllElementDict["Today"].append(element) self._periodAllElementDict["Tonight"].append(element) self._periodAllElementDict["Tomorrow"].append(element) diff --git a/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/rsc/DbMapResource.java b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/rsc/DbMapResource.java index 204cb8e444..4c4c7bc88e 100644 --- a/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/rsc/DbMapResource.java +++ b/cave/com.raytheon.uf.viz.core.maps/src/com/raytheon/uf/viz/core/maps/rsc/DbMapResource.java @@ -292,8 +292,9 @@ public class DbMapResource extends } QueryResult mappedResult = DbMapQueryFactory.getMapQuery( resourceData.getTable(), - resourceData.getGeomField()).queryWithinEnvelope( - req.envelope, fields, constraints); + getGeomField(levels[levels.length - 1])) + .queryWithinEnvelope(req.envelope, fields, + constraints); Map gidMap = new HashMap( mappedResult.getResultCount() * 2); List toRequest = new ArrayList( diff --git a/cave/com.raytheon.uf.viz.core/META-INF/spring/viz.xml b/cave/com.raytheon.uf.viz.core/META-INF/spring/viz.xml index ed0ae947f1..1ba7778794 100644 --- a/cave/com.raytheon.uf.viz.core/META-INF/spring/viz.xml +++ b/cave/com.raytheon.uf.viz.core/META-INF/spring/viz.xml @@ -9,6 +9,8 @@ + + diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/alerts/DataCubeAlertMessageParser.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/alerts/DataCubeAlertMessageParser.java index 1946a8a337..fdb3d0bbeb 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/alerts/DataCubeAlertMessageParser.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/alerts/DataCubeAlertMessageParser.java @@ -19,22 +19,11 @@ **/ package com.raytheon.uf.viz.core.alerts; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.viz.core.RecordFactory; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; -import com.raytheon.uf.viz.core.rsc.ResourceType; /** * @@ -64,52 +53,7 @@ public class DataCubeAlertMessageParser extends AbstractAlertMessageParser { public Object parseAlertMessage(AlertMessage message, AbstractRequestableResourceData reqResourceData) throws VizException { - Object objectToSend = null; - Map attribs = new HashMap( - message.decodedAlert); - String dataURI = message.dataURI; - if (reqResourceData.isUpdatingOnMetadataOnly()) { - PluginDataObject record = RecordFactory.getInstance() - .loadRecordFromUri(dataURI); - objectToSend = record; - } else { - attribs.put("dataURI", message.dataURI); - Map vals = new HashMap(); - for (String column : attribs.keySet()) { - if (column.equals("dataURI")) { - continue; - } - if ((attribs.get(column) == null) - || attribs.get(column).toString().equals("null")) { - vals.put(column, new RequestConstraint(null, - RequestConstraint.ConstraintType.ISNULL)); - } else { - vals.put(column, new RequestConstraint(attribs.get(column) - .toString())); - } - } - // Make sure there is really data before sending it to be loaded - DataTime[] availableTimes = DataCubeContainer.performTimeQuery( - vals, false); - if (availableTimes == null) { - return objectToSend; - } - for (DataTime time : availableTimes) { - if (time.equals(attribs.get("dataTime"))) { - LayerProperty lp = new LayerProperty(); - - lp.setDesiredProduct(ResourceType.PLAN_VIEW); - lp.setEntryQueryParameters(vals, false); - lp.setSelectedEntryTimes(new DataTime[] { time }); - List resp = DataCubeContainer.getData(lp, 60000); - if (resp.size() == 0) - return null; - objectToSend = resp.get(0); - break; - } - } - } - return objectToSend; + return null; } } diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/AlterBundleChangeEvent.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/AlterBundleChangeEvent.java new file mode 100644 index 0000000000..1b7132037d --- /dev/null +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/AlterBundleChangeEvent.java @@ -0,0 +1,49 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.viz.core.procedures; + +/** + * Event to provide the keys of alter bundles that were changed. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Oct 3, 2012  1248       rferrel     Initial creation
+ * 
+ * 
+ * + * @author rferrel + * @version 1.0 + */ + +public class AlterBundleChangeEvent { + private String[] keys; + + public AlterBundleChangeEvent(String[] keys) { + this.keys = keys; + } + + public String[] getKeys() { + return keys; + } +} diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/AlterBundleContributorAdapter.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/AlterBundleContributorAdapter.java new file mode 100644 index 0000000000..6af478ef55 --- /dev/null +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/AlterBundleContributorAdapter.java @@ -0,0 +1,143 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.viz.core.procedures; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * An abstract class that implements IAlterBundleContributor. Default methods + * are provided for getAlterables(String key), addAlterBundleChangeListner(), + * and removeAlterBundleChangeListner. All other methods of the interface must + * be implemented in the subclass. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Oct 3, 2012  1248       rferrel     Initial creation
+ * 
+ * 
+ * + * @author rferrel + * @version 1.0 + */ + +public abstract class AlterBundleContributorAdapter implements + IAlterBundleContributor { + + private List bundleListeners = new ArrayList(); + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.procedures.IAlterBundleContributor#getAlterables + * () + */ + public abstract Map getAlterables(); + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.procedures.IAlterBundleContributor#alterBundle + * (com.raytheon.uf.viz.core.procedures.Bundle, java.lang.String, + * java.lang.String) + */ + public abstract void alterBundle(Bundle bundleToAlter, String alterKey, + String alterValue); + + public String[] getAlterables(String key) { + return null; + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.core.procedures.AlterBundleContributorAdapter# + * addAlterBundleChangeListner + * (com.raytheon.uf.viz.core.procedures.IAlternateBundleChangeListener) + */ + @Override + public final void addAlterBundleChangeListener( + IAlterBundleChangeListener listener) { + synchronized (bundleListeners) { + bundleListeners.add(listener); + } + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.core.procedures.AlterBundleContributorAdapter# + * removeAlterBundeChangeListner + * (com.raytheon.uf.viz.core.procedures.IAlternateBundleChangeListener) + */ + @Override + public final void removeAlterBundeChangeListener( + IAlterBundleChangeListener listener) { + synchronized (bundleListeners) { + bundleListeners.remove(listener); + } + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.procedures.IAlterBundleContributor#listenerSetup + * () + */ + @Override + public void listenerSetup() { + // Default do nothing. + } + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.viz.core.procedures.IAlterBundleContributor#listenerShutdown + * () + */ + @Override + public void listenerShutdown() { + // Default do nothing. + } + + protected final void fireAlterBundleChangeListener( + final AlterBundleChangeEvent event) { + List listeners = null; + synchronized (bundleListeners) { + if (bundleListeners.isEmpty()) { + return; + } + listeners = new ArrayList( + bundleListeners); + } + for (IAlterBundleChangeListener listener : listeners) { + listener.changeBundle(event); + } + } +} diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/IAlterBundleChangeListener.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/IAlterBundleChangeListener.java new file mode 100644 index 0000000000..d34fb85fb0 --- /dev/null +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/IAlterBundleChangeListener.java @@ -0,0 +1,42 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.viz.core.procedures; + +/** + * Listener used in the IAlterBundleContributor to indicate changes in an alter + * bundle structure. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Oct 3, 2012  1248       rferrel     Initial creation
+ * 
+ * 
+ * + * @author rferrel + * @version 1.0 + */ + +public interface IAlterBundleChangeListener { + public void changeBundle(AlterBundleChangeEvent event); +} diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/IAlterBundleContributor.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/IAlterBundleContributor.java index 6ec226710f..66d6264939 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/IAlterBundleContributor.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/procedures/IAlterBundleContributor.java @@ -22,7 +22,7 @@ package com.raytheon.uf.viz.core.procedures; import java.util.Map; /** - * TODO Add Description + * Interface for methods needed for handling alter bundles. * *
  * 
@@ -31,6 +31,7 @@ import java.util.Map;
  * ------------ ---------- ----------- --------------------------
  * Jan 4, 2010            mschenke     Initial creation
  * Aug 8, 2012  875        rferrel     Add separators for menu support.
+ * Oct 3, 2012  1248       rferrel     Added bundle change listeners.
  * 
  * 
* @@ -85,4 +86,34 @@ public interface IAlterBundleContributor { */ public void alterBundle(Bundle bundleToAlter, String alterKey, String alterValue); + + /** + * Git the keys associated with the bundle. + * + * @param key + * @return + */ + public String[] getAlterables(String key); + + /** + * @param listener + */ + public void addAlterBundleChangeListener(IAlterBundleChangeListener listener); + + /** + * @param listener + */ + public void removeAlterBundeChangeListener( + IAlterBundleChangeListener listener); + + /** + * Allows setup for handling of IAlterBundleChangeListener. + */ + public void listenerSetup(); + + /** + * Allows clean up of listener setup when bundle no longer needs to handler + * IAlterBundleChangeListeners. + */ + public void listenerShutdown(); } diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractRequestableResourceData.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractRequestableResourceData.java index d1140452b4..7baa0495bd 100644 --- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractRequestableResourceData.java +++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractRequestableResourceData.java @@ -19,6 +19,7 @@ **/ package com.raytheon.uf.viz.core.rsc; +import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -45,7 +46,9 @@ import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.RecordFactory; import com.raytheon.uf.viz.core.alerts.AbstractAlertMessageParser; +import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.catalog.LayerProperty; +import com.raytheon.uf.viz.core.comm.Loader; import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.exception.NoDataAvailableException; @@ -97,6 +100,32 @@ public abstract class AbstractRequestableResourceData extends */ private static int ENTRYTIMES_SLICE_SIZE = 500; + private static class AlertMessageToPDOParser extends + AbstractAlertMessageParser { + + @Override + public Object parseAlertMessage(AlertMessage message, + AbstractRequestableResourceData reqResourceData) + throws VizException { + Object objectToSend = null; + Map attribs = new HashMap( + message.decodedAlert); + String dataURI = message.dataURI; + if (reqResourceData.isUpdatingOnMetadataOnly()) { + PluginDataObject record = RecordFactory.getInstance() + .loadRecordFromUri(dataURI); + objectToSend = record; + + } else { + attribs.put("dataURI", message.dataURI); + objectToSend = Loader.loadData(attribs); + } + return objectToSend; + } + }; + + private static AlertMessageToPDOParser defaultParser = new AlertMessageToPDOParser(); + /** the metadata criteria to retrieve the resource */ @XmlJavaTypeAdapter(value = RequestableMetadataMarshaller.class) protected HashMap metadataMap; @@ -246,21 +275,52 @@ public abstract class AbstractRequestableResourceData extends Validate.isTrue(updateData instanceof Object[], "Update expected Object[]"); - if (updateData instanceof PluginDataObject[]) { - for (PluginDataObject pdo : (PluginDataObject[]) updateData) { - DataTime time = pdo.getDataTime(); - if (binOffset != null) { - time = binOffset.getNormalizedTime(time); + this.fireChangeListeners(ChangeType.DATA_UPDATE, updateData); + } + + public void update(AlertMessage... messages) { + List objectsToSend = new ArrayList(messages.length); + boolean consistentCache = true; + for (AlertMessage message : messages) { + try { + AbstractAlertMessageParser parser = getAlertParser(); + if (parser == null) { + parser = defaultParser; } - synchronized (cachedAvailableTimes) { - if (!cachedAvailableTimes.contains(time)) { - cachedAvailableTimes.add(time); + Object timeObj = null; + // do not try to maintain the time cache if the alert does not + // parse. + Object objectToSend = parser.parseAlertMessage(message, this); + if (objectToSend != null) { + objectsToSend.add(objectToSend); + timeObj = message.decodedAlert.get("dataTime"); + } + if (timeObj instanceof DataTime) { + DataTime time = (DataTime) timeObj; + if (binOffset != null) { + time = binOffset.getNormalizedTime(time); } + synchronized (cachedAvailableTimes) { + if (!cachedAvailableTimes.contains(time)) { + cachedAvailableTimes.add(time); + } + } + } else { + consistentCache = false; } + } catch (VizException e) { + statusHandler.handle(Priority.PROBLEM, + "Error performing update: " + message.dataURI, e); } } - - this.fireChangeListeners(ChangeType.DATA_UPDATE, updateData); + if (!consistentCache) { + invalidateAvailableTimesCache(); + } + if (!objectsToSend.isEmpty()) { + Class componentType = objectsToSend.get(0).getClass(); + update(objectsToSend.toArray((Object[]) Array.newInstance( + componentType, objectsToSend.size()))); + } } /** diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/AddAWIPSProcedure.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/AddAWIPSProcedure.java index 056292b90f..25fe8a8032 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/AddAWIPSProcedure.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/AddAWIPSProcedure.java @@ -39,6 +39,7 @@ import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureDlg; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Sep 13, 2007 chammack Initial Creation. + * Oct 16, 2012 1229 rferrel Change to use ProcedureDlg.displayDialog. * * * @@ -57,10 +58,8 @@ public class AddAWIPSProcedure extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { Procedure procedure = new Procedure(); - ProcedureDlg dlg = ProcedureDlg.getOrCreateDialog(null, procedure, + ProcedureDlg.displayDialog(null, procedure, HandlerUtil.getActiveShell(event)); - dlg.open(); - return null; } diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/DeleteAWIPSProcedure.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/DeleteAWIPSProcedure.java index 70c6d1740e..8a74e8eb90 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/DeleteAWIPSProcedure.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/DeleteAWIPSProcedure.java @@ -25,8 +25,13 @@ import org.eclipse.core.commands.ExecutionException; import org.eclipse.ui.handlers.HandlerUtil; import com.raytheon.uf.common.localization.LocalizationFile; +import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureListDlg; import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureListDlg.Mode; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * DeleteAWIPSProcedure @@ -41,6 +46,7 @@ import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureListDlg.Mode; * ------------ ---------- ----------- -------------------------- * Sep 13, 2007 chammack Initial Creation. * Jul 8, 2008 #1183 chammack Migrate to new localization + * Oct 16, 2012 #1229 rferrel Changes for non-blocking ProcedureListDlg. * * * @@ -48,6 +54,10 @@ import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureListDlg.Mode; * @version 1 */ public class DeleteAWIPSProcedure extends AbstractHandler { + private final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(DeleteAWIPSProcedure.class); + + private ProcedureListDlg listDlg; /* * (non-Javadoc) @@ -58,18 +68,30 @@ public class DeleteAWIPSProcedure extends AbstractHandler { */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { - ProcedureListDlg listDlg = new ProcedureListDlg("Delete Procedure", - HandlerUtil.getActiveShell(event), Mode.DELETE); - listDlg.open(); + if (listDlg == null || listDlg.getShell() == null + || listDlg.isDisposed()) { + listDlg = new ProcedureListDlg("Delete Procedure", + HandlerUtil.getActiveShell(event), Mode.DELETE); + listDlg.setCloseCallback(new ICloseCallback() { - LocalizationFile selectedFile = listDlg.getSelectedFile(); - if (selectedFile != null && selectedFile.exists()) { - try { - selectedFile.delete(); - } catch (Exception e) { - throw new ExecutionException("Error deleting procedure: " - + selectedFile.getName(), e); - } + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof LocalizationFile) { + LocalizationFile selectedFile = (LocalizationFile) returnValue; + try { + selectedFile.delete(); + } catch (LocalizationOpFailedException e) { + statusHandler.handle( + Priority.PROBLEM, + "Error deleting procedure: " + + selectedFile.getName()); + } + } + } + }); + listDlg.open(); + } else { + listDlg.bringToTop(); } return null; diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/DisplayPropertiesAction.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/DisplayPropertiesAction.java index f4a0dd0a9e..9d7ff0d33c 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/DisplayPropertiesAction.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/DisplayPropertiesAction.java @@ -35,6 +35,7 @@ import com.raytheon.viz.ui.tools.AbstractTool; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 8, 2009 bgonzale Initial creation + * Oct 15, 2012 1229 rferrel Changes for non-blocking DisplayPropertiesDialog. * * * @@ -57,13 +58,12 @@ public class DisplayPropertiesAction extends AbstractTool { public Object execute(ExecutionEvent arg0) throws ExecutionException { super.execute(arg0); - if (dialog == null) { + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { dialog = new DisplayPropertiesDialog(VizWorkbenchManager .getInstance().getCurrentWindow().getShell()); dialog.open(); - dialog = null; } else { - dialog.open(); + dialog.bringToTop(); } return null; diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/OpenAWIPSProcedure.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/OpenAWIPSProcedure.java index 7e9d075b4b..306883f180 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/OpenAWIPSProcedure.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/OpenAWIPSProcedure.java @@ -24,8 +24,6 @@ import java.io.File; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.handlers.HandlerUtil; import com.raytheon.uf.common.localization.LocalizationFile; @@ -33,9 +31,9 @@ import com.raytheon.uf.common.localization.LocalizationUtil; import com.raytheon.uf.viz.core.procedures.Procedure; import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.OpenProcedureListDlg; import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureDlg; -import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureListDlg; import com.raytheon.viz.ui.VizWorkbenchManager; import com.raytheon.viz.ui.actions.LoadSerializedXml; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * OpenAWIPSProcedure @@ -47,6 +45,8 @@ import com.raytheon.viz.ui.actions.LoadSerializedXml; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Sep 13, 2007 chammack Initial Creation. + * Oct 16, 2012 1229 rferrel Change to use ProcedureDlg.displayDialog. + * Oct 16, 2012 1229 rferrel Changes for non-blocking ProcedureListDlg. * * * @@ -55,8 +55,8 @@ import com.raytheon.viz.ui.actions.LoadSerializedXml; */ public class OpenAWIPSProcedure extends AbstractHandler { - private OpenProcedureListDlg dialog; - + private OpenProcedureListDlg dialog; + /* * (non-Javadoc) * @@ -66,25 +66,28 @@ public class OpenAWIPSProcedure extends AbstractHandler { */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { - if(dialog != null){ - dialog.open(); - return null; - } - - dialog = new OpenProcedureListDlg( - HandlerUtil.getActiveShell(event)); - dialog.open(); - - LocalizationFile selectedFile = dialog.getSelectedFile(); - dialog = null; - if (selectedFile != null) { - File f = selectedFile.getFile(); - Procedure p = (Procedure) LoadSerializedXml.deserialize(f); - ProcedureDlg dlg = ProcedureDlg.getOrCreateDialog( - LocalizationUtil.extractName(selectedFile.getName()), p, - VizWorkbenchManager.getInstance().getCurrentWindow() - .getShell()); - dlg.open(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + dialog = new OpenProcedureListDlg(HandlerUtil.getActiveShell(event)); + dialog.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof LocalizationFile) { + LocalizationFile selectedFile = (LocalizationFile) returnValue; + File f = selectedFile.getFile(); + Procedure p = (Procedure) LoadSerializedXml + .deserialize(f); + ProcedureDlg.displayDialog(LocalizationUtil + .extractName(selectedFile.getName()), p, + VizWorkbenchManager.getInstance() + .getCurrentWindow().getShell()); + } + dialog = null; + } + }); + dialog.open(); + } else { + dialog.bringToTop(); } return null; diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ShowHistoryList.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ShowHistoryList.java index 2bd23785f7..62951b3a00 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ShowHistoryList.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ShowHistoryList.java @@ -38,6 +38,7 @@ import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.HistoryListDlg; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Sep 13, 2007 chammack Initial Creation. + * Oct 16, 2012 1229 rferrel Changes for non-blocking HistoryListDlg. * * * @@ -46,6 +47,8 @@ import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.HistoryListDlg; */ public class ShowHistoryList extends AbstractHandler { + private HistoryListDlg dialog; + /* * (non-Javadoc) * @@ -55,9 +58,12 @@ public class ShowHistoryList extends AbstractHandler { */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { - HistoryListDlg dlg = new HistoryListDlg( - HandlerUtil.getActiveShell(event)); - dlg.open(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + dialog = new HistoryListDlg(HandlerUtil.getActiveShell(event)); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ShowPrintDialog.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ShowPrintDialog.java index ed902689a2..b0810bc6b7 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ShowPrintDialog.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/ShowPrintDialog.java @@ -36,6 +36,7 @@ import com.raytheon.uf.viz.d2d.ui.dialogs.PrintDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Feb 15, 2011 bkowal Initial creation + * Oct 15, 2012 1229 rferrel Changes to work with non-blocking PrintDialog. * * * @@ -44,6 +45,7 @@ import com.raytheon.uf.viz.d2d.ui.dialogs.PrintDialog; */ public class ShowPrintDialog extends AbstractHandler { + PrintDialog printDialog; /* * (non-Javadoc) @@ -54,9 +56,13 @@ public class ShowPrintDialog extends AbstractHandler { */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { - PrintDialog printDialog = new PrintDialog( - HandlerUtil.getActiveShell(event)); - printDialog.open(); + if (printDialog == null || printDialog.getShell() == null + || printDialog.isDisposed()) { + printDialog = new PrintDialog(HandlerUtil.getActiveShell(event)); + printDialog.open(); + } else { + printDialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/DisplayPropertiesDialog.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/DisplayPropertiesDialog.java index d86be33251..b04502dd01 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/DisplayPropertiesDialog.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/DisplayPropertiesDialog.java @@ -54,11 +54,9 @@ import com.raytheon.uf.viz.core.rsc.IResourceGroup; import com.raytheon.uf.viz.core.rsc.ResourceList; import com.raytheon.uf.viz.core.rsc.capabilities.AbstractCapability; import com.raytheon.uf.viz.core.rsc.capabilities.OutlineCapability; -import com.raytheon.uf.viz.core.status.StatusConstants; import com.raytheon.uf.viz.d2d.core.map.MapScales; import com.raytheon.uf.viz.d2d.core.map.MapScales.MapScale; import com.raytheon.uf.viz.d2d.core.time.LoadMode; -import com.raytheon.uf.viz.d2d.ui.Activator; import com.raytheon.uf.viz.d2d.ui.DensityPopulator; import com.raytheon.uf.viz.d2d.ui.MagnificationPopulator; import com.raytheon.uf.viz.d2d.ui.actions.DensityHandler; @@ -78,6 +76,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 8, 2009 bgonzale Initial creation + * Oct 16, 2012 1229 rferrel Made dialog non-blocking. * * * @@ -86,7 +85,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; */ public class DisplayPropertiesDialog extends CaveSWTDialog { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(DisplayPropertiesDialog.class); + private final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(DisplayPropertiesDialog.class); private Combo scale; @@ -171,7 +171,8 @@ public class DisplayPropertiesDialog extends CaveSWTDialog { * @param editor */ public DisplayPropertiesDialog(Shell parentShell) { - super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.INDEPENDENT_SHELL); + super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.INDEPENDENT_SHELL + | CAVE.DO_NOT_BLOCK); setText("Display Properties"); this.sHandler = new ScaleHandler(); diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/ImageBlinkDialog.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/ImageBlinkDialog.java index f49d385070..fad38bdba8 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/ImageBlinkDialog.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/ImageBlinkDialog.java @@ -52,7 +52,7 @@ import com.raytheon.viz.ui.dialogs.colordialog.ColorData; import com.raytheon.viz.ui.dialogs.colordialog.IColorBarAction; /** - * TODO Add Description + * This is a dialog to determine what range of a rendered display should blink. * *
  * 
@@ -60,6 +60,8 @@ import com.raytheon.viz.ui.dialogs.colordialog.IColorBarAction;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Sep 13, 2010            mschenke     Initial creation
+ * Oct 16, 2012 1229       rferrel     Updated to use bringToTop to
+ *                                      activate existing dialog.
  * 
  * 
* @@ -92,18 +94,36 @@ public class ImageBlinkDialog extends CaveSWTDialog implements private static Map, ImageBlinkDialog> dialogMap = new HashMap, ImageBlinkDialog>(); + /** + * If needed creates an instance of this dialog and associates it with the + * resource and opens the dialog or activates the dialog if one already + * exists for the resource. + * + * @param rates + * @param currRate + * @param resource + * @param rscProps + * @param displays + */ public static synchronized void openDialog(float[] rates, float currRate, AbstractVizResource resource, ResourceProperties rscProps, D2DMapRenderableDisplay[] displays) { ImageBlinkDialog dlg = dialogMap.get(resource); - if (dlg == null) { + if (dlg == null || dlg.getShell() == null || dlg.isDisposed()) { dlg = new ImageBlinkDialog(new Shell(Display.getCurrent()), rates, currRate, resource, rscProps, displays); dialogMap.put(resource, dlg); + dlg.open(); + } else { + dlg.bringToTop(); } - dlg.open(); } + /** + * Removes the dialog associated with the resource. + * + * @param resource + */ public static synchronized void removeDialog( AbstractVizResource resource) { dialogMap.remove(resource); @@ -146,10 +166,8 @@ public class ImageBlinkDialog extends CaveSWTDialog implements @Override public void widgetDisposed(DisposeEvent e) { removeDialog(resource); - resource - .unregisterListener((IDisposeListener) ImageBlinkDialog.this); - resource - .unregisterListener((IPaintListener) ImageBlinkDialog.this); + resource.unregisterListener((IDisposeListener) ImageBlinkDialog.this); + resource.unregisterListener((IPaintListener) ImageBlinkDialog.this); } }); Composite mainComp = new Composite(shell, SWT.NONE); @@ -186,9 +204,8 @@ public class ImageBlinkDialog extends CaveSWTDialog implements cbo.add(BlinkToggleAction.NO_BLINK); - cbo - .setText(rate == BlinkToggleAction.NO_BLINK_VALUE ? BlinkToggleAction.NO_BLINK - : "" + rate); + cbo.setText(rate == BlinkToggleAction.NO_BLINK_VALUE ? BlinkToggleAction.NO_BLINK + : "" + rate); cbo.addSelectionListener(new SelectionAdapter() { @Override diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/PrintDialog.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/PrintDialog.java index b46e92c95c..0f3f04bf5d 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/PrintDialog.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/PrintDialog.java @@ -98,6 +98,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor; * AWIPS2 DR Work * 08/15/2012 1053 jkorman Added capability to save/restore user * print settings. + * 10/12/2012 1229 rferrel Made dialog non-blocking. * * * @@ -107,10 +108,11 @@ import com.raytheon.viz.ui.editor.AbstractEditor; public class PrintDialog extends CaveSWTDialog { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(PrintDialog.class); + private final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(PrintDialog.class); + + private final String SETTINGS_FILENAME = "printSettings"; - private static final String SETTINGS_FILENAME = "printSettings"; - private ArrayList printerDataStore = null; private PrinterData printToFileData = null; @@ -130,13 +132,12 @@ public class PrintDialog extends CaveSWTDialog { private Button colorRadioButton = null; private Button grayscaleRadioButton = null; - + /* Orientation */ private Button landscapeRadioButton = null; private Button portraitRadioButton = null; - /* Remaining Settings */ private Spinner scaleSpinner = null; @@ -189,7 +190,7 @@ public class PrintDialog extends CaveSWTDialog { } public PrintDialog(Shell shell) { - super(shell, SWT.DIALOG_TRIM); + super(shell, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK); this.setText("Print"); } @@ -315,7 +316,7 @@ public class PrintDialog extends CaveSWTDialog { button.setText("Color"); button.setSelection(true); colorRadioButton = button; - + button = new Button(group, SWT.RADIO); button.setText("Grayscale"); this.grayscaleRadioButton = button; @@ -329,7 +330,7 @@ public class PrintDialog extends CaveSWTDialog { button.setText("Portrait"); button.setSelection(true); portraitRadioButton = button; - + button = new Button(group, SWT.RADIO); button.setText("Landscape"); this.landscapeRadioButton = button; @@ -502,20 +503,20 @@ public class PrintDialog extends CaveSWTDialog { } private void selectDestinationFile(String fileName) { - + FileDialog fileDialog = new FileDialog(this.shell, SWT.SAVE); - - if(fileName != null) { + + if (fileName != null) { int n = fileName.lastIndexOf(File.separator); String path = null; - if(n > 0) { - path = fileName.substring(0,n); - fileName = fileName.substring(n+1); + if (n > 0) { + path = fileName.substring(0, n); + fileName = fileName.substring(n + 1); } fileDialog.setFileName(fileName); fileDialog.setFilterPath(path); } - + fileDialog.open(); String filterPath = fileDialog.getFilterPath(); @@ -710,8 +711,8 @@ public class PrintDialog extends CaveSWTDialog { } if (printerSettings.invert) { - // Only invert gray pixels, not colored pixels, awt doesn't not have a - // good filter for this. + // Only invert gray pixels, not colored pixels, awt doesn't not have + // a good filter for this. for (int x = 0; x < bi.getWidth(); x += 1) { for (int y = 0; y < bi.getHeight(); y += 1) { Color color = new Color(bi.getRGB(x, y)); @@ -721,7 +722,7 @@ public class PrintDialog extends CaveSWTDialog { 255 - color.getGreen(), 255 - color.getBlue()); bi.setRGB(x, y, color.getRGB()); } - + } } } @@ -887,15 +888,16 @@ public class PrintDialog extends CaveSWTDialog { settings.setInvertBlackWhite(invertCheckbox.getSelection()); settings.setPrintGrayScale(grayscaleRadioButton.getSelection()); - settings.setOrientation(PRINT_ORIENTATION.getPrintOrientation(landscapeRadioButton.getSelection())); + settings.setOrientation(PRINT_ORIENTATION + .getPrintOrientation(landscapeRadioButton.getSelection())); settings.setCopies(copiesSpinner.getSelection()); settings.setScale(scaleSpinner.getSelection()); - + settings.setDensity(densityCombo.getSelectionIndex()); settings.setMag(magnificationCombo.getSelectionIndex()); - - if(printerRadioButton.getSelection()) { + + if (printerRadioButton.getSelection()) { int idx = selectedPrinterCombo.getSelectionIndex(); settings.setPrinterUsed(selectedPrinterCombo.getItem(idx)); settings.setUsePrinterFile(false); @@ -905,9 +907,10 @@ public class PrintDialog extends CaveSWTDialog { } LocalizationContext ctx = initUserLocalization(); - + // Get a list of localization files! - LocalizationFile f = PathManagerFactory.getPathManager().getLocalizationFile(ctx, SETTINGS_FILENAME); + LocalizationFile f = PathManagerFactory.getPathManager() + .getLocalizationFile(ctx, SETTINGS_FILENAME); OutputStream strm = null; try { strm = f.openOutputStream(); @@ -917,11 +920,12 @@ public class PrintDialog extends CaveSWTDialog { } catch (Exception e) { statusHandler.error("Could not save user print settings", e); } finally { - if(f != null) { + if (f != null) { try { strm.close(); - } catch(IOException ioe) { - statusHandler.error("Could not close user print settings", ioe); + } catch (IOException ioe) { + statusHandler.error("Could not close user print settings", + ioe); } } } @@ -933,71 +937,79 @@ public class PrintDialog extends CaveSWTDialog { private void readFromConfig() { LocalizationContext ctx = initUserLocalization(); - + // Get a list of localization files! - LocalizationFile f = PathManagerFactory.getPathManager().getLocalizationFile(ctx, SETTINGS_FILENAME); + LocalizationFile f = PathManagerFactory.getPathManager() + .getLocalizationFile(ctx, SETTINGS_FILENAME); // If its not there, no previous settings have been saved. Just exit. - if(f.exists()) { + if (f.exists()) { UserPrintSettings settings = null; try { - - settings = (UserPrintSettings) JAXB.unmarshal(f.openInputStream(),UserPrintSettings.class); + + settings = (UserPrintSettings) JAXB.unmarshal( + f.openInputStream(), UserPrintSettings.class); } catch (Exception e) { - statusHandler.error("Could not read user print settings-using defaults", e); + statusHandler.error( + "Could not read user print settings-using defaults", e); } - if(settings != null) { + if (settings != null) { invertCheckbox.setSelection(settings.getInvertBlackWhite()); grayscaleRadioButton.setSelection(settings.isPrintGrayScale()); - colorRadioButton.setSelection(!grayscaleRadioButton.getSelection()); + colorRadioButton.setSelection(!grayscaleRadioButton + .getSelection()); + + landscapeRadioButton.setSelection(settings.getOrientation() + .isPrintLandscape()); + portraitRadioButton.setSelection(!landscapeRadioButton + .getSelection()); - landscapeRadioButton.setSelection(settings.getOrientation().isPrintLandscape()); - portraitRadioButton.setSelection(!landscapeRadioButton.getSelection()); - Integer n = settings.getCopies(); - if(n != null) { - if(n >= copiesSpinner.getMinimum() && n <= copiesSpinner.getMaximum()) { + if (n != null) { + if (n >= copiesSpinner.getMinimum() + && n <= copiesSpinner.getMaximum()) { copiesSpinner.setSelection(n); } } - + n = settings.getScale(); - if(n != null) { - if(n >= scaleSpinner.getMinimum() && n <= scaleSpinner.getMaximum()) { + if (n != null) { + if (n >= scaleSpinner.getMinimum() + && n <= scaleSpinner.getMaximum()) { scaleSpinner.setSelection(settings.getScale()); } } n = settings.getDensity(); - if(n != null) { - if((n >= 0) && (n < densityCombo.getItemCount())) { + if (n != null) { + if ((n >= 0) && (n < densityCombo.getItemCount())) { densityCombo.select(n); } } n = settings.getMag(); - if(n != null) { - if((n >= 0) && (n < magnificationCombo.getItemCount())) { + if (n != null) { + if ((n >= 0) && (n < magnificationCombo.getItemCount())) { magnificationCombo.select(n); } } - + String s = settings.getPrinterFile(); - if(s != null) { + if (s != null) { destinationFileText.setText(s); destinationFileText.setToolTipText(s); destinationFileText.setEnabled(true); browseButton.setEnabled(true); } - + s = settings.getPrinterUsed(); - if(s != null) { + if (s != null) { int idx = -1; - for(int i = 0;i < selectedPrinterCombo.getItemCount(); i++) { - if(s.equals(selectedPrinterCombo.getItem(i))) { + for (int i = 0; i < selectedPrinterCombo.getItemCount(); i++) { + if (s.equals(selectedPrinterCombo.getItem(i))) { idx = i; break; } } - if(idx > -1) { + if (idx > -1) { selectedPrinterCombo.select(idx); } } @@ -1006,9 +1018,7 @@ public class PrintDialog extends CaveSWTDialog { } } } - - - + /** * initialize the localization for user with the save/load functions * diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/AlterBundleDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/AlterBundleDlg.java index 58b2b64582..ed80b11e6f 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/AlterBundleDlg.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/AlterBundleDlg.java @@ -42,14 +42,17 @@ import org.eclipse.swt.widgets.Shell; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; +import com.raytheon.uf.viz.core.VizApp; +import com.raytheon.uf.viz.core.procedures.AlterBundleChangeEvent; import com.raytheon.uf.viz.core.procedures.AlterBundleFactory; import com.raytheon.uf.viz.core.procedures.Bundle; +import com.raytheon.uf.viz.core.procedures.IAlterBundleChangeListener; import com.raytheon.uf.viz.core.procedures.IAlterBundleContributor; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.widgets.MenuButton; /** - * Dialog for selecting an alternate bundle. + * Dialog for altering a bundle. * *
  * 
@@ -63,6 +66,8 @@ import com.raytheon.viz.ui.widgets.MenuButton;
  *                                      trying to perform a load.
  * Jul 31, 2012 #875       rferrel     Use MenuButton to organize entries
  *                                      in  menus.
+ * Oct 03, 2012 #1248      rferrel     Bundle change listeners added.
+ * Oct 16, 2012 #1229      rferrel     Made dialog non-blocking.
  * 
  * 
* @@ -70,16 +75,16 @@ import com.raytheon.viz.ui.widgets.MenuButton; * @version 1.0 */ public class AlterBundleDlg extends CaveSWTDialog { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(AlterBundleDlg.class); - private static final String Top_MENU_KEY = ""; + private final String Top_MENU_KEY = ""; - private static final String MENU_SEP = IAlterBundleContributor.MENU_SEPARATOR; + private final String MENU_SEP = IAlterBundleContributor.MENU_SEPARATOR; - private static final String MI_SEP = IAlterBundleContributor.MI_SEPARATOR; + private final String MI_SEP = IAlterBundleContributor.MI_SEPARATOR; - private static final int MENU_SEP_LEN = MENU_SEP.length(); + private final int MENU_SEP_LEN = MENU_SEP.length(); private static class AlterBundleEntry { @@ -101,11 +106,17 @@ public class AlterBundleDlg extends CaveSWTDialog { private Bundle bundle; + private Map contribListenerMap; + + private Map menuButtonMap; + protected AlterBundleDlg(Bundle bundle, Shell parentShell) { - super(parentShell); + super(parentShell, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK); setText("Alter Bundle on Loading"); this.bundle = bundle; + this.contribListenerMap = new HashMap(); + this.menuButtonMap = new HashMap(); } @Override @@ -136,6 +147,7 @@ public class AlterBundleDlg extends CaveSWTDialog { Map alterables = contrib.getAlterables(); final List contribEntries = new ArrayList( alterables.size()); + contrib.listenerSetup(); // Create Enable button final Button enabledBtn = new Button(comp, SWT.CHECK); GridData gd = new GridData(SWT.CENTER, SWT.CENTER, false, false); @@ -157,13 +169,24 @@ public class AlterBundleDlg extends CaveSWTDialog { } }); + IAlterBundleChangeListener bundleListner = new IAlterBundleChangeListener() { + + @Override + public void changeBundle(AlterBundleChangeEvent event) { + menuButtonChanged(event.getKeys()); + } + }; + contribListenerMap.put(contrib, bundleListner); + contrib.addAlterBundleChangeListener(bundleListner); + int i = 0; for (Entry entry : alterables.entrySet()) { if (i != 0) { new Label(comp, SWT.NONE); } Label label = new Label(comp, SWT.CENTER); - label.setText(entry.getKey() + " = "); + String key = entry.getKey(); + label.setText(key + " = "); final AlterBundleEntry abe = new AlterBundleEntry(); abe.contributor = contrib; @@ -191,9 +214,11 @@ public class AlterBundleDlg extends CaveSWTDialog { menuButton.setLayoutData(gd); menuButton.addSelectionListener(listener); Menu menu = new Menu(menuButton); - MenuItem topMi = createMenu(menu, entry); + MenuItem topMi = createMenu(menu, entry.getValue()); menuButton.setMenu(menu); menuButton.setSelectedItem(topMi); + menuButton.setData(contrib); + menuButtonMap.put(key, menuButton); ++i; } @@ -201,7 +226,7 @@ public class AlterBundleDlg extends CaveSWTDialog { } } - private MenuItem createMenu(Menu topMenu, Entry entry) { + private MenuItem createMenu(Menu topMenu, String[] values) { Map menuMap = new HashMap(); menuMap.put(Top_MENU_KEY, topMenu); @@ -210,7 +235,7 @@ public class AlterBundleDlg extends CaveSWTDialog { MenuItem mi = null; MenuItem topMi = null; - for (String value : entry.getValue()) { + for (String value : values) { if (value.startsWith(MENU_SEP)) { value = value.substring(MENU_SEP_LEN); } @@ -331,8 +356,36 @@ public class AlterBundleDlg extends CaveSWTDialog { shell.close(); } + private void menuButtonChanged(final String[] keys) { + VizApp.runAsync(new Runnable() { + + @Override + public void run() { + for (String key : keys) { + MenuButton menuButton = menuButtonMap.get(key); + IAlterBundleContributor contrib = (IAlterBundleContributor) menuButton + .getData(); + String[] values = contrib.getAlterables(key); + Menu menu = new Menu(menuButton); + MenuItem topMi = createMenu(menu, values); + menuButton.setMenu(menu); + menuButton.setSelectedItem(topMi); + } + } + }); + } + private void cancel() { bundle = null; shell.close(); } + + @Override + protected void disposed() { + for (IAlterBundleContributor contrib : contribListenerMap.keySet()) { + contrib.removeAlterBundeChangeListener(contribListenerMap + .get(contrib)); + contrib.listenerShutdown(); + } + } } diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/HistoryListDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/HistoryListDlg.java index 9270ef9196..eb1edf11b5 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/HistoryListDlg.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/HistoryListDlg.java @@ -50,10 +50,29 @@ import com.raytheon.viz.ui.UiUtil; import com.raytheon.viz.ui.actions.LoadSerializedXml; import com.raytheon.viz.ui.actions.SaveBundle; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.editor.AbstractEditor; +/** + * Dialog to get user options on history to display. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ *                                     Initial creation
+ * Oct 16, 2012 1229       rferrel     Changes for non-blocking AlterBundleDlg.
+ * Oct 16, 2012 1229       rferrel     Make dialog non-blocking.
+ * 
+ * 
+ * + * @author rferrel + * @version 1.0 + */ public class HistoryListDlg extends CaveSWTDialog { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(HistoryListDlg.class); private List dataList; @@ -72,8 +91,10 @@ public class HistoryListDlg extends CaveSWTDialog { private Button closeBtn; + private AlterBundleDlg alterDlg; + public HistoryListDlg(Shell parent) { - super(parent, SWT.DIALOG_TRIM | SWT.RESIZE); + super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK); setText("History List"); try { @@ -273,7 +294,7 @@ public class HistoryListDlg extends CaveSWTDialog { closeBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - shell.dispose(); + close(); } }); } @@ -284,14 +305,24 @@ public class HistoryListDlg extends CaveSWTDialog { } try { - Bundle b = HistoryList.getInstance().getBundle( - dataList.getSelectionIndex(), false); - AlterBundleDlg dlg = new AlterBundleDlg(b, getParent()); - b = (Bundle) dlg.open(); + if (mustCreate(alterDlg)) { + Bundle b = HistoryList.getInstance().getBundle( + dataList.getSelectionIndex(), false); + alterDlg = new AlterBundleDlg(b, getShell()); + alterDlg.setCloseCallback(new ICloseCallback() { - if (b != null) { - // Load was issued in alterBundleDlg - loadAlterBundle(b); + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof Bundle) { + // Load was issued in alterBundleDlg + Bundle b = (Bundle) returnValue; + loadAlterBundle(b); + } + } + }); + alterDlg.open(); + } else { + alterDlg.bringToTop(); } } catch (VizException e) { final String err = "Error altering bundle"; diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java index cd0eae8c30..dee0cec572 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java @@ -23,7 +23,7 @@ package com.raytheon.uf.viz.d2d.ui.dialogs.procedures; import java.io.File; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collection; +import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Map.Entry; @@ -82,6 +82,7 @@ import com.raytheon.viz.ui.HistoryList; import com.raytheon.viz.ui.UiUtil; import com.raytheon.viz.ui.actions.SaveBundle; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.editor.AbstractEditor; /** @@ -89,20 +90,24 @@ import com.raytheon.viz.ui.editor.AbstractEditor; * Dialog for loading or modifying procedures. * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
- *
+ *                                     Initial Creation
+ * Oct 16, 2012 1229       rferrel     Changes for non-blocking AlterBundleDlg.
+ * Oct 16, 2012 1229       rferrel     Changes to have displayDialog method.
+ * Oct 16, 2012 1229       rferrel     Changes for non-blocking ProcedureListDlg.
+ * 
  * 
- * + * * @author unknown * @version 1.0 */ public class ProcedureDlg extends CaveSWTDialog { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(ProcedureDlg.class); public static final String ORIGINAL = "Original Location"; @@ -111,7 +116,7 @@ public class ProcedureDlg extends CaveSWTDialog { public static final String PROCEDURES_DIR = "/procedures"; - private static Collection openDialogs = new ArrayList(); + private static final Map openDialogs = new HashMap(); private Font font; @@ -131,9 +136,9 @@ public class ProcedureDlg extends CaveSWTDialog { private Button firstNextBtn; - private static final String FIRST = "First"; + private final String FIRST = "First"; - private static final String NEXT = "Next"; + private final String NEXT = "Next"; private Button loadBtn; @@ -167,6 +172,10 @@ public class ProcedureDlg extends CaveSWTDialog { private final java.util.List bundles; + private AlterBundleDlg alterDlg; + + private ProcedureListDlg saveAsDlg; + private ProcedureDlg(String fileName, Procedure p, Shell parent) { // Win32 super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.INDEPENDENT_SHELL @@ -223,7 +232,7 @@ public class ProcedureDlg extends CaveSWTDialog { protected void disposed() { font.dispose(); synchronized (openDialogs) { - openDialogs.remove(this); + openDialogs.remove(fileName); } } @@ -877,19 +886,34 @@ public class ProcedureDlg extends CaveSWTDialog { return; } try { - BundlePair bp = new BundlePair(); - bp.name = bundles.get(dataList.getSelectionIndex()).name; - bp.xml = bundles.get(dataList.getSelectionIndex()).xml; - Bundle b = Bundle.unmarshalBundle(bp.xml, null); + if (mustCreate(alterDlg)) { + final BundlePair bp = new BundlePair(); + bp.name = bundles.get(dataList.getSelectionIndex()).name; + bp.xml = bundles.get(dataList.getSelectionIndex()).xml; + Bundle b = Bundle.unmarshalBundle(bp.xml, null); - AlterBundleDlg dlg = new AlterBundleDlg(b, getParent()); - b = (Bundle) dlg.open(); + alterDlg = new AlterBundleDlg(b, getShell()); + alterDlg.setCloseCallback(new ICloseCallback() { - if (b != null) { - // Load was issued in alterBundleDlg - bp.xml = b.toXML(); - saveProcedure(); - load(b); + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof Bundle) { + Bundle b = (Bundle) returnValue; + try { + // Load was issued in alterBundleDlg + bp.xml = b.toXML(); + saveProcedure(); + load(b); + } catch (VizException e) { + final String err = "Error altering bundle"; + statusHandler.handle(Priority.PROBLEM, err, e); + } + } + } + }); + alterDlg.open(); + } else { + alterDlg.bringToTop(); } } catch (VizException e) { final String err = "Error altering bundle"; @@ -898,18 +922,38 @@ public class ProcedureDlg extends CaveSWTDialog { } private void showSaveAsDlg() { - ProcedureListDlg dlg = new ProcedureListDlg("Save Procedure As...", - shell, ProcedureListDlg.Mode.SAVE); - dlg.open(); + if (mustCreate(saveAsDlg)) { + saveAsDlg = new ProcedureListDlg("Save Procedure As...", shell, + ProcedureListDlg.Mode.SAVE); - String fn = dlg.getSelectedFileName(); - if (fn == null) { - return; + saveAsDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + String fn = saveAsDlg.getSelectedFileName(); + if (fn != null) { + ProcedureDlg oldDlg = getDialog(fn); + + if (oldDlg != null) { + oldDlg.close(); + } + + // Update mapping to new file name. + synchronized (openDialogs) { + openDialogs.remove(fileName); + openDialogs.put(fn, ProcedureDlg.this); + } + + frozen = saveAsDlg.isFrozen(); + fileName = fn; + saveProcedure(); + } + } + }); + saveAsDlg.open(); + } else { + saveAsDlg.bringToTop(); } - - frozen = dlg.isFrozen(); - fileName = fn; - saveProcedure(); } /** @@ -1020,35 +1064,30 @@ public class ProcedureDlg extends CaveSWTDialog { * @return */ public static ProcedureDlg getDialog(String fileName) { - synchronized (openDialogs) { - if (fileName != null) { - for (ProcedureDlg dialog : openDialogs) { - if (fileName.equals(dialog.fileName)) { - return dialog; - } - } - } - return null; + synchronized (ProcedureDlg.openDialogs) { + ProcedureDlg dialog = openDialogs.get(fileName); + return dialog; } } /** - * Get the ProcedureDlg for the given fileName. If the fileName is null or if there is no open dialog, create a new ProcedureDlg. + * Get the ProcedureDlg for the given fileName and display it. * * @param fileName * @param p * @param parent - * @return */ - public static ProcedureDlg getOrCreateDialog(String fileName, Procedure p, - Shell parent) { + public static void displayDialog(String fileName, Procedure p, Shell parent) { synchronized (openDialogs) { ProcedureDlg dialog = getDialog(fileName); - if (dialog == null) { + if (dialog == null || dialog.getShell() == null + || dialog.isDisposed()) { dialog = new ProcedureDlg(fileName, p, parent); - openDialogs.add(dialog); + openDialogs.put(fileName, dialog); + dialog.open(); + } else { + dialog.bringToTop(); } - return dialog; } } } diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java index baea4279c1..51411554db 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java @@ -56,19 +56,21 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; /** * - * A dialog which displays a list of procedures for opening, saving, or deleting. + * A dialog which displays a list of procedures for opening, saving, or + * deleting. * *
- *
+ * 
  * SOFTWARE HISTORY
- *
+ * 
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * ???                                 Initial creation
  * 07/31/2012   DR 15036   D. Friedman Ensure current user's procedures
  *                                     are visible.
+ * 10/16/2012   1229       rferrel     Made dialog non-blocking.
  * 
- * + * * @author unknown * @version 1.0 */ @@ -80,8 +82,6 @@ public class ProcedureListDlg extends CaveSWTDialog { private Text procedureTF; - private LocalizationFile selectedFile; - private TreeViewer treeViewer; private Button okBtn; @@ -103,7 +103,7 @@ public class ProcedureListDlg extends CaveSWTDialog { private final Mode mode; public ProcedureListDlg(String title, Shell parent, Mode mode) { - super(parent, SWT.DIALOG_TRIM | SWT.RESIZE); // Win32 + super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK); // Win32 setText(title); this.mode = mode; @@ -343,7 +343,8 @@ public class ProcedureListDlg extends CaveSWTDialog { public void run() { TreeItem[] items = treeViewer.getTree().getItems(); if (items != null && items.length > 0) - treeViewer.getTree().showItem(items[items.length - 1]); + treeViewer.getTree().showItem( + items[items.length - 1]); treeViewer.reveal(find); } }); @@ -401,7 +402,7 @@ public class ProcedureListDlg extends CaveSWTDialog { cancelBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - shell.dispose(); + close(); } }); @@ -420,13 +421,6 @@ public class ProcedureListDlg extends CaveSWTDialog { } } - /** - * @return the fileName - */ - public LocalizationFile getSelectedFile() { - return selectedFile; - } - /** * @return the fileName */ @@ -492,21 +486,22 @@ public class ProcedureListDlg extends CaveSWTDialog { + " already exists. Overwrite anyways?"); if (result == true) { fileName = procedureTF.getText(); - shell.dispose(); + close(); } } } else { fileName = procedureTF.getText(); - shell.dispose(); + close(); } } else if (mode == Mode.OPEN) { fileName = procedureTF.getText(); if (tmp instanceof ProcedureTree) { // it must be a procedure tree, that is what the content // provider uses internally - selectedFile = ((ProcedureTree) tmp).getFile(); + LocalizationFile selectedFile = ((ProcedureTree) tmp).getFile(); + setReturnValue(selectedFile); } - shell.dispose(); + close(); } else if (mode == Mode.DELETE) { TreeItem[] selection = treeViewer.getTree().getSelection(); @@ -520,9 +515,11 @@ public class ProcedureListDlg extends CaveSWTDialog { if (tmp instanceof ProcedureTree) { // it must be a procedure tree, that is what the content // provider uses internally - selectedFile = ((ProcedureTree) tmp).getFile(); + LocalizationFile selectedFile = ((ProcedureTree) tmp) + .getFile(); + setReturnValue(selectedFile); } - shell.dispose(); + close(); } } } diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/map/CreateProjectionHandler.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/map/CreateProjectionHandler.java index 9f9237b106..cac6a815fe 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/map/CreateProjectionHandler.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/map/CreateProjectionHandler.java @@ -28,12 +28,32 @@ import org.eclipse.ui.PlatformUI; import com.raytheon.uf.viz.d2d.ui.dialogs.CreateProjectionDialog; import com.raytheon.viz.ui.tools.AbstractTool; +/** + * Handler class for controlling the Create Projection dialog. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ *                                     Initial creation
+ * Oct 16, 2012 1229       rferrel     Made dialog non-blocking.
+ * 
+ * 
+ * + * @author rferrel + * @version 1.0 + */ public class CreateProjectionHandler extends AbstractTool implements IHandler { + private CreateProjectionDialog dlg; /* * (non-Javadoc) * - * @see com.raytheon.viz.ui.tools.AbstractTool#execute(org.eclipse.core.commands.ExecutionEvent) + * @see + * com.raytheon.viz.ui.tools.AbstractTool#execute(org.eclipse.core.commands + * .ExecutionEvent) */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { @@ -42,9 +62,13 @@ public class CreateProjectionHandler extends AbstractTool implements IHandler { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getShell(); - CreateProjectionDialog dlg = new CreateProjectionDialog(shell); - - dlg.open(); + if (dlg == null || dlg.getShell() == null || dlg.isDisposed()) { + dlg = new CreateProjectionDialog(shell); + dlg.setBlockOnOpen(false); + dlg.open(); + } else { + dlg.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/map/actions/SetBackgroundColorAction.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/map/actions/SetBackgroundColorAction.java index 13c53b91b9..ae0bc37405 100644 --- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/map/actions/SetBackgroundColorAction.java +++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/map/actions/SetBackgroundColorAction.java @@ -27,6 +27,7 @@ import org.eclipse.swt.widgets.Display; import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.viz.ui.cmenu.AbstractRightClickAction; import com.raytheon.viz.ui.color.IBackgroundColorChangedListener.BGColorMode; +import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.dialogs.colordialog.BackgroundColorDialog; /** @@ -38,6 +39,7 @@ import com.raytheon.viz.ui.dialogs.colordialog.BackgroundColorDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Sep 1, 2009 mschenke Initial creation + * Oct 16, 2012 1229 rferrel Changes for non-blocking BackgroundColorDialog. * * * @@ -67,12 +69,18 @@ public class SetBackgroundColorAction extends AbstractRightClickAction { @Override public void run() { BackgroundColorDialog dialog = dialogMap.get(container); - if (dialog == null) { + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { dialog = new BackgroundColorDialog(Display.getCurrent() .getActiveShell(), container, mode); dialogMap.put(container, dialog); + dialog.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + dialogMap.remove(container); + } + }); dialog.open(); - dialogMap.remove(container); } else { dialog.bringToTop(); } diff --git a/cave/com.raytheon.uf.viz.derivparam.ui/src/com/raytheon/uf/viz/derivparam/ui/actions/NewDerivedParameterAction.java b/cave/com.raytheon.uf.viz.derivparam.ui/src/com/raytheon/uf/viz/derivparam/ui/actions/NewDerivedParameterAction.java index ccaf452309..22a1b35503 100644 --- a/cave/com.raytheon.uf.viz.derivparam.ui/src/com/raytheon/uf/viz/derivparam/ui/actions/NewDerivedParameterAction.java +++ b/cave/com.raytheon.uf.viz.derivparam.ui/src/com/raytheon/uf/viz/derivparam/ui/actions/NewDerivedParameterAction.java @@ -36,6 +36,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTWizardDlg; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Dec 14, 2010 mschenke Initial creation + * Oct 22, 2012 1229 rferrel Changes for non-blocking CaveSWTWizardDlg. * * * @@ -44,6 +45,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTWizardDlg; */ public class NewDerivedParameterAction extends Action { + private CaveSWTWizardDlg dialog; /** * @@ -55,9 +57,13 @@ public class NewDerivedParameterAction extends Action { @Override public void run() { DerivedParamWizard wizard = new DerivedParamWizard(); - CaveSWTWizardDlg dialog = new CaveSWTWizardDlg(VizWorkbenchManager - .getInstance().getCurrentWindow().getShell(), wizard); - dialog.open(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + dialog = new CaveSWTWizardDlg(VizWorkbenchManager.getInstance() + .getCurrentWindow().getShell(), wizard); + dialog.open(); + } else { + dialog.bringToTop(); + } } } diff --git a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlColormappedImageExtension.java b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlColormappedImageExtension.java index 6196f229de..050999dfdc 100644 --- a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlColormappedImageExtension.java +++ b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlColormappedImageExtension.java @@ -99,11 +99,8 @@ public class KmlColormappedImageExtension extends private static class Generator extends KmlGroundOverlayGenerator { - private final DrawableImage[] images; - public Generator(float alpha, DrawableImage[] images) { - super(alpha); - this.images = images; + super(alpha, images); } @Override diff --git a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlGroundOverlayGenerator.java b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlGroundOverlayGenerator.java index 9b2ea32f6c..812f576d08 100644 --- a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlGroundOverlayGenerator.java +++ b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlGroundOverlayGenerator.java @@ -40,6 +40,8 @@ import com.raytheon.uf.common.geospatial.interpolation.Interpolation; import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation; import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; +import com.raytheon.uf.viz.core.DrawableImage; +import com.raytheon.uf.viz.core.PixelCoverage; import com.raytheon.uf.viz.core.data.IColorMapDataRetrievalCallback.ColorMapData; import com.raytheon.uf.viz.core.data.prep.Colormapper; import com.raytheon.uf.viz.core.drawables.ColorMapParameters; @@ -74,7 +76,21 @@ public abstract class KmlGroundOverlayGenerator extends KmlFeatureGenerator { protected final double alpha; - public KmlGroundOverlayGenerator(double alpha) { + protected final DrawableImage[] images; + + public KmlGroundOverlayGenerator(double alpha, DrawableImage[] images) { + this.images = new DrawableImage[images.length]; + for (int i = 0; i < images.length; i += 1) { + // Clone the DrawableImage so that if whatever is drawing modifies + // or disposes of it then when the generator runs it will still draw + // what was rendered. + PixelCoverage oldCov = images[i].getCoverage(); + PixelCoverage newCov = new PixelCoverage(oldCov.getUl(), + oldCov.getUr(), oldCov.getLr(), oldCov.getLl()); + newCov.setMesh(oldCov.getMesh()); + this.images[i] = new DrawableImage(images[i].getImage(), newCov, + images[i].getMode()); + } this.alpha = alpha; } diff --git a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlMosaicImageExtension.java b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlMosaicImageExtension.java index 7967ad8f6d..4db641d995 100644 --- a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlMosaicImageExtension.java +++ b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlMosaicImageExtension.java @@ -19,7 +19,6 @@ **/ package com.raytheon.uf.viz.kml.export.graphics.ext; -import java.nio.ByteBuffer; import java.util.Arrays; import java.util.Comparator; @@ -34,7 +33,6 @@ import org.opengis.referencing.operation.TransformException; import com.raytheon.uf.common.geospatial.interpolation.Interpolation; import com.raytheon.uf.common.geospatial.interpolation.NearestNeighborInterpolation; import com.raytheon.uf.common.geospatial.interpolation.data.AbstractDataWrapper; -import com.raytheon.uf.common.geospatial.interpolation.data.ByteBufferWrapper; import com.raytheon.uf.common.geospatial.interpolation.data.DataDestination; import com.raytheon.uf.common.geospatial.interpolation.data.DataSource; import com.raytheon.uf.common.geospatial.interpolation.data.FloatArrayWrapper; @@ -121,11 +119,8 @@ public class KmlMosaicImageExtension extends private final ColorMapParameters parameters; - private final DrawableImage[] images; - public Generator(float alpha, KmlMosaicImage image) { - super(alpha); - this.images = image.getImagesToMosaic(); + super(alpha, image.getImagesToMosaic()); this.parameters = image.getColorMapParameters(); this.mosaicComparator = image.getMosaicComparator(); } diff --git a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlRasterImageExtension.java b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlRasterImageExtension.java index 1c6aaca87b..ff5c6c556a 100644 --- a/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlRasterImageExtension.java +++ b/cave/com.raytheon.uf.viz.kml.export/src/com/raytheon/uf/viz/kml/export/graphics/ext/KmlRasterImageExtension.java @@ -77,11 +77,8 @@ public class KmlRasterImageExtension extends private static class Generator extends KmlGroundOverlayGenerator { - private final DrawableImage[] images; - public Generator(float alpha, DrawableImage[] images) { - super(alpha); - this.images = images; + super(alpha, images); } @Override diff --git a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/trendplot/TrendPlotDlg.java b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/trendplot/TrendPlotDlg.java index dadf37911d..32d48c00a1 100644 --- a/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/trendplot/TrendPlotDlg.java +++ b/cave/com.raytheon.uf.viz.monitor/src/com/raytheon/uf/viz/monitor/trendplot/TrendPlotDlg.java @@ -47,6 +47,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * ------------ ---------- ----------- -------------------------- * 2009-12-02 vkorolev Initial creation. * 2010-01-21 4268 vkorolev Fixed Trend Plot + * 2012-10-15 1229 vkorolev Changes for non-blocking TrendPlotDlg * * * @author vkorolev @@ -65,9 +66,12 @@ public class TrendPlotDlg extends CaveSWTDialog { public Date curdate; + public String var; + public TrendPlotDlg(Shell parent, String selectedZone, String station, ArrayList product, String dataName) { - super(parent, SWT.DIALOG_TRIM | SWT.RESIZE); + super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK + | CAVE.INDEPENDENT_SHELL); setText(getTrendPlotName(product) + " Trend Plot for " + station + "#" + dataName); @@ -89,13 +93,13 @@ public class TrendPlotDlg extends CaveSWTDialog { @Override protected void initializeComponents(Shell shell) { - setReturnValue(false); + setReturnValue(product); // Initialize all layouts Iterator prodVar = product.iterator(); while (prodVar.hasNext()) { - String varname = prodVar.next(); - new TrendPlotCanvas(shell, selectedZone, station, varname, - dataName, obData); + String var = prodVar.next(); + new TrendPlotCanvas(shell, selectedZone, station, var, dataName, + obData); } addCloseBtn(); } diff --git a/cave/com.raytheon.uf.viz.points/src/com/raytheon/uf/viz/points/ui/layer/PointsToolLayer.java b/cave/com.raytheon.uf.viz.points/src/com/raytheon/uf/viz/points/ui/layer/PointsToolLayer.java index b69324b505..6f43eb0a22 100644 --- a/cave/com.raytheon.uf.viz.points/src/com/raytheon/uf/viz/points/ui/layer/PointsToolLayer.java +++ b/cave/com.raytheon.uf.viz.points/src/com/raytheon/uf/viz/points/ui/layer/PointsToolLayer.java @@ -168,6 +168,7 @@ public class PointsToolLayer extends AbstractMovableToolLayer implements for (IFont font : fonts.values()) { font.dispose(); } + fonts.clear(); this.resourceData.removeChangeListener(this); } diff --git a/cave/com.raytheon.uf.viz.radarapps.core/src/com/raytheon/uf/viz/radarapps/products/ui/BaseRadarProductUI.java b/cave/com.raytheon.uf.viz.radarapps.core/src/com/raytheon/uf/viz/radarapps/products/ui/BaseRadarProductUI.java index f1d0dea438..78dc2deaef 100644 --- a/cave/com.raytheon.uf.viz.radarapps.core/src/com/raytheon/uf/viz/radarapps/products/ui/BaseRadarProductUI.java +++ b/cave/com.raytheon.uf.viz.radarapps.core/src/com/raytheon/uf/viz/radarapps/products/ui/BaseRadarProductUI.java @@ -70,6 +70,8 @@ import com.raytheon.rcm.products.RadarProduct; import com.raytheon.rcm.products.RadarProduct.Param; import com.raytheon.rcm.products.Usage; import com.raytheon.rcm.request.Request; +import com.raytheon.uf.viz.core.VizApp; +import com.raytheon.uf.viz.points.IPointChangedListener; import com.raytheon.uf.viz.points.PointsDataManager; import com.raytheon.uf.viz.points.data.IPointNode; import com.raytheon.uf.viz.radarapps.core.RadarApps; @@ -95,6 +97,7 @@ import com.raytheon.viz.ui.widgets.MinimumSizeComposite; * converted to abstract class making the * needed methods abstract. * Jul 31, 2012 #875 rferrel Points now group in menu items. + * Oct 04, 2012 #1248 rferrel Added Point change listener. * * * @@ -1176,7 +1179,7 @@ public abstract class BaseRadarProductUI { }); geomCombo = c; } else { - MenuButton mb = new MenuButton(r2); + final MenuButton mb = new MenuButton(r2); mb.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { MenuItem item = (MenuItem) e.data; @@ -1186,9 +1189,43 @@ public abstract class BaseRadarProductUI { mb.setMinimumSize(SWT.DEFAULT, SWT.DEFAULT); Menu menu = new Menu(mb); - createMenuItems(menu, null); + MenuItem firstItem = createMenuItems(menu, null); mb.setMenu(menu); + mb.setSelectedItem(firstItem); + + final IPointChangedListener pointChangeListener = new IPointChangedListener() { + + @Override + public void pointChanged() { + VizApp.runAsync(new Runnable() { + + @Override + public void run() { + String name = mb.getSelectedItem().getText(); + Menu menu = new Menu(mb); + MenuItem firstItem = createMenuItems(menu, null); + mb.setMenu(menu); + mb.setSelectedItem(name); + if (mb.getSelectedItem() == null) { + mb.setSelectedItem(firstItem); + onGeomSelected(firstItem.getText()); + } + } + }); + } + }; + + PointsDataManager.getInstance().addPointsChangedListener( + pointChangeListener); geomCombo = mb; + mb.addDisposeListener(new DisposeListener() { + + @Override + public void widgetDisposed(DisposeEvent e) { + PointsDataManager.getInstance() + .removePointsChangedListener(pointChangeListener); + } + }); } azRanLabel = new Label(r2, SWT.LEFT); @@ -1220,10 +1257,11 @@ public abstract class BaseRadarProductUI { setupRow(r, r2, b); } - private void createMenuItems(Menu menu, IPointNode root) { + private MenuItem createMenuItems(Menu menu, IPointNode root) { MenuItem item = null; - for (IPointNode node : PointsDataManager.getInstance().getChildren( - root)) { + MenuItem firstItem = null; + for (IPointNode node : PointsDataManager.getInstance() + .getChildren(root)) { if (node.isGroup()) { if (PointsDataManager.getInstance().getChildren(node).size() == 0) { continue; @@ -1231,13 +1269,20 @@ public abstract class BaseRadarProductUI { Menu childMenu = new Menu(menu); item = new MenuItem(menu, SWT.CASCADE); item.setMenu(childMenu); - createMenuItems(childMenu, node); + MenuItem it = createMenuItems(childMenu, node); + if (firstItem == null) { + firstItem = it; + } } else { item = new MenuItem(menu, SWT.PUSH); + if (firstItem == null) { + firstItem = item; + } } item.setText(node.getName()); item.setData(node); } + return firstItem; } protected void onLoadBaselines() { @@ -2003,7 +2048,14 @@ public abstract class BaseRadarProductUI { } } else { MenuButton mb = (MenuButton) geomCombo; + + // Check to see if desired point still exists. + MenuItem item = mb.getSelectedItem(); mb.setSelectedItem(desiredGeom); + if (mb.getSelectedItem() == null) { + mb.setSelectedItem(item); + onGeomSelected(item.getText()); + } } } diff --git a/cave/com.raytheon.uf.viz.thinclient/src/com/raytheon/uf/viz/thinclient/localization/ThinClientLocalizationInitializer.java b/cave/com.raytheon.uf.viz.thinclient/src/com/raytheon/uf/viz/thinclient/localization/ThinClientLocalizationInitializer.java index fd712a0b85..8bd7f11d83 100644 --- a/cave/com.raytheon.uf.viz.thinclient/src/com/raytheon/uf/viz/thinclient/localization/ThinClientLocalizationInitializer.java +++ b/cave/com.raytheon.uf.viz.thinclient/src/com/raytheon/uf/viz/thinclient/localization/ThinClientLocalizationInitializer.java @@ -63,7 +63,7 @@ public class ThinClientLocalizationInitializer extends LocalizationInitializer { @Override protected void setupServers() throws VizException { - HttpClient.getInstance().enableGzipResponseHandling(); + HttpClient.getInstance().setGzipResponseHandling(true); if (promptUI) { ThinClientConnectivityDialog dlg = new ThinClientConnectivityDialog( checkAlertviz); @@ -100,10 +100,10 @@ public class ThinClientLocalizationInitializer extends LocalizationInitializer { .getString(ThinClientPreferenceConstants.P_SERVICES_PROXY)); VizApp.setPypiesServer(store .getString(ThinClientPreferenceConstants.P_PYPIES_PROXY)); - if (store - .getBoolean(ThinClientPreferenceConstants.P_ENABLE_REQUEST_COMPRESSION)) { - HttpClient.getInstance().enableRequestCompression(); - } + boolean compressRequests = store + .getBoolean(ThinClientPreferenceConstants.P_ENABLE_REQUEST_COMPRESSION); + HttpClient.getInstance().setCompressRequests(compressRequests); + } else { GetServersRequest req = new GetServersRequest(); GetServersResponse resp = (GetServersResponse) ThriftClient diff --git a/cave/com.raytheon.viz.alerts/src/com/raytheon/viz/alerts/jobs/AutoUpdater.java b/cave/com.raytheon.viz.alerts/src/com/raytheon/viz/alerts/jobs/AutoUpdater.java index 4179aa7cf4..570b02f411 100644 --- a/cave/com.raytheon.viz.alerts/src/com/raytheon/viz/alerts/jobs/AutoUpdater.java +++ b/cave/com.raytheon.viz.alerts/src/com/raytheon/viz/alerts/jobs/AutoUpdater.java @@ -19,28 +19,21 @@ **/ package com.raytheon.viz.alerts.jobs; -import java.lang.reflect.Array; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.HashSet; import java.util.IdentityHashMap; import java.util.List; import java.util.Map; import java.util.Set; -import com.raytheon.uf.common.dataplugin.PluginDataObject; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPaneContainer; -import com.raytheon.uf.viz.core.RecordFactory; -import com.raytheon.uf.viz.core.alerts.AbstractAlertMessageParser; import com.raytheon.uf.viz.core.alerts.AlertMessage; -import com.raytheon.uf.viz.core.comm.Loader; import com.raytheon.uf.viz.core.drawables.IDescriptor; -import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractResourceData; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; @@ -76,39 +69,13 @@ public class AutoUpdater implements IAlertObserver { private static final int MAX_ERRORS = 10; - private static class AlertMessageToPDOParser extends - AbstractAlertMessageParser { - - @Override - public Object parseAlertMessage(AlertMessage message, - AbstractRequestableResourceData reqResourceData) - throws VizException { - Object objectToSend = null; - Map attribs = new HashMap( - message.decodedAlert); - String dataURI = message.dataURI; - if (reqResourceData.isUpdatingOnMetadataOnly()) { - PluginDataObject record = RecordFactory.getInstance() - .loadRecordFromUri(dataURI); - objectToSend = record; - - } else { - attribs.put("dataURI", message.dataURI); - objectToSend = Loader.loadData(attribs); - } - return objectToSend; - } - }; - - private static AlertMessageToPDOParser defaultParser = new AlertMessageToPDOParser(); - public AutoUpdater() { } @Override public void alertArrived(Collection alertMessages) { Set displayList = new HashSet(); - Map> pdoSendMap = new IdentityHashMap>(); + Map> pdoSendMap = new IdentityHashMap>(); int errors = 0; for (AlertMessage message : alertMessages) { @@ -130,34 +97,25 @@ public class AutoUpdater implements IAlertObserver { continue; AbstractRequestableResourceData reqResourceData = (AbstractRequestableResourceData) resourceData; - AbstractAlertMessageParser parserToUse = null; - if ((parserToUse = reqResourceData.getAlertParser()) == null) { - parserToUse = defaultParser; + + if (md.getTimeMatcher() != null) { + md.getTimeMatcher().redoTimeMatching(r1); } - Object objectToSend = parserToUse.parseAlertMessage( - message, reqResourceData); + displayList.add(md); - if (objectToSend != null) { - if (md.getTimeMatcher() != null) { - md.getTimeMatcher().redoTimeMatching(r1); - } - displayList.add(md); + List list = pdoSendMap + .get(reqResourceData); + if (list == null) { + list = new ArrayList(); + pdoSendMap.put(reqResourceData, list); + } + list.add(message); - List list = pdoSendMap.get(reqResourceData); - if (list == null) { - list = new ArrayList(); - pdoSendMap.put(reqResourceData, list); - } - list.add(objectToSend); - - if (list.size() > 100) { - // update with objects - Class componentType = list.get(0).getClass(); - reqResourceData.update(list - .toArray((Object[]) Array.newInstance( - componentType, list.size()))); - list.clear(); - } + if (list.size() > 100) { + // update with objects + reqResourceData.update(list + .toArray(new AlertMessage[list.size()])); + list.clear(); } } @@ -174,13 +132,11 @@ public class AutoUpdater implements IAlertObserver { } for (AbstractRequestableResourceData arrd : pdoSendMap.keySet()) { - List pdos = pdoSendMap.get(arrd); + List pdos = pdoSendMap.get(arrd); if (pdos == null || pdos.size() < 1) { continue; } - Class componentType = pdos.get(0).getClass(); - arrd.update(pdos.toArray((Object[]) Array.newInstance( - componentType, pdos.size()))); + arrd.update(pdos.toArray(new AlertMessage[pdos.size()])); } List refreshedDescriptors = new ArrayList(); diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationAction.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationAction.java index bc9e21a80f..9c182c9027 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationAction.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationAction.java @@ -33,6 +33,7 @@ import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.viz.avnconfig.TafSiteConfigFactory; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * Action for Aviation Plug-in @@ -79,11 +80,16 @@ public class AviationAction extends AbstractHandler { .getShell(); if (aviationDlg == null || aviationDlg.getShell().isDisposed()) { aviationDlg = new AviationDialog(shell); + aviationDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + aviationDlg = null; + } + }); aviationDlg.open(); - aviationDlg = null; } else { - aviationDlg.setVisible(true); - aviationDlg.setFocus(); + aviationDlg.bringToTop(); } return null; diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationComponent.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationComponent.java index 33441934e4..6f97118a40 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationComponent.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationComponent.java @@ -22,7 +22,7 @@ package com.raytheon.viz.aviation; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; +import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent; /** * This class starts AviationDialog as a stand alone component with runtime mode @@ -35,6 +35,9 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 28, 2011 mschenke Initial creation + * Oct 08, 2012 1229 rferrel Make a blocking dialog. + * Oct 17, 2012 1229 rferrel Changes for non-blocking + * AviationDialog. * * * @@ -42,7 +45,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; * @version 1.0 */ -public class AviationComponent extends AbstractCAVEComponent { +public class AviationComponent extends AbstractCAVEDialogComponent { /* * (non-Javadoc) @@ -56,6 +59,7 @@ public class AviationComponent extends AbstractCAVEComponent { AviationDialog aviationDlg = new AviationDialog(new Shell( Display.getCurrent())); aviationDlg.open(); + blockUntilClosed(aviationDlg); } /* diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationDialog.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationDialog.java index ca679d0090..82797d8303 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationDialog.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AviationDialog.java @@ -63,6 +63,7 @@ import com.raytheon.viz.avnconfig.AvnConfigFileUtil; import com.raytheon.viz.avnconfig.ITafSiteConfig; import com.raytheon.viz.avnconfig.TafSiteConfigFactory; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * The Aviation Dialog class that displays the start up menu for AvnFPS. @@ -92,6 +93,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * for both stand alone and from Cave. * 8/31/2011 10837 rferrel Added checks to see if the avnImage * file exists. + * 10/02/2012 1229 rferrel Made dialog non-blocking. + * 10/09/2012 1229 rferrel Changes for non-blocking TafMonitorDlg. * * * @@ -161,7 +164,7 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart { public static boolean USERTRANSMIT = true; /** - * List control containing forcaster names. + * List control containing forecaster names. */ private List forecasterList; @@ -171,14 +174,13 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart { private final AtomicInteger dlgCount = new AtomicInteger(0); /** - * Constructor. + * Create a non-blocking dialog. * * @param parent - * Parent Shell. */ public AviationDialog(Shell parent) { super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT - | CAVE.INDEPENDENT_SHELL); + | CAVE.INDEPENDENT_SHELL | CAVE.DO_NOT_BLOCK); setText("AvnFPS Menu"); ForecastModel.getInstance().setBackupRestartUtility(this); @@ -339,7 +341,7 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart { loadTafSiteConfig(); displayTafMonitorDialog(); } else { - tafMonitorDlg.showDialog(); + tafMonitorDlg.bringToTop(); } } }); @@ -355,8 +357,8 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart { @Override public void widgetSelected(SelectionEvent event) { shell.setVisible(false); - if (climateMenuDlg == null - || climateMenuDlg.getShell().isDisposed()) { + if (climateMenuDlg == null || climateMenuDlg.getShell() == null + || climateMenuDlg.isDisposed()) { // Create an array of message types StatusMessageType[] msgTypes = new StatusMessageType[4]; msgTypes[0] = StatusMessageType.Metar; @@ -367,13 +369,19 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart { // Create the climate menu dialog. dlgCount.incrementAndGet(); climateMenuDlg = new ClimateMenuDlg(shell, msgTypes, null); + climateMenuDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + climateMenuDlg = null; + if (dlgCount.decrementAndGet() == 0) { + shell.dispose(); + } + } + }); climateMenuDlg.open(); - climateMenuDlg = null; - if (dlgCount.decrementAndGet() == 0) { - shell.dispose(); - } } else { - climateMenuDlg.showDialog(); + climateMenuDlg.bringToTop(); } } }); @@ -562,7 +570,12 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart { */ @Override public void restartTafMonitor() { + // This prevents tafMonitorDlg from closing this shell when closing the + // TaMonitorDlg prior to the restart. + dlgCount.incrementAndGet(); if (tafMonitorDlg.closeDisplay() == false) { + // adjust the count. + dlgCount.decrementAndGet(); return; } @@ -595,7 +608,12 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart { } if (!emptyStationList) { + // This prevents tafMonitorDlg from closing this shell when closing + // the TaMonitorDlg prior to the restart. + dlgCount.incrementAndGet(); if (tafMonitorDlg.closeDisplay() == false) { + // adjust the count. + dlgCount.decrementAndGet(); return; } @@ -629,25 +647,28 @@ public class AviationDialog extends CaveSWTDialog implements IBackupRestart { } for (String product : productDisplayList) { statusHandler.handle(Priority.PROBLEM, - "Error no stations configured for " + product); + "Error no stations configured for " + product); } } else { - tafMonitorDlg = new TafMonitorDlg(shell, stationList, - productDisplayList); - tafMonitorDlg.open(); - tafMonitorDlg = null; + if (tafMonitorDlg == null || tafMonitorDlg.getShell() == null + || tafMonitorDlg.isDisposed()) { + tafMonitorDlg = new TafMonitorDlg(shell, stationList, + productDisplayList); + tafMonitorDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + tafMonitorDlg = null; + if (dlgCount.decrementAndGet() == 0 + && !productDisplayList.isEmpty()) { + shell.dispose(); + } + } + }); + tafMonitorDlg.open(); + } else { + tafMonitorDlg.bringToTop(); + } } - - if (dlgCount.decrementAndGet() == 0 && !productDisplayList.isEmpty()) { - shell.dispose(); - } - } - - public void setFocus() { - shell.setFocus(); - } - - public void setVisible(boolean visible) { - shell.setVisible(visible); } } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigAction.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigAction.java index 246e6f1e8b..3b24a9b59a 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigAction.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigAction.java @@ -44,6 +44,7 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory; * Jul 9, 2010 5078 rferrel Check for existence of * config files in execute. * Oct 19, 2010 7347 rferrel Replace reference to TAF_SITE_CONFIG + * Oct 08, 2012 1229 rferrel Changes to work with non-blocking AvnConfigDlg. * * * @@ -73,12 +74,12 @@ public class AvnconfigAction extends AbstractHandler { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() .getShell(); - if (avnfspSetupDlg == null || avnfspSetupDlg.isDisposed()) { + if (avnfspSetupDlg == null || avnfspSetupDlg.getShell() == null + || avnfspSetupDlg.isDisposed()) { avnfspSetupDlg = new AvnconfigDlg(shell); avnfspSetupDlg.open(); - avnfspSetupDlg = null; } else { - avnfspSetupDlg.setFocus(); + avnfspSetupDlg.bringToTop(); } return null; diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigComponent.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigComponent.java index 7705310969..6b25f189d8 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigComponent.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigComponent.java @@ -22,7 +22,7 @@ package com.raytheon.viz.aviation; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; +import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent; /** * This class is a run configuration component to launch the AvnFPS monitor. @@ -34,14 +34,15 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 28, 2011 mschenke Initial creation - * + * Oct 17, 2012 1229 rferrel Changes for non-blocking + * AvnconfigDlg. * * * @author mschenke * @version 1.0 */ -public class AvnconfigComponent extends AbstractCAVEComponent { +public class AvnconfigComponent extends AbstractCAVEDialogComponent { /* * (non-Javadoc) @@ -55,6 +56,7 @@ public class AvnconfigComponent extends AbstractCAVEComponent { AvnconfigDlg avnfspSetupDlg = new AvnconfigDlg(new Shell( Display.getCurrent())); avnfspSetupDlg.open(); + blockUntilClosed(avnfspSetupDlg); } /* diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigDlg.java index fb317c28f6..0cd7b1f8c6 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/AvnconfigDlg.java @@ -26,8 +26,6 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Dialog; -import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Menu; import org.eclipse.swt.widgets.MenuItem; @@ -42,6 +40,7 @@ import com.raytheon.viz.avnconfig.MonitoringCriteriaDlg; import com.raytheon.viz.avnconfig.TafProductConfigDlg; import com.raytheon.viz.avnconfig.TafSiteInfoEditorDlg; import com.raytheon.viz.avnconfig.TextEditorSetupDlg; +import com.raytheon.viz.ui.dialogs.CaveSWTDialog; /** * This class is the main AvnFPS configuration dialog. It contains the controls @@ -54,6 +53,14 @@ import com.raytheon.viz.avnconfig.TextEditorSetupDlg; * ------------ ---------- ----------- -------------------------- * 22 MAY 2008 1119 lvenable Initial creation * 01 OCT 2010 4345 rferrel Bring existing dialog to the front. + * 04 OCT 2012 1229 rferrel Work with non-blocking ClimateDataMenuDlg. + * 08 Oct 2012 1229 rferrel Make sub-class of CaveSWTDialog and + * make non-blocking. + * 11 Oct 2012 1229 rferrel Changes for non-blocking MonitoringCriteriaDlg. + * 12 Oct 2012 1229 rferrel Changes for non-blocking TafProductConfigDlg. + * 12 Oct 2012 1229 rferrel Changes for non-blocking TafSiteInfoEditorDlg. + * 15 Oct 2012 1229 rferrel Changes for non-blocking TextEditorSetupDlg. + * 15 Oct 2012 1229 rferrel Changed for non-blocking HelpUsageDlg. * * * @@ -61,17 +68,7 @@ import com.raytheon.viz.avnconfig.TextEditorSetupDlg; * @version 1.0 * */ -public class AvnconfigDlg extends Dialog { - - /** - * Dialog shell. - */ - private Shell shell; - - /** - * The display control. - */ - private Display display; +public class AvnconfigDlg extends CaveSWTDialog { /** * Composite containing message status controls. @@ -104,6 +101,8 @@ public class AvnconfigDlg extends Dialog { */ private ClimateDataMenuDlg climateDataDlg; + private HelpUsageDlg usageDlg; + /** * Constructor. * @@ -111,20 +110,13 @@ public class AvnconfigDlg extends Dialog { * Parent shell. */ public AvnconfigDlg(Shell parent) { - super(parent, 0); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.INDEPENDENT_SHELL | CAVE.DO_NOT_BLOCK); + setText("AvnFPS Setup"); } - /** - * Open method used set up components and display the dialog. - * - * @return Null. - */ - public Object open() { - Shell parent = getParent(); - display = parent.getDisplay(); - shell = new Shell(parent, SWT.DIALOG_TRIM); - shell.setText("AvnFPS Setup"); - + @Override + protected void initializeComponents(Shell shell) { // Create the main layout for the shell. GridLayout mainLayout = new GridLayout(1, false); mainLayout.marginHeight = 3; @@ -132,25 +124,6 @@ public class AvnconfigDlg extends Dialog { mainLayout.verticalSpacing = 5; shell.setLayout(mainLayout); - // Initialize all of the controls and layouts - initializeComponents(); - - shell.pack(); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) { - display.sleep(); - } - } - - return null; - } - - /** - * Initialize the components on the display. - */ - private void initializeComponents() { // --------------------------------------------- // Create the menus at the top of the dialog. // --------------------------------------------- @@ -244,11 +217,16 @@ public class AvnconfigDlg extends Dialog { usageMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String description = "AvnFPS Setup Help"; - String helpText = "This application is used to configure AvnFPS.\n\nButton description:\n\nText Editor: use to modify forecaster list and default resource\nfile.\n\nMonitoring rules: use to edit watch rules for TAF monitoring.\n\nTAF Site Info: use to create TAF definition files\n\nTAF Products: use to create lists of TAFs to load into forecast\neditor\n\nTriggers: use to create and install Postgres trigger file.\n\nClimate Data: use to create and update HDF5 climate files."; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - helpText); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "AvnFPS Setup Help"; + + String helpText = "This application is used to configure AvnFPS.\n\nButton description:\n\nText Editor: use to modify forecaster list and default resource\nfile.\n\nMonitoring rules: use to edit watch rules for TAF monitoring.\n\nTAF Site Info: use to create TAF definition files\n\nTAF Products: use to create lists of TAFs to load into forecast\neditor\n\nTriggers: use to create and install Postgres trigger file.\n\nClimate Data: use to create and update HDF5 climate files."; + usageDlg = new HelpUsageDlg(shell, description, + helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } @@ -293,13 +271,11 @@ public class AvnconfigDlg extends Dialog { textEditorBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (editorDlg == null || editorDlg.getParent().isDisposed()) { + if (mustCreate(editorDlg)) { editorDlg = new TextEditorSetupDlg(shell); editorDlg.open(); - editorDlg = null; } else { - editorDlg.getParent().forceActive(); - editorDlg.getParent().forceFocus(); + editorDlg.bringToTop(); } } }); @@ -311,14 +287,11 @@ public class AvnconfigDlg extends Dialog { monitorRulesBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (monCriteriaDlg == null - || monCriteriaDlg.getParent().isDisposed()) { + if (mustCreate(monCriteriaDlg)) { monCriteriaDlg = new MonitoringCriteriaDlg(shell); monCriteriaDlg.open(); - monCriteriaDlg = null; } else { - monCriteriaDlg.getParent().forceActive(); - monCriteriaDlg.getParent().forceFocus(); + monCriteriaDlg.bringToTop(); } } }); @@ -330,13 +303,11 @@ public class AvnconfigDlg extends Dialog { tafSiteInfoBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (siteInfoDlg == null || siteInfoDlg.getParent().isDisposed()) { + if (mustCreate(siteInfoDlg)) { siteInfoDlg = new TafSiteInfoEditorDlg(shell); siteInfoDlg.open(); - siteInfoDlg = null; } else { - siteInfoDlg.getParent().forceActive(); - siteInfoDlg.getParent().forceFocus(); + siteInfoDlg.bringToTop(); } } }); @@ -348,13 +319,11 @@ public class AvnconfigDlg extends Dialog { tafProductsBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (productsDlg == null || productsDlg.getParent().isDisposed()) { + if (mustCreate(productsDlg)) { productsDlg = new TafProductConfigDlg(shell); productsDlg.open(); - productsDlg = null; } else { - productsDlg.getParent().forceActive(); - productsDlg.getParent().forceFocus(); + productsDlg.bringToTop(); } } }); @@ -366,10 +335,11 @@ public class AvnconfigDlg extends Dialog { climateBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (climateDataDlg == null) { + if (mustCreate(climateDataDlg)) { climateDataDlg = new ClimateDataMenuDlg(shell); climateDataDlg.open(); - climateDataDlg = null; + } else { + climateDataDlg.bringToTop(); } } }); @@ -381,12 +351,4 @@ public class AvnconfigDlg extends Dialog { private void createBottomMessageControls() { msgStatusComp = new MessageStatusComp(shell, null, null); } - - public void setFocus() { - shell.setFocus(); - } - - public boolean isDisposed() { - return shell.isDisposed(); - } -} \ No newline at end of file +} diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/CigVisDistComponent.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/CigVisDistComponent.java index 524178e1de..e08224ed32 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/CigVisDistComponent.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/CigVisDistComponent.java @@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Shell; import com.raytheon.viz.aviation.climatology.CigVisDistributionDlg; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avnconfig.TafSiteConfigFactory; -import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; +import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent; /** * This is a component class for launching the CigVisDistributionDlg dialog. @@ -39,6 +39,8 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 28, 2011 mschenke Initial creation + * Oct 17, 2012 1229 rferrel Changes for non-blocking + * CigVisDistributionDlg. * * * @@ -46,7 +48,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; * @version 1.0 */ -public class CigVisDistComponent extends AbstractCAVEComponent { +public class CigVisDistComponent extends AbstractCAVEDialogComponent { /* * (non-Javadoc) @@ -63,6 +65,7 @@ public class CigVisDistComponent extends AbstractCAVEComponent { new Shell(Display.getCurrent()), siteList, StatusMessageType.Metar, null); cigVisDistDialog.open(); + blockUntilClosed(cigVisDistDialog); } /* diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/CigVisTrendComponent.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/CigVisTrendComponent.java index d347159d97..33d8c0cdf4 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/CigVisTrendComponent.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/CigVisTrendComponent.java @@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Shell; import com.raytheon.viz.aviation.climatology.CigVisTrendDlg; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avnconfig.TafSiteConfigFactory; -import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; +import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent; /** * This is a component class for lanuching the CigVisTrendDlg dialog. @@ -39,14 +39,15 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 28, 2011 mschenke Initial creation - * + * Oct 17, 2012 1229 rferrel Changes for non-blocking + * CigVisTrendDlg. * * * @author mschenke * @version 1.0 */ -public class CigVisTrendComponent extends AbstractCAVEComponent { +public class CigVisTrendComponent extends AbstractCAVEDialogComponent { /* * (non-Javadoc) @@ -62,6 +63,7 @@ public class CigVisTrendComponent extends AbstractCAVEComponent { CigVisTrendDlg cigVisTrendDialog = new CigVisTrendDlg(new Shell( Display.getCurrent()), siteList, StatusMessageType.Metar, null); cigVisTrendDialog.open(); + blockUntilClosed(cigVisTrendDialog); } /* diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/MetarComponent.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/MetarComponent.java index fcc57f0100..8044098c5b 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/MetarComponent.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/MetarComponent.java @@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Shell; import com.raytheon.viz.aviation.climatology.MetarDisplayDialog; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avnconfig.TafSiteConfigFactory; -import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; +import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent; /** * This is a component class for launching the Climate's MetarDisplayDialog. @@ -39,6 +39,8 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 28, 2011 mschenke Initial creation + * Oct 17, 2012 1229 rferrel Changes for non-blocking + * MetarDisplayDialog. * * * @@ -46,7 +48,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; * @version 1.0 */ -public class MetarComponent extends AbstractCAVEComponent { +public class MetarComponent extends AbstractCAVEDialogComponent { /* * (non-Javadoc) @@ -62,6 +64,7 @@ public class MetarComponent extends AbstractCAVEComponent { MetarDisplayDialog metarDialog = new MetarDisplayDialog(new Shell( Display.getCurrent()), siteList, StatusMessageType.Metar, null); metarDialog.open(); + blockUntilClosed(metarDialog); } /* diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/WindRoseComponent.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/WindRoseComponent.java index 0cf7e54404..1974df6cb1 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/WindRoseComponent.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/WindRoseComponent.java @@ -27,7 +27,7 @@ import org.eclipse.swt.widgets.Shell; import com.raytheon.viz.aviation.climatology.WindRosePlotDlg; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avnconfig.TafSiteConfigFactory; -import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; +import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent; /** * Component class for launching the Climate's WindRoseDlg. @@ -39,6 +39,8 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 28, 2011 mschenke Initial creation + * Oct 17, 2012 1229 rferrel Changes for non-blocking + * WindRosePlotDlg. * * * @@ -46,7 +48,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; * @version 1.0 */ -public class WindRoseComponent extends AbstractCAVEComponent { +public class WindRoseComponent extends AbstractCAVEDialogComponent { /* * (non-Javadoc) @@ -63,6 +65,7 @@ public class WindRoseComponent extends AbstractCAVEComponent { Display.getCurrent()), siteList, StatusMessageType.WindRose, null); windRoseDialog.open(); + blockUntilClosed(windRoseDialog); } /* diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/ClimateDataMenuDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/ClimateDataMenuDlg.java index 04a190f267..562b6d8e83 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/ClimateDataMenuDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/ClimateDataMenuDlg.java @@ -73,6 +73,7 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avnconfig.HelpUsageDlg; import com.raytheon.viz.avnconfig.TafSiteConfigFactory; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * This class displays the main Climate Data dialog. @@ -91,6 +92,15 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Mar 18, 2011 #8681 rferrel Corrected checkSite to prevent exception. * May 24, 2011 #9075 rferrel Changed getObsHistoryFromInv() to scan * ish-inventory.txt only one time. + * Oct 04, 2012 #1229 rferrel Made non-blocking. + * Oct 04, 2012 #1229 rferrel Changes for non-blocking ClimateHistoryDlg. + * Oct 08, 2012 #1229 rferrel Changes for non-blocking GenScriptsDlg. + * Oct 08, 2012 #1229 rferrel Changes for non-blocking NCDCInvHistDlg. + * Oct 08, 2012 #1229 rferrel Changes for non-blocking CigVisDistributionDlg. + * Oct 08, 2012 #1229 rferrel Changes for non-blocking WindRosePlotDlg. + * Oct 09, 2012 #1229 rferrel Changes for non-blocking MetarDisplayDialog. + * Oct 09, 2012 #1229 rferrel Changes for non-blocking CigVisTrendDlg. + * Oct 15, 2012 #1229 rferrel Changes for non-blocking HelpUsageDlg. * * * @@ -98,10 +108,11 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * @version 1.0 */ public class ClimateDataMenuDlg extends CaveSWTDialog { - private static final transient IUFStatusHandler statusHandler = UFStatus + + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(ClimateDataMenuDlg.class); - private static final Pattern SP_PAT = Pattern.compile("\\s+"); + private final Pattern SP_PAT = Pattern.compile("\\s+"); /** * Text font. @@ -222,6 +233,8 @@ public class ClimateDataMenuDlg extends CaveSWTDialog { private int waitCnt = 0; + private HelpUsageDlg usageDlg; + /** * Constructor. * @@ -229,7 +242,8 @@ public class ClimateDataMenuDlg extends CaveSWTDialog { * Parent shell. */ public ClimateDataMenuDlg(Shell parentShell) { - super(parentShell, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parentShell, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("AvnFPS Climate Data Menu"); } @@ -247,6 +261,13 @@ public class ClimateDataMenuDlg extends CaveSWTDialog { darkBlueBgColor.dispose(); } + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org + * .eclipse.swt.widgets.Shell) + */ @Override protected void initializeComponents(Shell shell) { // Initialize all of the data, controls, and layouts @@ -381,11 +402,13 @@ public class ClimateDataMenuDlg extends CaveSWTDialog { metarsMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (metarDlg == null) { + if (metarDlg == null || metarDlg.getShell() == null + || metarDlg.isDisposed()) { metarDlg = new MetarDisplayDialog(shell, siteList, StatusMessageType.Metar, null); metarDlg.open(); - metarDlg = null; + } else { + metarDlg.bringToTop(); } } }); @@ -396,11 +419,13 @@ public class ClimateDataMenuDlg extends CaveSWTDialog { windRoseMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (windRose == null || windRose.isDisposed()) { + if (windRose == null || windRose.getShell() == null + || windRose.isDisposed()) { windRose = new WindRosePlotDlg(shell, siteList, StatusMessageType.WindRose, null); windRose.open(); - windRose = null; + } else { + windRose.bringToTop(); } } }); @@ -411,11 +436,13 @@ public class ClimateDataMenuDlg extends CaveSWTDialog { cigVisDistMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (cigVisDist == null) { + if (cigVisDist == null || cigVisDist.getShell() == null + || cigVisDist.isDisposed()) { cigVisDist = new CigVisDistributionDlg(shell, siteList, StatusMessageType.CigVis, null); cigVisDist.open(); - cigVisDist = null; + } else { + cigVisDist.bringToTop(); } } }); @@ -426,11 +453,13 @@ public class ClimateDataMenuDlg extends CaveSWTDialog { cigVisTrendMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (cigVisTrend == null) { + if (cigVisTrend == null || cigVisTrend.getShell() == null + || cigVisTrend.isDisposed()) { cigVisTrend = new CigVisTrendDlg(shell, siteList, StatusMessageType.CigVisTrend, null); cigVisTrend.open(); - cigVisTrend = null; + } else { + cigVisTrend.bringToTop(); } } }); @@ -475,11 +504,15 @@ public class ClimateDataMenuDlg extends CaveSWTDialog { usageMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String description = "CLimate Data Update Dialog Help"; - String helpText = "This dialog is used to create and append climatology data files.\n\nMenu Bar\nFile:\n\tQuit: Close the dialog immediately\n\nCommands:\n\tShow observations history: Opens a graphical display showing the current\n\t\t\t\t\tinventory of climate data available.\n\tUpdate NCDC \"ish\" files: Opens a dialog allowing the user to generate\n\t\t\t\t\tautomated scripts for downloading the Integrated\n\t\t\t\t\tSurface Hourly (ISH) Database.\n\nTools:\n\tPulldown menu consist of the AvnFPS Climate Tools that read the HDF5 climate\n\t\tfiles.\n\nOptions:\n\tAppend: Add new data to existing climate data file\n\tCreate: Generate new climate data files, regardless of whether a file for\n\t\t\tthat site already exists\n\nFields:\n\tSITE ID: Site ID of the site currently selected, or \n\t\t\ta user entered site ID if creating a new data file\n\tMETAR AFOS ID: The AFOS ID used to retrieve location's METAR product for\n\t\t\tuse in AvnFPS's climate Cig/Vis Trend tool.\n\nIdents:\n\tList of current site IDs.\n\nSite info list:\n\tList of IDs and years of data available for each selected site\n\nMonitor area:\n\tArea where all informative messages are displayed.\n\nButtons:\n\n\tAssess Data:\n\tAfter sites are selected, click this to start the creation\n\t\tor append process\n\n\tGenerate Scripts:\n\tGenerate download scripts to retrieve data files from NCDC\n\n\tProcess Data:\n\tIncorporate NCDC data into HDF5 file(s).\n\n\tValidate Data:\n\tTemporarily move newly changed/created files to a location\n\t\tso that AvnFPS climate tools can examine the new climate\n\t\tfile.\n\n\tCommit:\n\tMove newly changed/created files to its permanent location. \n\tClicking this will also generate new station climate qc \n\t\tfiles (files that end in .nc in the data/climate directory)\n\n\tReject:\n\tReject the newly created files in favor of the original file(s),\n\t\tif available. This action deletes newly created files.\n\n\tSave Log:\n\tSave all output in the Monitor area to a file"; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - helpText); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "CLimate Data Update Dialog Help"; + + String helpText = "This dialog is used to create and append climatology data files.\n\nMenu Bar\nFile:\n\tQuit: Close the dialog immediately\n\nCommands:\n\tShow observations history: Opens a graphical display showing the current\n\t\t\t\t\tinventory of climate data available.\n\tUpdate NCDC \"ish\" files: Opens a dialog allowing the user to generate\n\t\t\t\t\tautomated scripts for downloading the Integrated\n\t\t\t\t\tSurface Hourly (ISH) Database.\n\nTools:\n\tPulldown menu consist of the AvnFPS Climate Tools that read the HDF5 climate\n\t\tfiles.\n\nOptions:\n\tAppend: Add new data to existing climate data file\n\tCreate: Generate new climate data files, regardless of whether a file for\n\t\t\tthat site already exists\n\nFields:\n\tSITE ID: Site ID of the site currently selected, or \n\t\t\ta user entered site ID if creating a new data file\n\tMETAR AFOS ID: The AFOS ID used to retrieve location's METAR product for\n\t\t\tuse in AvnFPS's climate Cig/Vis Trend tool.\n\nIdents:\n\tList of current site IDs.\n\nSite info list:\n\tList of IDs and years of data available for each selected site\n\nMonitor area:\n\tArea where all informative messages are displayed.\n\nButtons:\n\n\tAssess Data:\n\tAfter sites are selected, click this to start the creation\n\t\tor append process\n\n\tGenerate Scripts:\n\tGenerate download scripts to retrieve data files from NCDC\n\n\tProcess Data:\n\tIncorporate NCDC data into HDF5 file(s).\n\n\tValidate Data:\n\tTemporarily move newly changed/created files to a location\n\t\tso that AvnFPS climate tools can examine the new climate\n\t\tfile.\n\n\tCommit:\n\tMove newly changed/created files to its permanent location. \n\tClicking this will also generate new station climate qc \n\t\tfiles (files that end in .nc in the data/climate directory)\n\n\tReject:\n\tReject the newly created files in favor of the original file(s),\n\t\tif available. This action deletes newly created files.\n\n\tSave Log:\n\tSave all output in the Monitor area to a file"; + usageDlg = new HelpUsageDlg(shell, description, helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } @@ -842,10 +875,12 @@ public class ClimateDataMenuDlg extends CaveSWTDialog { return; } - if (climateHistoryDlg == null) { + if (climateHistoryDlg == null || climateHistoryDlg.getShell() == null + || climateHistoryDlg.isDisposed()) { climateHistoryDlg = new ClimateHistoryDlg(shell, data); climateHistoryDlg.open(); - climateHistoryDlg = null; + } else { + climateHistoryDlg.bringToTop(); } } @@ -853,10 +888,12 @@ public class ClimateDataMenuDlg extends CaveSWTDialog { * Display the NCDC inventory/history dialog. */ private void displayNCDCInventoryHistoryDialog() { - if (invHistoryDlg == null) { + if (invHistoryDlg == null || invHistoryDlg.getShell() == null + || invHistoryDlg.isDisposed()) { invHistoryDlg = new NCDCInvHistDlg(shell); invHistoryDlg.open(); - invHistoryDlg = null; + } else { + invHistoryDlg.bringToTop(); } } @@ -864,12 +901,20 @@ public class ClimateDataMenuDlg extends CaveSWTDialog { * Display the generate scripts dialog. */ private void displayGenerateScriptDialog() { - if (generateScriptsDlg == null) { + if (generateScriptsDlg == null || generateScriptsDlg.getShell() == null + || generateScriptsDlg.isDisposed()) { ClimateDataManager.getInstance().assessStationsMap(this); - generateScriptsDlg = new GenScriptsDlg(shell); - Boolean bool = (Boolean) generateScriptsDlg.open("data"); - generateScriptsDlg = null; - genScriptsBtn.setEnabled(bool); + generateScriptsDlg = new GenScriptsDlg(shell, "data"); + generateScriptsDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + genScriptsBtn.setEnabled((Boolean) returnValue); + } + }); + generateScriptsDlg.open(); + } else { + generateScriptsDlg.bringToTop(); } } @@ -881,11 +926,11 @@ public class ClimateDataMenuDlg extends CaveSWTDialog { identList.add(siteList.get(i)); } } catch (IOException e) { - statusHandler.handle(Priority.PROBLEM, e.getMessage()); + statusHandler.handle(Priority.PROBLEM, e.getMessage()); } catch (ConfigurationException e) { - statusHandler.handle(Priority.PROBLEM, e.toString()); + statusHandler.handle(Priority.PROBLEM, e.toString()); } catch (LocalizationOpFailedException e) { - statusHandler.handle(Priority.PROBLEM, e.getMessage()); + statusHandler.handle(Priority.PROBLEM, e.getMessage()); } } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/ClimateHistoryDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/ClimateHistoryDlg.java index baff2c3b61..5a7c0dfb3e 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/ClimateHistoryDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/ClimateHistoryDlg.java @@ -48,6 +48,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Nov 16, 2009 #3438 lvenable Initial creation + * Oct 06, 2012 #1229 rferrel Made non-blocking. * * * @@ -87,7 +88,8 @@ public class ClimateHistoryDlg extends CaveSWTDialog { */ public ClimateHistoryDlg(Shell parentShell, ClimateHistoryData climateHistData) { - super(parentShell, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parentShell, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("Climate History"); this.climateHistData = climateHistData; diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/GenScriptsDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/GenScriptsDlg.java index b2d6f35f50..757eca5f0c 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/GenScriptsDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/GenScriptsDlg.java @@ -70,6 +70,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * to the correct directory. * May 10, 2011 #8844 rferrel Display error message when unable * to save a script. + * Oct 08, 2012 #1229 rferrel Made non-blocking. * * * @@ -132,23 +133,16 @@ public class GenScriptsDlg extends CaveSWTDialog { /** * Constructor. * + * @param style * @param parentShell * Parent shell. */ - public GenScriptsDlg(Shell parentShell) { - super(parentShell, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + public GenScriptsDlg(Shell parentShell, String style) { + super(parentShell, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("Generate Scripts"); - initFtpArgs(); - } - - /** - * Open the dialog. - * - * @return null. - */ - public Object open(String style) { this.style = style; - return open(); + initFtpArgs(); } public void preOpened() { diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/NCDCInvHistDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/NCDCInvHistDlg.java index 2a30c83010..e124048ab9 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/NCDCInvHistDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatedata/NCDCInvHistDlg.java @@ -43,6 +43,7 @@ import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * This class displays the NCDC Inventory/History dialog. @@ -53,6 +54,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Nov 16, 2009 #3438 lvenable Initial creation + * Oct 08, 2012 #1229 rferrel Changes for non-blocking GenScriptsDlg. + * Oct 08, 2012 #1229 rferrel Make dialog non-blocking. * * * @@ -133,7 +136,8 @@ public class NCDCInvHistDlg extends CaveSWTDialog { * Parent shell. */ public NCDCInvHistDlg(Shell parentShell) { - super(parentShell, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parentShell, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("NCDC Inventory/History"); } @@ -225,10 +229,22 @@ public class NCDCInvHistDlg extends CaveSWTDialog { invScriptBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if (generateScriptsDlg == null) { - generateScriptsDlg = new GenScriptsDlg(shell); - generateScriptsDlg.open("inv"); - generateScriptsDlg = null; + if (generateScriptsDlg == null + || generateScriptsDlg.getShell() == null + || generateScriptsDlg.isDisposed()) { + histScriptBtn.setEnabled(false); + + generateScriptsDlg = new GenScriptsDlg(shell, "inv"); + generateScriptsDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + histScriptBtn.setEnabled(true); + } + }); + generateScriptsDlg.open(); + } else { + generateScriptsDlg.bringToTop(); } } }); @@ -300,10 +316,21 @@ public class NCDCInvHistDlg extends CaveSWTDialog { histScriptBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if (generateScriptsDlg == null) { - generateScriptsDlg = new GenScriptsDlg(shell); - generateScriptsDlg.open("his"); - generateScriptsDlg = null; + if (generateScriptsDlg == null + || generateScriptsDlg.getShell() == null + || generateScriptsDlg.isDisposed()) { + invScriptBtn.setEnabled(false); + generateScriptsDlg = new GenScriptsDlg(shell, "his"); + generateScriptsDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + invScriptBtn.setEnabled(true); + } + }); + generateScriptsDlg.open(); + } else { + generateScriptsDlg.bringToTop(); } } }); diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/CigVisDistributionDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/CigVisDistributionDlg.java index b08f4382d7..184cb69bb2 100755 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/CigVisDistributionDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/CigVisDistributionDlg.java @@ -86,6 +86,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 3/31/2011 8774 rferrel killProcess when doing a disposed * 4/4/2011 8896 rferrel Made timeout configurable * 4/14/2011 8861 rferrel Use SaveImageDlg class + * 04/08/2012 1229 rferrel Made dialog non-blocking. + * 10/15/2012 1229 rferrel Changes for non-blocking HelpUsageDlg. * * * @@ -95,7 +97,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; */ public class CigVisDistributionDlg extends CaveSWTDialog implements PyProcessListener { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(CigVisDistributionDlg.class); /** @@ -205,6 +207,8 @@ public class CigVisDistributionDlg extends CaveSWTDialog implements */ private SaveImageDlg siDlg; + private HelpUsageDlg usageDlg; + /** * Constructor. * @@ -220,7 +224,7 @@ public class CigVisDistributionDlg extends CaveSWTDialog implements public CigVisDistributionDlg(Shell parent, java.util.List icaos, StatusMessageType msgType, RGB statusCompRGB) { super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, - CAVE.PERSPECTIVE_INDEPENDENT); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK); setText("AvnFPS - Ceiling/Visibility Distribution"); this.icaos = icaos; @@ -383,11 +387,15 @@ public class CigVisDistributionDlg extends CaveSWTDialog implements usageMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String description = "AvnFPS - Ceiling and Visibility Display Help"; - String helpText = "This application displays ceiling and visiblity distribution for\nselected time range.\n\nThe distribution is plotted in a form of stacked histogram. \nPlot Type \n By Month - the X axis is month. The category frequency is \n calculated for a selected range of hours.\n By Hour - the X axis is hour of day. The category frequency \n is calculated for a selected range of months.\n By Wind Dir - the X axis is 16 point wind direction. The category \n frequency is calculated for a selected range of \n months and hours.\n\nAuto Redraw \n Forces screen redraw every time a new sites selected or date/time \n widgets are modified.\n\nElement\n Visibility - only visibility thresholds are checked to determine \n flight category\n Ceiling - only ceiling thresholds are checked to determine \n flight category\n Joint - both ceiling and visibility thresholds are checked \n to determine flight category\n\ny-axis scale\n Sets maximum value for the vertical axis. If 'auto' toggle is set,\n the value is computed. Behaves sensibly if selected value is too \n low."; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - helpText); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "AvnFPS - Ceiling and Visibility Display Help"; + + String helpText = "This application displays ceiling and visiblity distribution for\nselected time range.\n\nThe distribution is plotted in a form of stacked histogram. \nPlot Type \n By Month - the X axis is month. The category frequency is \n calculated for a selected range of hours.\n By Hour - the X axis is hour of day. The category frequency \n is calculated for a selected range of months.\n By Wind Dir - the X axis is 16 point wind direction. The category \n frequency is calculated for a selected range of \n months and hours.\n\nAuto Redraw \n Forces screen redraw every time a new sites selected or date/time \n widgets are modified.\n\nElement\n Visibility - only visibility thresholds are checked to determine \n flight category\n Ceiling - only ceiling thresholds are checked to determine \n flight category\n Joint - both ceiling and visibility thresholds are checked \n to determine flight category\n\ny-axis scale\n Sets maximum value for the vertical axis. If 'auto' toggle is set,\n the value is computed. Behaves sensibly if selected value is too \n low."; + usageDlg = new HelpUsageDlg(shell, description, helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/CigVisTrendDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/CigVisTrendDlg.java index cbc893ccac..0f7a4680b1 100755 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/CigVisTrendDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/CigVisTrendDlg.java @@ -71,6 +71,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 9/12/2008 1444 grichard Accommodate separate message logs. * 3/31/2011 8774 rferrel killProcess when doing a disposed * 4/14/2011 8861 rferrel Use SaveImageDlg class + * 10/09/2912 1229 rferrel Made non-blocking + * 10/15/2012 1229 rferrel Changes for non-blocking HelpUsageDlg. * * * @@ -204,6 +206,8 @@ public class CigVisTrendDlg extends CaveSWTDialog { */ private SaveImageDlg siDlg; + private HelpUsageDlg usageDlg; + /** * Constructor. * @@ -218,7 +222,8 @@ public class CigVisTrendDlg extends CaveSWTDialog { */ public CigVisTrendDlg(Shell parent, java.util.List icaos, StatusMessageType msgType, RGB statusCompRGB) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("AvnFPS - Ceiling/Visibility Trend"); this.icaos = icaos; @@ -357,11 +362,14 @@ public class CigVisTrendDlg extends CaveSWTDialog { usageMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String description = "AvnFPS - Ceiling and Visibility Display Help"; - String helpText = "This application displays ceiling/visibility trend based\non selected initial conditions.\n\nUse \"Get\" button to retrieve METAR for a selected site.\nThe METAR can be modified.\nUse \"Decode\" button to initialize selection widgets.\nThe initial conditions can be adjusted either by typing\nin the \"value\" and \"range\" windows, or by mouse actions.\nLeft button moves value or an edge of range (red area on\nthe element widget). Middle button is used to move both\nvalue and range. In the \"Wind Direction\" widget use right\nbutton to toggle between wind arrow and a circle representing\ncalm and variable wind.\nUse \"Element\" radiobuttons to select forecasted element.\nPress \"Draw\" to display the forecast.\n\nThe displayed image can be printed or stored in a graphic file.\nUse \"File\" menu for that purpose."; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - helpText); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "AvnFPS - Ceiling and Visibility Display Help"; + String helpText = "This application displays ceiling/visibility trend based\non selected initial conditions.\n\nUse \"Get\" button to retrieve METAR for a selected site.\nThe METAR can be modified.\nUse \"Decode\" button to initialize selection widgets.\nThe initial conditions can be adjusted either by typing\nin the \"value\" and \"range\" windows, or by mouse actions.\nLeft button moves value or an edge of range (red area on\nthe element widget). Middle button is used to move both\nvalue and range. In the \"Wind Direction\" widget use right\nbutton to toggle between wind arrow and a circle representing\ncalm and variable wind.\nUse \"Element\" radiobuttons to select forecasted element.\nPress \"Draw\" to display the forecast.\n\nThe displayed image can be printed or stored in a graphic file.\nUse \"File\" menu for that purpose."; + usageDlg = new HelpUsageDlg(shell, description, helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/ClimateMenuDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/ClimateMenuDlg.java index 268c2c64e9..c9e25a0954 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/ClimateMenuDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/ClimateMenuDlg.java @@ -66,6 +66,11 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * in initializeComponents * 10/12/2010 6009 rferrel Code clean up from making TafSiteConfig * a singleton + * 10/04/2012 1229 rferrel Made non-blocking. + * 10/08/2012 1229 rferrel Changes for non-blocking WindRosePlotDlg. + * 10/09/2012 1229 rferrel Changes for non-blocking MetarDisplayDialog. + * 10/09/2012 1229 rferrel Changes for non-blocking CigVisTrendDlg. + * 10/15/2012 1229 rferrel Changes for non-blocking HelpUsageDlg. * * * @@ -102,6 +107,8 @@ public class ClimateMenuDlg extends CaveSWTDialog { private CigVisTrendDlg cigVisTrend; + private HelpUsageDlg usageDlg; + /** * Constructor. * @@ -114,7 +121,8 @@ public class ClimateMenuDlg extends CaveSWTDialog { */ public ClimateMenuDlg(Shell parent, StatusMessageType[] statusMsgTypes, RGB statusCompRGB) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("AvnFPS Climate Menu"); this.statusMsgTypes = statusMsgTypes; @@ -229,11 +237,15 @@ public class ClimateMenuDlg extends CaveSWTDialog { usageMenuItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String description = "AvnFPS Climate Menu - Usage"; - String helpText = "This master menu GUI is used to launch applications that display NCDC\nclimatological data for observation sites in a variety of formats.\n\nButton description:\n\nMETARs: use to display reconstructed METARs for a user-defined\n span of days\nWind Rose: displays Wind Rose for selected dates, times and flight\n category conditions\nCigVis Dist: displays ceiling, visibility and flight category\n distributions by month, hour and wind direction\nCigVis Trend: displays 3-12 hour ceiling, visibility and flight\n category forecast based on initial conditions"; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - helpText); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "AvnFPS Climate Menu - Usage"; + + String helpText = "This master menu GUI is used to launch applications that display NCDC\nclimatological data for observation sites in a variety of formats.\n\nButton description:\n\nMETARs: use to display reconstructed METARs for a user-defined\n span of days\nWind Rose: displays Wind Rose for selected dates, times and flight\n category conditions\nCigVis Dist: displays ceiling, visibility and flight category\n distributions by month, hour and wind direction\nCigVis Trend: displays 3-12 hour ceiling, visibility and flight\n category forecast based on initial conditions"; + usageDlg = new HelpUsageDlg(shell, description, helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } @@ -258,11 +270,13 @@ public class ClimateMenuDlg extends CaveSWTDialog { metarsBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (metarDlg == null) { + if (metarDlg == null || metarDlg.getShell() == null + || metarDlg.isDisposed()) { metarDlg = new MetarDisplayDialog(shell, stationList, statusMsgTypes[0], statusCompRGB); metarDlg.open(); - metarDlg = null; + } else { + metarDlg.bringToTop(); } } }); @@ -277,11 +291,13 @@ public class ClimateMenuDlg extends CaveSWTDialog { windRoseBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (windRose == null || windRose.isDisposed()) { + if (windRose == null || windRose.getShell() == null + || windRose.isDisposed()) { windRose = new WindRosePlotDlg(shell, stationList, statusMsgTypes[1], statusCompRGB); windRose.open(); - windRose = null; + } else { + windRose.bringToTop(); } } }); @@ -296,11 +312,13 @@ public class ClimateMenuDlg extends CaveSWTDialog { distBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (cigVisDist == null) { + if (cigVisDist == null || cigVisDist.getShell() == null + || cigVisDist.isDisposed()) { cigVisDist = new CigVisDistributionDlg(shell, stationList, statusMsgTypes[2], statusCompRGB); cigVisDist.open(); - cigVisDist = null; + } else { + cigVisDist.bringToTop(); } } }); @@ -315,11 +333,13 @@ public class ClimateMenuDlg extends CaveSWTDialog { trendBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (cigVisTrend == null) { + if (cigVisTrend == null || cigVisTrend.getShell() == null + || cigVisTrend.isDisposed()) { cigVisTrend = new CigVisTrendDlg(shell, stationList, statusMsgTypes[3], statusCompRGB); cigVisTrend.open(); - cigVisTrend = null; + } else { + cigVisTrend.bringToTop(); } } }); diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/MetarDisplayDialog.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/MetarDisplayDialog.java index 9cb96f632a..414a748eae 100755 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/MetarDisplayDialog.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/MetarDisplayDialog.java @@ -90,6 +90,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 4/4/2011 8896 rferrel Made timeout configurable * 4/8/2011 8838 rferrel Properly set up "Show Display" * 4/12/2011 8861 rferrel Added file permission check in savedata + * 10/09/2012 1229 rferrel Change to non-blocking dialog. + * 10/15/2012 1229 rferrel Changes for non-blocking HelpUsageDlg. * * * @@ -98,7 +100,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; */ public class MetarDisplayDialog extends CaveSWTDialog implements PyProcessListener { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(MetarDisplayDialog.class); /** @@ -165,6 +167,8 @@ public class MetarDisplayDialog extends CaveSWTDialog implements private PythonProcess pythonScript = null; + private HelpUsageDlg usageDlg; + /** * Constructor. * @@ -179,7 +183,8 @@ public class MetarDisplayDialog extends CaveSWTDialog implements */ public MetarDisplayDialog(Shell parent, java.util.List icaos, StatusMessageType msgType, RGB statusCompRGB) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("AvnFPS - METAR Display"); this.icaos = icaos; @@ -484,11 +489,16 @@ public class MetarDisplayDialog extends CaveSWTDialog implements usageMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String description = "METAR Display Help"; - String helpText = "This dialog is used to display METARs reconstructed from climate data.\n\nMenu Bar\nFile:\n Print: invokes printer selection dialog.\n Save As: invokes file selection dialog.\n\nOptions:\n Show Decoded: toggles between METAR and decoded (ARONET) display \n format\n Update on Selection: when selected, \"Station\", \"Month\", \"Day\" \n and \"Num Days\" changes update the display without \n pressing \"Show\"\n\nDate Selection\n Year: select start year.\n Month: select start month.\n Day: select start day. Range of days is always 1-31, \n year 2000, month 2, day 31 results in data for \n March 2, 2000.\n Num Days: number of days of data to display.\n\nShow: displays reconstructed METARs for the selected dates and \n display format."; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - helpText); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "METAR Display Help"; + + String helpText = "This dialog is used to display METARs reconstructed from climate data.\n\nMenu Bar\nFile:\n Print: invokes printer selection dialog.\n Save As: invokes file selection dialog.\n\nOptions:\n Show Decoded: toggles between METAR and decoded (ARONET) display \n format\n Update on Selection: when selected, \"Station\", \"Month\", \"Day\" \n and \"Num Days\" changes update the display without \n pressing \"Show\"\n\nDate Selection\n Year: select start year.\n Month: select start month.\n Day: select start day. Range of days is always 1-31, \n year 2000, month 2, day 31 results in data for \n March 2, 2000.\n Num Days: number of days of data to display.\n\nShow: displays reconstructed METARs for the selected dates and \n display format."; + + usageDlg = new HelpUsageDlg(shell, description, helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WeatherPlotDialog.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WeatherPlotDialog.java index d8a56db8ca..9942a9a0bc 100755 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WeatherPlotDialog.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WeatherPlotDialog.java @@ -69,6 +69,7 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avnconfig.HelpUsageDlg; import com.raytheon.viz.avnconfig.MessageStatusComp; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * WeatherPlotDialog class displays the Weather Plot dialog for AvnFPS. @@ -84,6 +85,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 11/18/2010 6701 rferrel Now uses the same wxPlotCfg * as WeatherPlotDataManager. * 04/28/2011 8065 rferrel Use cache data. + * 10/02/2012 1229 rferrel Made dialog non-blocking. + * 10/10/2012 1229 rferrel Changes for non-blocking TimeSelectorDlg. + * 10/15/2012 1229 rferrel Changes for non-blocking HelpUsageDlg. * * * @@ -173,16 +177,6 @@ public class WeatherPlotDialog extends CaveSWTDialog { */ private Label siteTimeLbl; - /** - * Scrolled composite width. - */ - private final int SCROLLED_COMP_WIDTH = 1120; - - /** - * Scrolled composite height. - */ - private final int SCROLLED_COMP_HEIGHT = 610; - /** * Scrolled composite containing plot data. */ @@ -223,6 +217,10 @@ public class WeatherPlotDialog extends CaveSWTDialog { */ private List icaos; + private TimeSelectorDialog timeDlg; + + private HelpUsageDlg usageDlg; + /** * Constructor. * @@ -234,7 +232,8 @@ public class WeatherPlotDialog extends CaveSWTDialog { public WeatherPlotDialog(Shell parent, StatusMessageType msgType, List stationList) { super(parent, SWT.DIALOG_TRIM | SWT.MODELESS | SWT.RESIZE, - CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("AvnFPS Weather Plot"); this.msgType = msgType; @@ -419,10 +418,25 @@ public class WeatherPlotDialog extends CaveSWTDialog { timesBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - TimeSelectorDialog timeDlg = new TimeSelectorDialog(shell, - wxPlotCfg); - if ((Boolean) timeDlg.open()) { - displayData(); + if (timeDlg == null || timeDlg.getShell() == null + || timeDlg.isDisposed()) { + timeDlg = new TimeSelectorDialog(shell, wxPlotCfg); + timeDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof Boolean) { + boolean value = (Boolean) returnValue; + if (value) { + displayData(); + } + } + + } + }); + timeDlg.open(); + } else { + timeDlg.bringToTop(); } } }); @@ -456,11 +470,14 @@ public class WeatherPlotDialog extends CaveSWTDialog { helpBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String text = "This dialog is used to display TAFs, METARs and guidance forecasts.\n\nMenus:\n Site ID - pulldown menu displaying list of all TAF sites.\n Selection of a site from the list redraws the window.\n zoom - zoom factor (time scale). \n\nButtons:\n Display - Redraws the window.\n Times - Displays forecast time selection window\n Print - Dumps an image of the window to a command specified in\n the configration file etc/wxplot.cfg.\n Close - Closes this dialog.\n Help - Displays this help.\n\nData Sources - selection of available data sources. "; - String description = "Help"; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - text); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "Help"; + String helpText = "This dialog is used to display TAFs, METARs and guidance forecasts.\n\nMenus:\n Site ID - pulldown menu displaying list of all TAF sites.\n Selection of a site from the list redraws the window.\n zoom - zoom factor (time scale). \n\nButtons:\n Display - Redraws the window.\n Times - Displays forecast time selection window\n Print - Dumps an image of the window to a command specified in\n the configration file etc/wxplot.cfg.\n Close - Closes this dialog.\n Help - Displays this help.\n\nData Sources - selection of available data sources. "; + usageDlg = new HelpUsageDlg(shell, description, helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WindRoseConfigDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WindRoseConfigDlg.java index 0b1126f72f..818b7fca6b 100755 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WindRoseConfigDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WindRoseConfigDlg.java @@ -61,6 +61,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * ------------ ---------- ----------- -------------------------- * 28 FEB 2008 938 lvenable Initial creation * 18 JUN 2008 1119 lvenable Updated dialog to reflect user changes. + * 04 OCT 2012 1229 rferrel Made non-blocking. * * * @@ -162,7 +163,8 @@ public class WindRoseConfigDlg extends CaveSWTDialog { * Parent shell. */ public WindRoseConfigDlg(Shell parent, WindRoseConfigData windRoseConfigData) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("Config"); this.windRoseConfigData = windRoseConfigData; diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WindRosePlotDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WindRosePlotDlg.java index db908b75f9..cc580a6708 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WindRosePlotDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/climatology/WindRosePlotDlg.java @@ -55,6 +55,7 @@ import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.MessageBox; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Spinner; + import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avnconfig.HelpUsageDlg; import com.raytheon.viz.avnconfig.ITafSiteConfig; @@ -81,6 +82,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 4/14/2011 8861 rferrel Use SaveImageDlg class * 23JUL2012 15169 zhao Use Combo for 'Month' and 'Number of Months' * & disabled site controls while drawing + * 04OCT2012 1229 rferrel Changes for non-blocking WindRoseConfigDlg. + * 08OCT2012 1229 rferrel Made non-blocking. + * 10/15/2012 1229 rferrel Changes for non-blocking HelpUsageDlg. * * * @@ -183,6 +187,10 @@ public class WindRosePlotDlg extends CaveSWTDialog { */ private RGB statusCompRGB; + private WindRoseConfigDlg configDlg; + + private HelpUsageDlg usageDlg; + /** * Constructor. * @@ -197,7 +205,8 @@ public class WindRosePlotDlg extends CaveSWTDialog { */ public WindRosePlotDlg(Shell parent, java.util.List icaos, StatusMessageType msgType, RGB statusCompRGB) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("Wind Rose Plot"); this.icaos = icaos; @@ -321,9 +330,13 @@ public class WindRosePlotDlg extends CaveSWTDialog { configureMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - WindRoseConfigDlg configDlg = new WindRoseConfigDlg(shell, - windRoseConfigData); - configDlg.open(); + if (configDlg == null || configDlg.getShell() == null + || configDlg.isDisposed()) { + configDlg = new WindRoseConfigDlg(shell, windRoseConfigData); + configDlg.open(); + } else { + configDlg.bringToTop(); + } } }); @@ -367,11 +380,15 @@ public class WindRosePlotDlg extends CaveSWTDialog { usageMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String description = "AvnFPS - Wind Rose Display Help"; - String helpText = "This application displays wind rose for selected month and hour,\nor range of hours. \n\nTime selection\n Month - selects month.\n Num Months - select number of months of data to display\n Hour - selects hour. \n Num Hours - selects number of hours of data to display\n\nFlight Cat\n This option menu restricts the search to flight category\n conditions at or below the selected value. \"All\" means no\n restrictions.\n\nIf Auto Redraw is selected, changing month, hour, or number of hours\nfields will cause the wind rose to be redrawn for any valid value in\nthese fields.\n\nUse the\"Draw\" button to display wind rose after selecting new site,\nor flight category.\n\nThe displayed image can be printed or stored in a graphic file.\nUse the options under the \"File\" menu for that purpose."; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - helpText); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "AvnFPS - Wind Rose Display Help"; + + String helpText = "This application displays wind rose for selected month and hour,\nor range of hours. \n\nTime selection\n Month - selects month.\n Num Months - select number of months of data to display\n Hour - selects hour. \n Num Hours - selects number of hours of data to display\n\nFlight Cat\n This option menu restricts the search to flight category\n conditions at or below the selected value. \"All\" means no\n restrictions.\n\nIf Auto Redraw is selected, changing month, hour, or number of hours\nfields will cause the wind rose to be redrawn for any valid value in\nthese fields.\n\nUse the\"Draw\" button to display wind rose after selecting new site,\nor flight category.\n\nThe displayed image can be printed or stored in a graphic file.\nUse the options under the \"File\" menu for that purpose."; + usageDlg = new HelpUsageDlg(shell, description, helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } @@ -431,16 +448,15 @@ public class WindRosePlotDlg extends CaveSWTDialog { gd = new GridData(66, SWT.DEFAULT); monthCbo = new Combo(monthHourComp, SWT.DROP_DOWN | SWT.READ_ONLY); monthCbo.setLayoutData(gd); - for ( int i = 1; i <= 12; i++ ) { - monthCbo.add(""+i, i-1); + for (int i = 1; i <= 12; i++) { + monthCbo.add("" + i, i - 1); } monthCbo.select(cal.get(Calendar.MONTH)); monthCbo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - //System.out.println(" *************** monthsCbo.getText() = " + monthCbo.getText() ); if (autoRedrawChk.getSelection()) { - redrawWindRose(); + redrawWindRose(); } } }); @@ -451,16 +467,15 @@ public class WindRosePlotDlg extends CaveSWTDialog { gd = new GridData(66, SWT.DEFAULT); numMonthsCbo = new Combo(monthHourComp, SWT.DROP_DOWN | SWT.READ_ONLY); numMonthsCbo.setLayoutData(gd); - for ( int i = 1; i <= 12; i++ ) { - numMonthsCbo.add(""+i, i-1); + for (int i = 1; i <= 12; i++) { + numMonthsCbo.add("" + i, i - 1); } numMonthsCbo.select(0); numMonthsCbo.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - //System.out.println(" *************** numMonthsCbo.getText() = " + numMonthsCbo.getText() ); if (autoRedrawChk.getSelection()) { - redrawWindRose(); + redrawWindRose(); } } }); @@ -585,11 +600,9 @@ public class WindRosePlotDlg extends CaveSWTDialog { generateWindRoseHeader(); windRoseCanvasComp.updateAndRedraw(windRoseConfigData.cloneData(), - windRoseHeader, - monthCbo.getText(), - numMonthsCbo.getText(), - hourSpnr.getText(), - numHoursSpnr.getText(), flightCatCbo.getSelectionIndex(), + windRoseHeader, monthCbo.getText(), numMonthsCbo.getText(), + hourSpnr.getText(), numHoursSpnr.getText(), + flightCatCbo.getSelectionIndex(), siteList.getItem(siteList.getSelectionIndex()), this); } } @@ -647,18 +660,21 @@ public class WindRosePlotDlg extends CaveSWTDialog { header.append(MONTHS[monthCbo.getSelectionIndex()]); - if ( numMonthsCbo.getSelectionIndex() == 0 ) { + if (numMonthsCbo.getSelectionIndex() == 0) { header.append(" "); } else { header.append("-"); int endMonth = 0; - if ( ( numMonthsCbo.getSelectionIndex() + monthCbo.getSelectionIndex() ) > 11 ) { - endMonth = numMonthsCbo.getSelectionIndex() + monthCbo.getSelectionIndex() - 12; + if ((numMonthsCbo.getSelectionIndex() + monthCbo + .getSelectionIndex()) > 11) { + endMonth = numMonthsCbo.getSelectionIndex() + + monthCbo.getSelectionIndex() - 12; header.append(MONTHS[endMonth]); } else { - endMonth = numMonthsCbo.getSelectionIndex() + monthCbo.getSelectionIndex(); + endMonth = numMonthsCbo.getSelectionIndex() + + monthCbo.getSelectionIndex(); header.append(MONTHS[endMonth]); } header.append(" "); diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/LoaderDialog.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/LoaderDialog.java index 33eede12f8..3850b91c62 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/LoaderDialog.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/LoaderDialog.java @@ -71,6 +71,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 7/26/2010 6693 rferrel Apply now checks for Delay. * 9/9/2010 5468 rferrel Check for no TAF loaded for a site * 10/1/2010 4345 rferrel Made products display the same as AWIPS I + * 10/04/2012 1229 rferrel Made non-blocking. * * * @@ -141,7 +142,8 @@ public class LoaderDialog extends CaveSWTDialog { * Parent Shell. */ public LoaderDialog(Shell parent, TafViewerEditorDlg tveDlg) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("AvnFPS Loader"); this.tveDlg = tveDlg; diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/QcDialog.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/QcDialog.java index 34564102df..6a8037cc9c 100755 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/QcDialog.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/QcDialog.java @@ -48,6 +48,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 1/17/2011 7782 rferrel Dialog now has open return null or * the desired check list; removed the use * of sites to be like OB9.2.X. + * 10/09/2012 1229 rferrel Made dialog non-blocking. * * * @@ -89,7 +90,8 @@ public class QcDialog extends CaveSWTDialog { * - parent composite */ public QcDialog(Shell parent, Map items) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("AvnFPS QC"); this.items = items; @@ -217,7 +219,7 @@ public class QcDialog extends CaveSWTDialog { qcItems.put("impact", "0"); } setReturnValue(qcItems); - shell.dispose(); + close(); } }); @@ -229,7 +231,7 @@ public class QcDialog extends CaveSWTDialog { @Override public void widgetSelected(SelectionEvent event) { setReturnValue(null); - shell.dispose(); + close(); } }); } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/TafViewerEditorDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/TafViewerEditorDlg.java index 527abe027c..020a942dc1 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/TafViewerEditorDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/editor/TafViewerEditorDlg.java @@ -79,7 +79,6 @@ import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Dialog; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.FileDialog; import org.eclipse.swt.widgets.Label; @@ -134,6 +133,8 @@ import com.raytheon.viz.avnconfig.TafSiteConfigFactory; import com.raytheon.viz.avnconfig.TafSiteData; import com.raytheon.viz.texteditor.TextDisplayModel; import com.raytheon.viz.texteditor.msgs.IAviationObserver; +import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * This class displays the TAF Viewer and Editor dialog. @@ -214,6 +215,14 @@ import com.raytheon.viz.texteditor.msgs.IAviationObserver; * 11/29/2011 11612 rferrel Added getViewerTabList. * 20JUL2012 14570 gzhang/zhao Highlight correct time groups in TAF Viewer * 08AGU2012 15613 zhao Modified highlightTAF() + * 04OCT2012 1229 rferrel Changes for non-blocking LoaderDialog. + * 09OCT2012 1229 rferrel Changes for non-blocking QcDialog. + * 09OCT2012 1229 rferrel Changes for non-blocking SendDialog. + * 11OCT2012 1229 rferrel Converted to a subclass of CaveSWTDialog and + * 12OCT2012 1229 rferrel Changes for non-blocking FindReplaceDlg. + * made non-blocking. + * 10/15/2012 1229 rferrel Changes for non-blocking HelpUsageDlg. + * 11/05/2012 15477 zhao Trim blank lines in text in Editor when check Syntax * * * @@ -221,12 +230,12 @@ import com.raytheon.viz.texteditor.msgs.IAviationObserver; * @version 1.0 * */ -public class TafViewerEditorDlg extends Dialog implements ITafSettable, +public class TafViewerEditorDlg extends CaveSWTDialog implements ITafSettable, IEditActions { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(TafViewerEditorDlg.class); - private static final String SPLIT_REGEX = "=+[\\s\n]*|\n{2,}|\n$"; + private final String SPLIT_REGEX = "=+[\\s\n]*|\n{2,}|\n$"; /** * The number of editor tabs @@ -249,11 +258,6 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, return PATH_MANAGER.getFile(baseCommonCtx, "python").getPath(); } - /** - * Dialog shell. - */ - private Shell shell; - /** * The display control. */ @@ -449,6 +453,8 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, */ private boolean pythonModifiedTAF = false; + private FindReplaceDlg findDlg; + /** * TAF editor enumeration */ @@ -515,21 +521,30 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, private PythonScript parsePythonScript; + private LoaderDialog loadDlg; + + private QcDialog qcDlg; + + private SendDialog sendDlg; + + private HelpUsageDlg usageDlg; + + private HelpUsageDlg keyBindingUsageDlg; + /** * Constructor. * * @param parent * Parent Shell. - * @param disposeOnExit - * Flag to indicate whether to dispose dialog on exit. */ - public TafViewerEditorDlg(Shell parent, boolean disposeOnExit, - List stationList) { - super(parent, 0); + public TafViewerEditorDlg(Shell parent, List stationList, + int caveStyle) { + super(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MODELESS, caveStyle + | CAVE.DO_NOT_BLOCK); this.stationList = stationList; - init(); + setText("AvnFPS TAF Editor"); } /** @@ -542,34 +557,6 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, ResourceConfigMgr configMgr = ResourceConfigMgr.getInstance(); - boolean transientDialog = configMgr - .getDataAsBoolean(ResourceTag.TransientDialogs); - - /* - * Check the transient dialog setting. If the transient dialog is true - * then the parent dialog cannot be display on top of this dialog. If - * the transient is false the parent dialog can be displayed on top of - * this dialog. - */ - if (transientDialog == true) { - // Parent dialog cannot be displayed on top of this dialog. - shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE - | SWT.MODELESS); - } else { - // Parent dialog can be displayed on top of this dialog. - shell = new Shell(parent.getDisplay(), SWT.DIALOG_TRIM | SWT.RESIZE - | SWT.MODELESS); - - parent.addDisposeListener(new DisposeListener() { - @Override - public void widgetDisposed(DisposeEvent e) { - disposeDialog(); - } - }); - } - - shell.setText("AvnFPS TAF Editor"); - shell.addShellListener(new ShellAdapter() { @Override public void shellClosed(ShellEvent event) { @@ -586,7 +573,7 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, // } // Block the disposal of this dialog. - shell.setVisible(false); + hideDialog(); event.doit = false; } }); @@ -630,8 +617,6 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, // Initialize all of the controls and layouts initializeComponents(); - shell.pack(); - /* * NOTE: * @@ -662,6 +647,8 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, */ @Override public void updateSettings(TafSettings setting, String stationName) { + checkDlg(); + String previousStationName = this.stationName; this.stationName = stationName; @@ -780,6 +767,9 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, @Override public void clearAll() { + if (shell == null) { + return; + } // Clear all tab items within all editor tabs on the tab folder. tabFolder.setSelection(editorTab); @@ -880,8 +870,31 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, */ @Override public void showDialog() { + + checkDlg(); + if (shell.isVisible() == false) { - shell.setVisible(true); + setVisible(true); + } + + if (mustCreate(qcDlg) == false) { + qcDlg.bringToTop(); + } + + if (mustCreate(sendDlg) == false) { + sendDlg.bringToTop(); + } + + if (mustCreate(findDlg) == false) { + findDlg.bringToTop(); + } + + if (mustCreate(keyBindingUsageDlg) == false) { + keyBindingUsageDlg.bringToTop(); + } + + if (mustCreate(usageDlg) == false) { + usageDlg.bringToTop(); } shell.setActive(); @@ -893,12 +906,34 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, @Override public void hideDialog() { - // if (disposeOnExit == true) { - // return; - // } - if (shell.isVisible() == true) { - shell.setVisible(false); + setVisible(false); + } + if (mustCreate(qcDlg) == false) { + qcDlg.hide(); + } + if (mustCreate(sendDlg) == false) { + sendDlg.hide(); + } + + if (mustCreate(findDlg) == false) { + findDlg.hide(); + } + + if (mustCreate(keyBindingUsageDlg) == false) { + keyBindingUsageDlg.hide(); + } + + if (mustCreate(usageDlg) == false) { + usageDlg.hide(); + } + } + + private void setVisible(boolean state) { + shell.setVisible(state); + if (loadDlg != null && loadDlg.getShell() != null + && !loadDlg.isDisposed()) { + loadDlg.getShell().setVisible(state); } } @@ -916,8 +951,17 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, fltCatFontColor.dispose(); fltCatFontColor = null; } - shell.dispose(); - clipboard.dispose(); + + close(); + + if (clipboard != null) { + clipboard.dispose(); + } + } + + @Override + protected void initializeComponents(Shell shell) { + init(); } /** @@ -1107,7 +1151,6 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, closeMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - // shell.dispose(); hideDialog(); } }); @@ -1250,9 +1293,13 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, findMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - FindReplaceDlg findDlg = new FindReplaceDlg(shell, - editorTafTabComp.getTextEditorControl()); - findDlg.open(); + if (mustCreate(findDlg)) { + findDlg = new FindReplaceDlg(shell, editorTafTabComp + .getTextEditorControl()); + findDlg.open(); + } else { + findDlg.bringToTop(); + } } }); @@ -1304,53 +1351,57 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, keyBindingMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String text = "Ctrl-u Undo changes.\n" - + "Ctrl-r Redo changes.\n" - + "Insert Toggles insert/overwrite mode.\n" - + "Any-Key Insert normal printing characters.\n" - + "Button1 Sets the insert point, clear the selection, set focus.\n" - + "Ctrl-Button1 Set the insert point without affecting the selection.\n" - + "Button1-Motion Sweep out a selection from the insert point.\n" - + "Double-Button1 Select the word under the mouse.\n" - + "Triple-Button1 Select the line under the mouse.\n" - + "Shift-Button1 Adjust the end of selection closest to the mouse.\n" - + "Shift-Button1-Motion Continue to adjust the selection.\n" - + "Button2 Paste the selection, or set the scrolling anchor.\n" - + "Button2-Motion Scroll the window.\n" - + "Left or Ctrl-b Move the cursor left one character. Clear selection.\n" - + "Shift-Left Move the cursor and extend the selection.\n" - + "Ctrl-Left Move the cursor by words. Clear the selection.\n" - + "Ctrl-Shift-Left Move the cursor by words. Extend the selection.\n" - + "Right or Ctrl-f Right bindings are analogous to Left bindings.\n" - + "Alt-b or Alt Same as Ctrl-Left, Ctrl-Right.\n" - + "Up or Ctrl-p Move the cursor up one line. Clear the selection.\n" - + "Ctrl-Up Move the cursor by paragraph which are group of lines separated by a blank line.\n" - + "Ctrl-Shift-Up Move the cursor by paragraph. Extend selection.\n" - + "Down or Ctrl-n All Down bindings are analogous to Up bindings.\n" - + "PgUp, PgDn Move the cursor by one screen. Clear the selection.\n" - + "Shift-PgUp, Move the cursor by one screen. Extend the selection.\n" - + "Shift-PgDn\n" - + "Home or Ctrl-a Move the cursor to line start. Clear the selection.\n" - + "Shift-Home Move the cursor to line start. Extend the selection.\n" - + "End or Ctrl-e Move the cursor to line end. Clear the selection.\n" - + "Shift-End Move the cursor to line end. Extend the selection.\n" - + "Ctrl-Home Move the cursor to the beginning of text. Clear the selection.\n" - + "Ctrl-End Move the cursor to the beginning of text. Extend the selection.\n" - + "Ctrl-/ Select everything in the text widget.\n" - + "Ctrl-\\ Clear the selection.\n" - + "Delete Delete the selection, if any. Otherwise delete the character to the right of the cursor.\n" - + "Backspace or Ctrl-h Delete the selection, if any. Otherwise delete the character to the left of the cursor.\n" - + "Ctrl-d Delete character to the right of the cursor.\n" - + "Alt-d Delete word to the right of the cursor.\n" - + "Ctrl-k Delete from cursor to the end of the line. If you are at the end of the line, delete the newline\n" - + " character.\n" - + "Ctrl-o Insert a newline but do not advance the cursor.\n" - + "Alt-Delete Delete the word to the left of the cursor.\n" - + "Ctrl-t Transpose the characters on either side of the cursor."; - String description = "Key Bindings"; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - text); - usageDlg.open(); + if (mustCreate(keyBindingUsageDlg)) { + String description = "Key Bindings"; + String helpText = "Ctrl-u Undo changes.\n" + + "Ctrl-r Redo changes.\n" + + "Insert Toggles insert/overwrite mode.\n" + + "Any-Key Insert normal printing characters.\n" + + "Button1 Sets the insert point, clear the selection, set focus.\n" + + "Ctrl-Button1 Set the insert point without affecting the selection.\n" + + "Button1-Motion Sweep out a selection from the insert point.\n" + + "Double-Button1 Select the word under the mouse.\n" + + "Triple-Button1 Select the line under the mouse.\n" + + "Shift-Button1 Adjust the end of selection closest to the mouse.\n" + + "Shift-Button1-Motion Continue to adjust the selection.\n" + + "Button2 Paste the selection, or set the scrolling anchor.\n" + + "Button2-Motion Scroll the window.\n" + + "Left or Ctrl-b Move the cursor left one character. Clear selection.\n" + + "Shift-Left Move the cursor and extend the selection.\n" + + "Ctrl-Left Move the cursor by words. Clear the selection.\n" + + "Ctrl-Shift-Left Move the cursor by words. Extend the selection.\n" + + "Right or Ctrl-f Right bindings are analogous to Left bindings.\n" + + "Alt-b or Alt Same as Ctrl-Left, Ctrl-Right.\n" + + "Up or Ctrl-p Move the cursor up one line. Clear the selection.\n" + + "Ctrl-Up Move the cursor by paragraph which are group of lines separated by a blank line.\n" + + "Ctrl-Shift-Up Move the cursor by paragraph. Extend selection.\n" + + "Down or Ctrl-n All Down bindings are analogous to Up bindings.\n" + + "PgUp, PgDn Move the cursor by one screen. Clear the selection.\n" + + "Shift-PgUp, Move the cursor by one screen. Extend the selection.\n" + + "Shift-PgDn\n" + + "Home or Ctrl-a Move the cursor to line start. Clear the selection.\n" + + "Shift-Home Move the cursor to line start. Extend the selection.\n" + + "End or Ctrl-e Move the cursor to line end. Clear the selection.\n" + + "Shift-End Move the cursor to line end. Extend the selection.\n" + + "Ctrl-Home Move the cursor to the beginning of text. Clear the selection.\n" + + "Ctrl-End Move the cursor to the beginning of text. Extend the selection.\n" + + "Ctrl-/ Select everything in the text widget.\n" + + "Ctrl-\\ Clear the selection.\n" + + "Delete Delete the selection, if any. Otherwise delete the character to the right of the cursor.\n" + + "Backspace or Ctrl-h Delete the selection, if any. Otherwise delete the character to the left of the cursor.\n" + + "Ctrl-d Delete character to the right of the cursor.\n" + + "Alt-d Delete word to the right of the cursor.\n" + + "Ctrl-k Delete from cursor to the end of the line. If you are at the end of the line, delete the newline\n" + + " character.\n" + + "Ctrl-o Insert a newline but do not advance the cursor.\n" + + "Alt-Delete Delete the word to the left of the cursor.\n" + + "Ctrl-t Transpose the characters on either side of the cursor."; + keyBindingUsageDlg = new HelpUsageDlg(shell, description, + helpText); + keyBindingUsageDlg.open(); + } else { + keyBindingUsageDlg.bringToTop(); + } } }); @@ -1360,101 +1411,104 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, usageMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String text = "This is a text editor specialized for composing and checking TAFs.\n" - + "\n" - + "The dialog consists of two areas. The top part is for viewing and\n" - + "editing TAFs, the bottom part displays guidance data.\n" - + "\n" - + "The text editor consists of 4 independent pages. Each one displays WMO\n" - + "header. The 'Rtn', ..., 'Cor' toggles change forecast type. Use\n" - + "'Clear' button to clear the text window. The 'Tools' combo box\n" - + "displays list of site-specific utilities to modify the forecast.\n" - + "\n" - + "Menus:\n" - + " Most of the items are relevant when the 'Editor' tab is selected. \n" - + " File:\n" - + " Print - call print dialog\n" - + " Clear Errors - clears error tags set by the formatting \n" - + " (quality check) action. Can be used to force \n" - + " transmission of forecasts that did not pass\n" - + " the Syntax check. It also reverses colors in\n" - + " the editor window to normal after forecast is\n" - + " sent\n" - + " Update Times - updates issue and valid times\n" - + " Save As - allows to save edited forecast to a file. \n" - + " Restore From - use to restore forecast from a backup file\n" - + " Store in DB - use to store forecast in AWIPS text database\n" - + " Close - closes the editor window\n" - + "\n" - + " Options: \n" - + " Auto Save - toggles auto-save feature\n" - + " Auto Print - toggles automatic printout of sent forecasts\n" - + " Update Times on Format - if selected, the issue and valid times in \n" - + " the forecast are updated before quality control\n" - + " checks\n" - + " Send in Collective - Toggles collective versus split bulletin\n" - + " transmission. Intended for OCONUS sites only.\n" - + "\n" - + " Edit:\n" - + " Provides the usual editing functions (i.e. Cut, Copy, Paste, \n" - + " and Find/Replace)\n" - + "\n" - + "TAF editor area:\n" - + "\n" - + "Buttons:\n" - + " Load: invokes forecast selection dialog. Bulletin (or product) \n" - + " is selected from 'Bulletins' menu. To load bulletin from \n" - + " previously saved file, set the 'From file' toggle.\n" - + " Otherwise the forecasts will be loaded depending on \n" - + " the 'Load Order' selecton:\n" - + " Latest: first an attempt is made to access the most \n" - + " recent previous forecast. If one cannot be found,\n" - + " a template file is loaded.\n" - + " Merge: loads previous forecast, then appends template.\n" - + " The intent is to allow phrases such as\n" - + " AMD NOT SKED AFT D1HHZ.\n" - + " Template: loads forecasts from template file.\n" - + " 'Forecast Type' selection is used to initialize WMO\n" - + " header (DDHHMM and BBB) fields. These fields will be \n" - + " updated when forecast is sent. \n" - + "\n" - + " Syntax: Performs syntax check and assures proper indentation \n" - + " and maximum line length. If Syntax Check fails the forecast, \n" - + " the problem areas will be highlighted. The color \n" - + " corresponds to the severity of the problem. Red means \n" - + " the forecast could not be parsed sucessfully. Orange \n" - + " means error according to NWSI 10-813. Green is a warning.\n" - + "\n" - + " QC: Performs selected quality control checks\n" - + "\n" - + " Send: Splits the bulletin into separate files, one per site, \n" - + " which are written to directory 'xmit/pending'. \n" - + " The transmission program running on the data server is \n" - + " responsible for actual transmission.\n" - + " The program will check whether a regular forecast is \n" - + " sent within the transmission time window. If not, an \n" - + " error dialog is displayed.\n" - + "\n" - + " Save: Stores bulletin as a work TAF in a file\n" - + "\n" - + " Restore: Restores bulletin from the work file\n" - + "\n" - + "Toggles:\n" - + " Insert - toggles insert/overwrite mode\n" - + " Wrap - if selected, the line is folded when its length\n" - + " exceedes window width. Has no effect on \n" - + " the final format.\n" - + "\n" - + "Viewer area:\n" - + " Use 'Site ID' combo box to view site data from the list of \n" - + " currently monitored sites. \n" - + " Select page in the notebook for a specific data source. The list \n" - + " of data sources is configurable. A set of display options is \n" - + " available, depending on the data source."; - String description = "Usage"; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - text); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "Usage"; + String helpText = "This is a text editor specialized for composing and checking TAFs.\n" + + "\n" + + "The dialog consists of two areas. The top part is for viewing and\n" + + "editing TAFs, the bottom part displays guidance data.\n" + + "\n" + + "The text editor consists of 4 independent pages. Each one displays WMO\n" + + "header. The 'Rtn', ..., 'Cor' toggles change forecast type. Use\n" + + "'Clear' button to clear the text window. The 'Tools' combo box\n" + + "displays list of site-specific utilities to modify the forecast.\n" + + "\n" + + "Menus:\n" + + " Most of the items are relevant when the 'Editor' tab is selected. \n" + + " File:\n" + + " Print - call print dialog\n" + + " Clear Errors - clears error tags set by the formatting \n" + + " (quality check) action. Can be used to force \n" + + " transmission of forecasts that did not pass\n" + + " the Syntax check. It also reverses colors in\n" + + " the editor window to normal after forecast is\n" + + " sent\n" + + " Update Times - updates issue and valid times\n" + + " Save As - allows to save edited forecast to a file. \n" + + " Restore From - use to restore forecast from a backup file\n" + + " Store in DB - use to store forecast in AWIPS text database\n" + + " Close - closes the editor window\n" + + "\n" + + " Options: \n" + + " Auto Save - toggles auto-save feature\n" + + " Auto Print - toggles automatic printout of sent forecasts\n" + + " Update Times on Format - if selected, the issue and valid times in \n" + + " the forecast are updated before quality control\n" + + " checks\n" + + " Send in Collective - Toggles collective versus split bulletin\n" + + " transmission. Intended for OCONUS sites only.\n" + + "\n" + + " Edit:\n" + + " Provides the usual editing functions (i.e. Cut, Copy, Paste, \n" + + " and Find/Replace)\n" + + "\n" + + "TAF editor area:\n" + + "\n" + + "Buttons:\n" + + " Load: invokes forecast selection dialog. Bulletin (or product) \n" + + " is selected from 'Bulletins' menu. To load bulletin from \n" + + " previously saved file, set the 'From file' toggle.\n" + + " Otherwise the forecasts will be loaded depending on \n" + + " the 'Load Order' selecton:\n" + + " Latest: first an attempt is made to access the most \n" + + " recent previous forecast. If one cannot be found,\n" + + " a template file is loaded.\n" + + " Merge: loads previous forecast, then appends template.\n" + + " The intent is to allow phrases such as\n" + + " AMD NOT SKED AFT D1HHZ.\n" + + " Template: loads forecasts from template file.\n" + + " 'Forecast Type' selection is used to initialize WMO\n" + + " header (DDHHMM and BBB) fields. These fields will be \n" + + " updated when forecast is sent. \n" + + "\n" + + " Syntax: Performs syntax check and assures proper indentation \n" + + " and maximum line length. If Syntax Check fails the forecast, \n" + + " the problem areas will be highlighted. The color \n" + + " corresponds to the severity of the problem. Red means \n" + + " the forecast could not be parsed sucessfully. Orange \n" + + " means error according to NWSI 10-813. Green is a warning.\n" + + "\n" + + " QC: Performs selected quality control checks\n" + + "\n" + + " Send: Splits the bulletin into separate files, one per site, \n" + + " which are written to directory 'xmit/pending'. \n" + + " The transmission program running on the data server is \n" + + " responsible for actual transmission.\n" + + " The program will check whether a regular forecast is \n" + + " sent within the transmission time window. If not, an \n" + + " error dialog is displayed.\n" + + "\n" + + " Save: Stores bulletin as a work TAF in a file\n" + + "\n" + + " Restore: Restores bulletin from the work file\n" + + "\n" + + "Toggles:\n" + + " Insert - toggles insert/overwrite mode\n" + + " Wrap - if selected, the line is folded when its length\n" + + " exceedes window width. Has no effect on \n" + + " the final format.\n" + + "\n" + + "Viewer area:\n" + + " Use 'Site ID' combo box to view site data from the list of \n" + + " currently monitored sites. \n" + + " Select page in the notebook for a specific data source. The list \n" + + " of data sources is configurable. A set of display options is \n" + + " available, depending on the data source."; + usageDlg = new HelpUsageDlg(shell, description, helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } @@ -1654,9 +1708,12 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, loadBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - LoaderDialog loadDlg = new LoaderDialog(shell, - TafViewerEditorDlg.this); - loadDlg.open(); + if (mustCreate(loadDlg)) { + loadDlg = new LoaderDialog(shell, TafViewerEditorDlg.this); + loadDlg.open(); + } else { + loadDlg.bringToTop(); + } } }); @@ -1752,14 +1809,26 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, printForecast(editorTafTabComp.getTextEditorControl() .getText()); } - SendDialog sendDlg = new SendDialog(shell, - editorTafTabComp, msgStatComp, sendCollectMI - .getSelection()); - sendDlg.open(); - // sendDlg sets the "taf sent" field only - if (editorTafTabComp.isTafSent()) { - editorTafTabComp.updateTafSent(true); + + if (mustCreate(sendDlg)) { + sendDlg = new SendDialog(shell, editorTafTabComp, + msgStatComp, sendCollectMI.getSelection()); + sendDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + // sendDlg sets the "taf sent" field only + if (editorTafTabComp.isTafSent()) { + editorTafTabComp.updateTafSent(true); + } + sendDlg = null; + } + }); + sendDlg.open(); + } else { + sendDlg.bringToTop(); } + } else { putMessageToForecaster("Cannot send forecast: Press Syntax before transmission"); } @@ -2491,6 +2560,7 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, */ @Override public void populateViewerStation(String theStation) { + checkDlg(); siteIdCbo.select(siteIdCbo.indexOf(theStation)); } @@ -2684,7 +2754,8 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, private boolean checkSyntaxInEditor(boolean doLogMessage) { // Get the content of the Taf Editor. // Assume editorTafTabComp is for the active tab. - String in = (editorTafTabComp.getTextEditorControl().getText()); + // DR15477: trim blank lines before Syntax Checking + String in = (editorTafTabComp.getTextEditorControl().getText().trim()); // Declare variables for processing the editor's contents. boolean errorInTaf = false; int idx1 = 0; @@ -3265,33 +3336,40 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, } } - String tafText = editorTafTabComp.getTextEditorControl().getText(); - List sitesInTaf = getSitesInTaf(tafText); - HashMap> qcMap = null; - if (doQcDialog) { - QcDialog qcDlg = new QcDialog(shell, savedQcItems); - Object o = qcDlg.open(); - if (o == null) { - return; - } - HashMap qcItems = (HashMap) o; - qcMap = new HashMap>(); - for (String site : sitesInTaf) { - qcMap.put(site, qcItems); + if (mustCreate(qcDlg)) { + qcDlg = new QcDialog(shell, savedQcItems); + qcDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + String tafText = editorTafTabComp + .getTextEditorControl().getText(); + List sitesInTaf = getSitesInTaf(tafText); + if (returnValue instanceof HashMap) { + HashMap qcItems = (HashMap) returnValue; + HashMap> qcMap = new HashMap>(); + for (String site : sitesInTaf) { + qcMap.put(site, qcItems); + } + qcCheck(qcMap); + } + } + }); + qcDlg.open(); + } else { + qcDlg.bringToTop(); } } else { + String tafText = editorTafTabComp.getTextEditorControl().getText(); + List sitesInTaf = getSitesInTaf(tafText); + HashMap> qcMap = null; qcMap = new HashMap>(); for (String site : sitesInTaf) { qcMap.put(site, null); } - } - try { - setWaitCursor(true); qcCheck(qcMap); - } finally { - setWaitCursor(false); } } @@ -3301,6 +3379,7 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, @SuppressWarnings("unchecked") private void qcCheck(HashMap> qcMap) { try { + setWaitCursor(true); ITafSiteConfig config = TafSiteConfigFactory.getInstance(); ArrayList tafs = new ArrayList(); HashMap siteInfo = new HashMap(); @@ -3538,6 +3617,8 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, setMessageStatusError("An Error occured while performing the QC check."); } catch (IOException e) { setMessageStatusError("An Error occured while performing the QC check."); + } finally { + setWaitCursor(false); } } @@ -3646,7 +3727,7 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, sb.append(TafUtil.safeFormatTaf(t, showHeaders)); sb.append("\n"); } - }//System.out.println("TEMPO "+sb.toString().indexOf("TEMPO")+"/"+sb.toString().indexOf("\n",72)); + }// System.out.println("TEMPO "+sb.toString().indexOf("TEMPO")+"/"+sb.toString().indexOf("\n",72)); tafViewerStTxt.setText(sb.toString()); hightlightTAF(); @@ -3675,10 +3756,10 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, } ResourceConfigMgr configMgr = ResourceConfigMgr.getInstance(); - String taf = tafViewerStTxt.getText(); + String taf = tafViewerStTxt.getText(); int offset = taf.indexOf("TAF"); - if ( showHeadersChk.getSelection() ) { - offset = taf.indexOf("TAF", offset + 3); + if (showHeadersChk.getSelection()) { + offset = taf.indexOf("TAF", offset + 3); } try { int end = taf.indexOf("TAF", offset + 3); @@ -3686,90 +3767,109 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, taf = taf.substring(offset, end); } else { taf = taf.substring(offset); - } + } } catch (IndexOutOfBoundsException ex) { // Assume no TAF in the viewer return; } - - Map alertTimeMap=TafMonitorDlg.getCurrentAlertTimeMap(stationName);// DR 14570 + + Map alertTimeMap = TafMonitorDlg + .getCurrentAlertTimeMap(stationName);// DR 14570 // 20120712 for TEMPO String TEMPO_TXT = "TEMPO"; - if(taf.contains(TEMPO_TXT)){ + if (taf.contains(TEMPO_TXT)) { - Map tempoMap = TafMonitorDlg.getCurrentTempoMap(stationName);//20120711 - if(tempoMap != null){ - int tempoStart = taf.indexOf(TEMPO_TXT); - int tempoEnd = taf.indexOf(TafUtil.LINE_BREAK, tempoStart);//end of the TEMPO line + Map tempoMap = TafMonitorDlg + .getCurrentTempoMap(stationName);// 20120711 + if (tempoMap != null) { + int tempoStart = taf.indexOf(TEMPO_TXT); + int tempoEnd = taf.indexOf(TafUtil.LINE_BREAK, tempoStart);// end + // of + // the + // TEMPO + // line - StringBuilder str = new StringBuilder(" "); + StringBuilder str = new StringBuilder(" "); - for (String alertKey : tempoMap.keySet()) { - //System.out.println("2___alertKey: "+ alertKey); - for (String value : tempoMap.get(alertKey)) { - //System.out.println("3___value: "+ value); - str.setLength(1); - str.append(value); - int len = str.length(); - str.append(" "); + for (String alertKey : tempoMap.keySet()) { + // System.out.println("2___alertKey: "+ alertKey); + for (String value : tempoMap.get(alertKey)) { + // System.out.println("3___value: "+ value); + str.setLength(1); + str.append(value); + int len = str.length(); + str.append(" "); - int startIndex = taf.indexOf(str.toString(),tempoStart);// for tempo only + int startIndex = taf + .indexOf(str.toString(), tempoStart);// for + // tempo + // only - if (startIndex < 0) { - str.setLength(len); - str.append("\n"); - startIndex = taf.indexOf(str.toString()); - } - if (startIndex >= 0 /*within tempo line*/&& startIndex= 0 /* within tempo line */ + && startIndex < tempoEnd) { + StyleRange sr = new StyleRange(offset + startIndex + + 1, len - 1, null, + configMgr.getViwerAlertColor()); - tafViewerStTxt.setStyleRange(sr); - } - } - } - } + tafViewerStTxt.setStyleRange(sr); + } + } + } + } }// END 20120712 for TEMPO - StringBuilder str = new StringBuilder(" "); for (String alertKey : alertMap.keySet()) { - for (String value : alertMap.get(alertKey)) { - str.setLength(1); - str.append(value); - int len = str.length(); - str.append(" "); - String time = alertTimeMap.get(alertKey);// DR 14570 - int idx=taf.indexOf(time);// DR 14570 - int startIndex = taf.indexOf(str.toString(),idx);// DR 14570: highlight after the correct time group - int endIndex = taf.indexOf(TafUtil.LINE_BREAK, idx);// DR 14570: a line ends with a line_break - if (startIndex < 0) { - str.setLength(len); - str.append("\n"); - startIndex = taf.indexOf(str.toString()); - if (startIndex < 0) { - str.setLength(len); - str.append("="); - startIndex = taf.indexOf(str.toString()); - } - } + for (String value : alertMap.get(alertKey)) { + str.setLength(1); + str.append(value); + int len = str.length(); + str.append(" "); + String time = alertTimeMap.get(alertKey);// DR 14570 + int idx = taf.indexOf(time);// DR 14570 + int startIndex = taf.indexOf(str.toString(), idx);// DR 14570: + // highlight + // after the + // correct + // time group + int endIndex = taf.indexOf(TafUtil.LINE_BREAK, idx);// DR 14570: + // a line + // ends with + // a + // line_break + if (startIndex < 0) { + str.setLength(len); + str.append("\n"); + startIndex = taf.indexOf(str.toString()); + if (startIndex < 0) { + str.setLength(len); + str.append("="); + startIndex = taf.indexOf(str.toString()); + } + } - if (startIndex >= 0 /*within the same line*/&& startIndex < endIndex) { - StyleRange sr = new StyleRange(offset + startIndex + 1, - len - 1, null, configMgr.getViwerAlertColor()); + if (startIndex >= 0 /* within the same line */ + && startIndex < endIndex) { + StyleRange sr = new StyleRange(offset + startIndex + 1, + len - 1, null, configMgr.getViwerAlertColor()); - tafViewerStTxt.setStyleRange(sr); - } else { - // Should not get here. The first TAF in the viewer and the - // values in the alertMap should both be from the latest - // TAF. This indicates a program bug. - System.out.println("highlightTAF unable to find: \"" - + str.toString() + "\" in the first TAF"); - } + tafViewerStTxt.setStyleRange(sr); + } else { + // Should not get here. The first TAF in the viewer and the + // values in the alertMap should both be from the latest + // TAF. This indicates a program bug. + System.out.println("highlightTAF unable to find: \"" + + str.toString() + "\" in the first TAF"); + } - } + } } } @@ -4166,6 +4266,18 @@ public class TafViewerEditorDlg extends Dialog implements ITafSettable, syntaxErrorLevel = 0; } + /** + * This dialog is created but not immediately displayed thus components have + * not been created. Some of the ITafSettable methods attempt to access + * components prior to showing the dialog. This check must be done to force + * the compoents creation. + */ + private final void checkDlg() { + if (shell == null) { + open(); + } + } + /** * Internal class to up date the Viewer tab highlights when the Metar tab * selections change what should be highlighted. diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/SendDialog.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/SendDialog.java index 4866319bec..1345a71b6b 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/SendDialog.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/SendDialog.java @@ -69,6 +69,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 4/15/2009 1982 grichard Provide feedback when saving a working TAF. * 12/08/2011 11745 rferrel Updated header time to transmission time. * 08AUG2012 15613 zhao Determine proper BBB for transmission + * 09OCT2012 1229 rferrel Make dialog non-blocking. * * * @@ -146,7 +147,7 @@ public class SendDialog extends CaveSWTDialog { public SendDialog(Shell parent, EditorTafTabComp tabComp, IStatusSettable msgStatComp, boolean sendCollective) { super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, - CAVE.PERSPECTIVE_INDEPENDENT); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK); setText("AvnFPS Send"); this.tabComp = tabComp; @@ -365,7 +366,7 @@ public class SendDialog extends CaveSWTDialog { String siteWmoId = tabComp.getWmoId(); // WMO Site String siteNode = null; - //java.util.List stationIds = new ArrayList(); + // java.util.List stationIds = new ArrayList(); ArrayList tafs = new ArrayList(); ArrayList updatedTafs = new ArrayList(); @@ -407,11 +408,10 @@ public class SendDialog extends CaveSWTDialog { * If "AAX" or "CCX" or "RRX", determine BBB for transmission */ String xmitBbb = bbb; - if ( bbb.equals("AAX") || bbb.equals("CCX") || bbb.equals("RRX") ) { - String type = bbb.substring(0, 2); - xmitBbb = getXmitBbb( type, siteId); + if (bbb.equals("AAX") || bbb.equals("CCX") || bbb.equals("RRX")) { + String type = bbb.substring(0, 2); + xmitBbb = getXmitBbb(type, siteId); } - // Update Header Time to transmission time. tafText = TIMESTAMP_PATTERN.matcher(tafText).replaceFirst( @@ -467,40 +467,41 @@ public class SendDialog extends CaveSWTDialog { shell.dispose(); } - @SuppressWarnings("unchecked") - private String getXmitBbb(String type, String siteId) { - - try { - TafQueueRequest request = new TafQueueRequest(); - request.setType(Type.GET_LIST); - request.setState(TafQueueRecord.TafQueueState.SENT); - ServerResponse> response = (ServerResponse>) ThriftClient.sendRequest(request); - java.util.List payload = response.getPayload(); - String [] records = (String []) payload.toArray(new String[0]); - int numRecords = records.length; - for ( int i = numRecords-1; i >=0; i-- ) { - if ( records[i].contains(siteId) ) { - String [] texts = records[i].split("-"); - String bbb = texts[texts.length-2]; - if ( bbb.equals(" ") ) { - return type+"A"; - } - if ( bbb.subSequence(0, 2).equals(type) ) { - char[] newX = new char[] { bbb.charAt(2) }; - if ( newX[0] == 'X' ) { - newX[0] = 'A'; - } else { - newX[0]++; - } - return type + new String( newX ); - } - } - } - } catch (VizException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return type + "A"; - } + @SuppressWarnings("unchecked") + private String getXmitBbb(String type, String siteId) { + + try { + TafQueueRequest request = new TafQueueRequest(); + request.setType(Type.GET_LIST); + request.setState(TafQueueRecord.TafQueueState.SENT); + ServerResponse> response = (ServerResponse>) ThriftClient + .sendRequest(request); + java.util.List payload = response.getPayload(); + String[] records = (String[]) payload.toArray(new String[0]); + int numRecords = records.length; + for (int i = numRecords - 1; i >= 0; i--) { + if (records[i].contains(siteId)) { + String[] texts = records[i].split("-"); + String bbb = texts[texts.length - 2]; + if (bbb.equals(" ")) { + return type + "A"; + } + if (bbb.subSequence(0, 2).equals(type)) { + char[] newX = new char[] { bbb.charAt(2) }; + if (newX[0] == 'X') { + newX[0] = 'A'; + } else { + newX[0]++; + } + return type + new String(newX); + } + } + } + } catch (VizException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return type + "A"; + } } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/TafMonitorDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/TafMonitorDlg.java index 77186428b0..61a50451b5 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/TafMonitorDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/TafMonitorDlg.java @@ -88,6 +88,7 @@ import com.raytheon.viz.avnconfig.HelpUsageDlg; import com.raytheon.viz.avnconfig.IStatusSettable; import com.raytheon.viz.avnconfig.MessageStatusComp; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * TafMonitorDlg (Terminal Aerodome Forecast Monitor Dialog) class. @@ -128,8 +129,16 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 10/27/2010 7383 rferrel Save changed blink state in configMgr. * 3/14/2011 8588 rferrel Allow monitoring multiple products. * 11/29/2011 11612 rferrel Added observers to update viewer tabs. - * 20JUL2012 14570 gzhang/zhao Added methods for highlighting in TAF viewer - * + * 20JUL2012 14570 gzhang/zhao Added methods for highlighting in TAF viewer + * 10/02/2012 1229 rferrel Changes to work with non-blocking WeatherPlotDialog. + * 10/04/2012 1229 rferrel Changes for non-blocking ClimateMenuDlg. + * 10/09/2012 1229 rferrel Made dialog non-blocking. + * 10/10/2012 1229 rferrel Changes for non-blocking ResourceEditorDlg. + * 10/10/2012 1229 rferrel Changes for non-blocking TransmissionQueueDlg. + * 10/10/2012 1229 jkorman Changes for AlertDialog to support non-blocking. + * 10/11/2012 1229 jkorman Changes for BackupDialog to support non-blocking. + * 10/11/2012 1229 rferrel Changes for non-blocking TafViewerEditorDlg. + * 10/15/2012 1229 rferrel Changes for non-blocking HelpUsageDlg. * * * @author grichard @@ -187,6 +196,16 @@ public class TafMonitorDlg extends CaveSWTDialog { */ private ResourceEditorDlg resDlg; + /** + * + */ + private BackupDialog backupDialog; + + /** + * Alert configuration dialog. + */ + private AlertDialog alertDialog; + /** * Resource configuration manager. */ @@ -235,6 +254,12 @@ public class TafMonitorDlg extends CaveSWTDialog { private List productDisplayList; + private ClimateMenuDlg climateMenuDlg; + + private TransmissionQueueDlg tqDlg; + + private HelpUsageDlg usageDlg; + /** * Constructor. * @@ -247,7 +272,7 @@ public class TafMonitorDlg extends CaveSWTDialog { List productDispalyList) { super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT - | CAVE.INDEPENDENT_SHELL); + | CAVE.INDEPENDENT_SHELL | CAVE.DO_NOT_BLOCK); setText("AvnFPS Monitor"); this.stationList = stationList; @@ -373,7 +398,23 @@ public class TafMonitorDlg extends CaveSWTDialog { configMgr = ResourceConfigMgr.getInstance(); - tveDlg = new TafViewerEditorDlg(shell, false, stationList); + boolean transientDialog = configMgr + .getDataAsBoolean(ResourceTag.TransientDialogs); + + /* + * Check the transient dialog setting. If the transient dialog is true + * then the parent dialog cannot be display on top of this dialog. If + * the transient is false the parent dialog can be displayed on top of + * this dialog. + */ + if (transientDialog == true) { + // Parent dialog cannot be displayed on top of this dialog + tveDlg = new TafViewerEditorDlg(shell, stationList, CAVE.NONE); + } else { + // Parent dialog can be displayed on top of this dialog. + tveDlg = new TafViewerEditorDlg(shell, stationList, + CAVE.INDEPENDENT_SHELL); + } createMenus(); createButtonsComposite(); @@ -480,13 +521,11 @@ public class TafMonitorDlg extends CaveSWTDialog { setupMenuItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - if (resDlg == null) { + if (mustCreate(resDlg)) { resDlg = new ResourceEditorDlg(shell); resDlg.open(); - - resDlg = null; } else { - resDlg.showDialog(); + resDlg.bringToTop(); } } }); @@ -499,8 +538,14 @@ public class TafMonitorDlg extends CaveSWTDialog { alertMenuItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - AlertDialog alertDialog = new AlertDialog(shell); - alertDialog.open(); + // Do we need to create a new dialog? + if (mustCreate(alertDialog)) { + alertDialog = new AlertDialog(shell); + alertDialog.open(); + } else { + // No, so use the existing dialog. + alertDialog.bringToTop(); + } } }); @@ -560,11 +605,15 @@ public class TafMonitorDlg extends CaveSWTDialog { usageMenuItem.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String text = "This is the main interface to AvnFPS.\n\nAll menus and buttons have associated help. When the mouse cursor is\nplaced over context sensitive help's 'hot spot', a 'balloon' message\nwill appear.\n\nSuccessful completion of a task is usually shown in a message window\nat the bottom of the main GUI or dialogs. Important system messages\nwill be shown there also. When an error occurs, a warning/error\ndialog will pop up which requires acknowledgment before one can\ninteract further with the application.\n\nMenu options:\n File:\n Check Now: Forces check of all TAFs and transmission\n status.\n Restart: Restarts the program, using current \n configuration\n Quit: Terminates the application.\n\n Options:\n Setup: Calls setup configuration dialog which \n allows for setting configuration \n resources: fonts, colors and values that \n affect program behavior.\n Alert: Used to select alert criteria 'on-the-fly' \n when the program detects a condition \n requiring forecaster's action.\n Blink: If selected, station id button will blink\n when new notification arrives\n Help:\n Used to provide version number and location of AvnFPS\n documentation web sites and this help window.\n\nTAF Editor: Starts TAF editor\nClimate: Displays Climate GUI\nPlot: Displays Weather Plot GUI\nBackup: Invokes list dialog allowing selection of products to \n monitor.\n\nServer status indicators. green means server is running, red indicates\nserious misconfiguration of a server(s) or a large (> 1 minute) clock\ndifference (skew) between px2f and workstations.\n\nDATA-xxx: Provides data to the GUI. The monitor will not function \n without this server running.\n \nINGEST-xxx: Data ingest server. You may still issue forecasts when \n this server is not running, although program will not update\n with new information as it arrives.\n \nXMIT-xxx: Forecast transmission server\n\nQueue: Background color indicates whether last issued forecast was \n successfully transmitted. The button invokes transmission queue\n control dialog.\n\nProduct monitoring window consists of the following units:\n\nSite Id button: used to invoke TAF editor. Its background color is used \n to indicate problem with data. A new alert will cause the button \n to blink. Press right mouse button to stop blinking.\n \nLast TAF and METAR time labels: those display issue time. When either\n one is late, the corresponding label is highlighted. If there \n is no TAF, or TAF is older than 24 hours, time is set to None \n for both TAF and MTR. \n\nFor each monitored data source there is a set of labels indicating \nwhether a particular weather element is in agreement with the forecast.\n\nThe following data sources are currently available:\n\nCurrent Observation: Most recent observation\nNhr Persistence: Most recent observation compared to forecast N hours \n ahead\nltg: Real-time CG lightning strikes\nrltg: Radar-based 3 hour lightning probability forecast\nNDFD Grids: GFE generated grids\nllws: Low Level Wind Shear, based on METAR and radars', profilers'\n or aircrafts' vertical wind profile data\nccfp: Collaborative Convective Forecast Product from AWC\n\nDepending on configuration, some of the above can be accessed through \npopup menus associated with the data source heading labels. Use right \nmouse button to display the menu. Not all labels have an associated \nmenu.\n\nBy pointing mouse cursor at a particular data source you will get \nthe forecast, that data values and list of violated rules, if any,\ndisplayed in a balloon message.\n\nOptional shortcut buttons to the TAF Editor.\nAmd: call TAF editor initialized for amended TAF for selected site.\nRtd: call TAF editor initialized for delayed TAF for selected site.\nCor: call TAF editor initialized for corrected TAF for selected site."; - String description = "Usage"; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - text); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String descrription = "Usage"; + + String helpText = "This is the main interface to AvnFPS.\n\nAll menus and buttons have associated help. When the mouse cursor is\nplaced over context sensitive help's 'hot spot', a 'balloon' message\nwill appear.\n\nSuccessful completion of a task is usually shown in a message window\nat the bottom of the main GUI or dialogs. Important system messages\nwill be shown there also. When an error occurs, a warning/error\ndialog will pop up which requires acknowledgment before one can\ninteract further with the application.\n\nMenu options:\n File:\n Check Now: Forces check of all TAFs and transmission\n status.\n Restart: Restarts the program, using current \n configuration\n Quit: Terminates the application.\n\n Options:\n Setup: Calls setup configuration dialog which \n allows for setting configuration \n resources: fonts, colors and values that \n affect program behavior.\n Alert: Used to select alert criteria 'on-the-fly' \n when the program detects a condition \n requiring forecaster's action.\n Blink: If selected, station id button will blink\n when new notification arrives\n Help:\n Used to provide version number and location of AvnFPS\n documentation web sites and this help window.\n\nTAF Editor: Starts TAF editor\nClimate: Displays Climate GUI\nPlot: Displays Weather Plot GUI\nBackup: Invokes list dialog allowing selection of products to \n monitor.\n\nServer status indicators. green means server is running, red indicates\nserious misconfiguration of a server(s) or a large (> 1 minute) clock\ndifference (skew) between px2f and workstations.\n\nDATA-xxx: Provides data to the GUI. The monitor will not function \n without this server running.\n \nINGEST-xxx: Data ingest server. You may still issue forecasts when \n this server is not running, although program will not update\n with new information as it arrives.\n \nXMIT-xxx: Forecast transmission server\n\nQueue: Background color indicates whether last issued forecast was \n successfully transmitted. The button invokes transmission queue\n control dialog.\n\nProduct monitoring window consists of the following units:\n\nSite Id button: used to invoke TAF editor. Its background color is used \n to indicate problem with data. A new alert will cause the button \n to blink. Press right mouse button to stop blinking.\n \nLast TAF and METAR time labels: those display issue time. When either\n one is late, the corresponding label is highlighted. If there \n is no TAF, or TAF is older than 24 hours, time is set to None \n for both TAF and MTR. \n\nFor each monitored data source there is a set of labels indicating \nwhether a particular weather element is in agreement with the forecast.\n\nThe following data sources are currently available:\n\nCurrent Observation: Most recent observation\nNhr Persistence: Most recent observation compared to forecast N hours \n ahead\nltg: Real-time CG lightning strikes\nrltg: Radar-based 3 hour lightning probability forecast\nNDFD Grids: GFE generated grids\nllws: Low Level Wind Shear, based on METAR and radars', profilers'\n or aircrafts' vertical wind profile data\nccfp: Collaborative Convective Forecast Product from AWC\n\nDepending on configuration, some of the above can be accessed through \npopup menus associated with the data source heading labels. Use right \nmouse button to display the menu. Not all labels have an associated \nmenu.\n\nBy pointing mouse cursor at a particular data source you will get \nthe forecast, that data values and list of violated rules, if any,\ndisplayed in a balloon message.\n\nOptional shortcut buttons to the TAF Editor.\nAmd: call TAF editor initialized for amended TAF for selected site.\nRtd: call TAF editor initialized for delayed TAF for selected site.\nCor: call TAF editor initialized for corrected TAF for selected site."; + usageDlg = new HelpUsageDlg(shell, descrription, helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } @@ -617,9 +666,13 @@ public class TafMonitorDlg extends CaveSWTDialog { msgTypes[2] = StatusMessageType.TafMonCigVis; msgTypes[3] = StatusMessageType.TafMonCigVisTrend; - ClimateMenuDlg climateMenuDlg = new ClimateMenuDlg(shell, - msgTypes, configMgr.getDefaultBackgroundRGB()); - climateMenuDlg.open(); + if (mustCreate(climateMenuDlg)) { + climateMenuDlg = new ClimateMenuDlg(shell, msgTypes, + configMgr.getDefaultBackgroundRGB()); + climateMenuDlg.open(); + } else { + climateMenuDlg.bringToTop(); + } } }); @@ -632,11 +685,19 @@ public class TafMonitorDlg extends CaveSWTDialog { @Override public void widgetSelected(SelectionEvent event) { - if (avnPlotDlg == null) { + if (mustCreate(avnPlotDlg)) { avnPlotDlg = new WeatherPlotDialog(shell, StatusMessageType.WeatherPlot, stationList); + avnPlotDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + avnPlotDlg = null; + } + }); avnPlotDlg.open(); - avnPlotDlg = null; + } else { + avnPlotDlg.bringToTop(); } } }); @@ -649,9 +710,13 @@ public class TafMonitorDlg extends CaveSWTDialog { backupBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - BackupDialog backup = new BackupDialog(shell, - productDisplayList); - backup.open(); + if (mustCreate(backupDialog)) { + backupDialog = new BackupDialog(shell, productDisplayList); + backupDialog.open(); + } else { + // No, so use the existing dialog. + backupDialog.bringToTop(); + } } }); @@ -664,8 +729,12 @@ public class TafMonitorDlg extends CaveSWTDialog { queueBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - TransmissionQueueDlg tqd = new TransmissionQueueDlg(shell); - tqd.open(); + if (mustCreate(tqDlg)) { + tqDlg = new TransmissionQueueDlg(shell); + tqDlg.open(); + } else { + tqDlg.bringToTop(); + } } }); } @@ -823,7 +892,8 @@ public class TafMonitorDlg extends CaveSWTDialog { } tveDlg.disposeDialog(); - shell.dispose(); + // shell.dispose(); + close(); return true; } @@ -918,10 +988,10 @@ public class TafMonitorDlg extends CaveSWTDialog { public final List getViewerTabList() { return tveDlg.getViewerTabList(); } - - //------------------------- DR 14570: - - public static Map getCurrentAlertTimeMap(String siteID){ + + // ------------------------- DR 14570: + + public static Map getCurrentAlertTimeMap(String siteID) { Map alertTimeMap = null; if (currentDlg != null) { if (currentDlg.getDisplay().isDisposed()) { @@ -936,8 +1006,9 @@ public class TafMonitorDlg extends CaveSWTDialog { } return alertTimeMap; } - //20120711 - public static Map getCurrentTempoMap(String siteID){ + + // 20120711 + public static Map getCurrentTempoMap(String siteID) { Map tempoMap = null; if (currentDlg != null) { if (currentDlg.getDisplay().isDisposed()) { @@ -945,7 +1016,7 @@ public class TafMonitorDlg extends CaveSWTDialog { } else { for (TafSiteComp siteRow : currentDlg.getTafSiteComps()) { if (siteRow.getStationName().equals(siteID)) { - tempoMap= siteRow.getTempoMap(); + tempoMap = siteRow.getTempoMap(); } } } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/resource/ResourceEditorDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/resource/ResourceEditorDlg.java index 8267d55a9c..515bf9b22e 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/resource/ResourceEditorDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/resource/ResourceEditorDlg.java @@ -37,6 +37,23 @@ import org.eclipse.swt.widgets.Shell; import com.raytheon.viz.aviation.AviationDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +/** + * This is a dialog changing the values for the AvnFPS resources. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ *                                     Initial creation
+ * Oct 10, 2012 1229       rferrel     Make dialog non-blocking.
+ * 
+ * 
+ * + * @author rferrel + * @version 1.0 + */ public class ResourceEditorDlg extends CaveSWTDialog implements IResize { private ScrolledComposite scrolledComp; @@ -52,7 +69,8 @@ public class ResourceEditorDlg extends CaveSWTDialog implements IResize { private ResourceEditorHelpDlg helpDlg; public ResourceEditorDlg(Shell parent) { - super(parent, SWT.SHELL_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.SHELL_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("AvnFPS Resource Editor"); } @@ -144,13 +162,11 @@ public class ResourceEditorDlg extends CaveSWTDialog implements IResize { helpBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { - if (helpDlg == null) { + if (mustCreate(helpDlg)) { helpDlg = new ResourceEditorHelpDlg(shell); helpDlg.open(); - - helpDlg = null; } else { - helpDlg.showDialog(); + helpDlg.bringToTop(); } } }); @@ -198,8 +214,4 @@ public class ResourceEditorDlg extends CaveSWTDialog implements IResize { scrolledComp.setMinSize(resourceComp.computeSize(SWT.DEFAULT, SWT.DEFAULT)); } - - public void showDialog() { - shell.setFocus(); - } } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/resource/ResourceEditorHelpDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/resource/ResourceEditorHelpDlg.java index 318353ffed..1f2481f346 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/resource/ResourceEditorHelpDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/resource/ResourceEditorHelpDlg.java @@ -35,6 +35,25 @@ import org.eclipse.swt.widgets.Shell; import com.raytheon.viz.aviation.resource.ResourceConfigMgr.ResourceTag; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +/** + * Display help text for the ResourceEditor dialog within the AvnFPS + * TAFMonitor dialog. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * ************ ********** *********** No previous software history.
+ * Oct 11, 2012 1229       jkorman     Make dialog non-blocking.
+ * 
+ * 
+ * + * @author + * @version 1.0 + */ + public class ResourceEditorHelpDlg extends CaveSWTDialog { /** * Main composite for the controls. @@ -48,9 +67,14 @@ public class ResourceEditorHelpDlg extends CaveSWTDialog { private Cursor textCursor; + /** + * Construct the ResourceEditor help dialog. + * @param parentShell The shell containing this dialog. + */ public ResourceEditorHelpDlg(Shell parentShell) { super(parentShell, SWT.SHELL_TRIM | SWT.RESIZE, - CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("AvnFPS Help"); } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/AlertDialog.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/AlertDialog.java index 874b07a233..a41b60a850 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/AlertDialog.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/AlertDialog.java @@ -45,6 +45,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 1/24/2008 817 grichard Initial creation. + * 20121010 1229 jkorman Added DO_NOT_BLOCK so dialog does not block on open. * * * @@ -72,7 +73,7 @@ public class AlertDialog extends CaveSWTDialog { * Parent Shell. */ public AlertDialog(Shell parent) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK); setText("AvnFPS Alert Dialog"); } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/BackupDialog.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/BackupDialog.java index e905951dbc..919c70a29f 100755 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/BackupDialog.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/BackupDialog.java @@ -55,7 +55,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * in initializeComponents. * 10/06/2010 6009 rferrel Use product to get initial selected item. * 3/14/2011 8588 rferrel Allow selection of multiple products. - * + * 20121010 1229 jkorman Added DO_NOT_BLOCK so dialog does not block on open. * * * @author lvenable @@ -88,7 +88,7 @@ public class BackupDialog extends CaveSWTDialog { */ public BackupDialog(Shell parent, java.util.List productDisplayList) { super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, - CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT | CAVE.DO_NOT_BLOCK); setText("AvnFPS Backup"); this.productDisplayList = productDisplayList; } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TimeSelectorDialog.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TimeSelectorDialog.java index 0a10ba644d..93fe52d3bf 100755 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TimeSelectorDialog.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TimeSelectorDialog.java @@ -49,6 +49,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * ------------ ---------- ----------- -------------------------- * 28 FEB 2008 938 lvenable Initial creation. * 3/27/2008 1033 grichard Added ETA-MOS label. + * 10/10/2012 1229 rferrel Make dialog non-blocking. * * * @@ -95,7 +96,8 @@ public class TimeSelectorDialog extends CaveSWTDialog { */ public TimeSelectorDialog(Shell parent, WxPlotCfg wxPlotCfg) { super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, - CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("AvnFPS Time Selector"); this.wxPlotCfg = wxPlotCfg; } diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TransmissionQueueDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TransmissionQueueDlg.java index 10c165e470..35cd7743dc 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TransmissionQueueDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TransmissionQueueDlg.java @@ -60,6 +60,8 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList; * ------------ ---------- ----------- -------------------------- * 28 FEB 2008 938 lvenable Initial creation * 14 MAY 2012 14715 rferrel Use EDEX to perform requests. + * 10 OCT 2012 1229 rferrel Make dialog non-blocking. + * 10 OCT 2012 1229 rferrel Changes for non-blocking HelpUsageDlg. * * * @@ -68,26 +70,6 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList; * */ public class TransmissionQueueDlg extends CaveSWTDialog { - private static String helpText = "This dialog is used to manage transmission and transmission log files.\n\n" - + "The top area manages the forecast files written by the forecast editor.\n" - + "The 'Files' scrolled list window lists files in one of 'pending', 'sent'\n" - + "and 'bad' directories. The time is when the file was written. The file\n" - + "name is \n" - + " xxx-CCCCNNNXXX-yymmddHHMM-BBB\n" - + "where xxx is the forecaster number. The transmission program \n" - + "avnxmitserv uses NNN to determine the transmission window for regular\n" - + "forecasts.\n\n" - + "The bottom area is used to view transmission log files. There is one\n" - + "file for each day of the week. By default, log files for the current day\n" - + "are shown.\n\nButtons:\n" - + " Refresh: refreshes both the directory list and log file windows.\n" - + " View: allows to view selected transmission file(s)\n" - + " Remove: deletes transmission files\n" - + " Retransmit: forces the transmission program to send selected files.\n" - + " If the file is in the 'bad' or 'sent' directory, it is \n" - + " moved back to 'pending'. The transmission time (the last\n" - + " part of the file name) is updated to the current time.\n" - + " Help: displays this window"; /** * Pending radio button. @@ -149,6 +131,8 @@ public class TransmissionQueueDlg extends CaveSWTDialog { */ private IStatusSettable msgStatComp; + private HelpUsageDlg usageDlg; + /** * Constructor. * @@ -157,7 +141,8 @@ public class TransmissionQueueDlg extends CaveSWTDialog { */ public TransmissionQueueDlg(Shell parent) { super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, - CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("AvnFPS Transmission Queue"); } @@ -298,10 +283,35 @@ public class TransmissionQueueDlg extends CaveSWTDialog { helpBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String description = "Help"; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - helpText); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "Help"; + + String helpText = "This dialog is used to manage transmission and transmission log files.\n\n" + + "The top area manages the forecast files written by the forecast editor.\n" + + "The 'Files' scrolled list window lists files in one of 'pending', 'sent'\n" + + "and 'bad' directories. The time is when the file was written. The file\n" + + "name is \n" + + " xxx-CCCCNNNXXX-yymmddHHMM-BBB\n" + + "where xxx is the forecaster number. The transmission program \n" + + "avnxmitserv uses NNN to determine the transmission window for regular\n" + + "forecasts.\n\n" + + "The bottom area is used to view transmission log files. There is one\n" + + "file for each day of the week. By default, log files for the current day\n" + + "are shown.\n\nButtons:\n" + + " Refresh: refreshes both the directory list and log file windows.\n" + + " View: allows to view selected transmission file(s)\n" + + " Remove: deletes transmission files\n" + + " Retransmit: forces the transmission program to send selected files.\n" + + " If the file is in the 'bad' or 'sent' directory, it is \n" + + " moved back to 'pending'. The transmission time (the last\n" + + " part of the file name) is updated to the current time.\n" + + " Help: displays this window"; + usageDlg = new HelpUsageDlg(shell, description, + helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } @@ -387,6 +397,7 @@ public class TransmissionQueueDlg extends CaveSWTDialog { tafInfo = "Viewing multiple forecasts"; } + // Allow multiple instances of this dialog. TransmissionViewerDlg tvd = new TransmissionViewerDlg(shell, tafText, tafInfo); tvd.open(); diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TransmissionViewerDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TransmissionViewerDlg.java index 7496978695..99dc9874b3 100644 --- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TransmissionViewerDlg.java +++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TransmissionViewerDlg.java @@ -36,6 +36,23 @@ import com.raytheon.viz.aviation.resource.ResourceConfigMgr; import com.raytheon.viz.aviation.resource.ResourceConfigMgr.ResourceTag; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +/** + * A dialog to display the forecast(s) details. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ *                                     Initial creation
+ * Oct 10, 2012 1229       rferrel     Made dialog non-blocking
+ * 
+ * 
+ * + * @author rferrel + * @version 1.0 + */ public class TransmissionViewerDlg extends CaveSWTDialog { /** @@ -55,7 +72,8 @@ public class TransmissionViewerDlg extends CaveSWTDialog { public TransmissionViewerDlg(Shell parentShell, String tafText, String tafInfo) { super(parentShell, SWT.SHELL_TRIM | SWT.RESIZE, - CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.MODE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText(tafInfo); this.tafText = tafText; diff --git a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/FindReplaceDlg.java b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/FindReplaceDlg.java index dd5fde579e..65fe30ad9e 100644 --- a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/FindReplaceDlg.java +++ b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/FindReplaceDlg.java @@ -46,6 +46,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * ------------ ---------- ----------- -------------------------- * 28 FEB 2008 938 lvenable Initial creation. * 6/19/2008 937 grichard Implemented 'replace all'. + * 10/11/2012 1229 rferrel Made dialog non-blocking. * * * @@ -119,7 +120,8 @@ public class FindReplaceDlg extends CaveSWTDialog { * Text editor containing the text to be searched. */ public FindReplaceDlg(Shell parent, StyledText textEditor) { - super(parent, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.NONE, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("Find and Replace"); this.textEditor = textEditor; diff --git a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/HelpUsageDlg.java b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/HelpUsageDlg.java index 41c300af64..f5302df43b 100644 --- a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/HelpUsageDlg.java +++ b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/HelpUsageDlg.java @@ -42,6 +42,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 28 FEB 2008 938 lvenable Initial creation. + * 15 OCT 2012 1229 rferrel Made dialog non-blocking. * * * @@ -83,7 +84,7 @@ public class HelpUsageDlg extends CaveSWTDialog { */ public HelpUsageDlg(Shell parent, String helpDesc, String helpText) { super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, - CAVE.PERSPECTIVE_INDEPENDENT); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK); setText("AvnFPS Help"); this.helpDesc = helpDesc; diff --git a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/MessageStatusComp.java b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/MessageStatusComp.java index 43e38ad139..c0e22e25d8 100644 --- a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/MessageStatusComp.java +++ b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/MessageStatusComp.java @@ -67,6 +67,9 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; * 2/6/2008 817 lvenable Initial creation. * 4/7/2008 934 grichard Added IStatusSettable implementation. * 8/11/2008 1314 grichard Used PathManager for pathnames. + * 10/04/2012 1229 rferrel Added dispose check needed for + * non-blocking dialogs. + * 10/12/2012 1229 rferrel Changes for non-blocking MessageViewerDlg. * * * @@ -341,17 +344,19 @@ public class MessageStatusComp extends Composite implements IStatusSettable { currentMsgColor.dispose(); } - currentMsgColor = new Color(parent.getDisplay(), rgbColor); + if (!parent.isDisposed()) { + currentMsgColor = new Color(parent.getDisplay(), rgbColor); - msgTF.setText(String.valueOf(msg)); + msgTF.setText(String.valueOf(msg)); - blinkAndClear(); + blinkAndClear(); - StringBuilder sb = new StringBuilder(calculateIssueTime()); - sb.append(" ").append(msg); + StringBuilder sb = new StringBuilder(calculateIssueTime()); + sb.append(" ").append(msg); - AvnMessageMgr msgMgr = AvnMessageMgr.getInstance(); - msgMgr.addMessage(msgType, sb.toString()); + AvnMessageMgr msgMgr = AvnMessageMgr.getInstance(); + msgMgr.addMessage(msgType, sb.toString()); + } } /** @@ -419,12 +424,12 @@ public class MessageStatusComp extends Composite implements IStatusSettable { * Create the message viewer dialog. */ private void createMessageViewerDialog() { - if (msgViewerDlg == null || msgViewerDlg.getShell().isDisposed()) { + if (msgViewerDlg == null || msgViewerDlg.getShell() == null + || msgViewerDlg.isDisposed()) { msgViewerDlg = new MessageViewerDlg(this, msgType); msgViewerDlg.open(); - msgViewerDlg = null; } else { - msgViewerDlg.showDialog(); + msgViewerDlg.bringToTop(); } } diff --git a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/MessageViewerDlg.java b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/MessageViewerDlg.java index 49030af359..ff9d6d22f3 100755 --- a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/MessageViewerDlg.java +++ b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/MessageViewerDlg.java @@ -47,6 +47,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 28 FEB 2008 938 lvenable Initial creation. * 4/8/2008 934 grichard Added IStatusViewable interface. * 9/12/2008 1444 grichard Accommodate separate message logs. + * 10/12/2012 1229 rferrel Make dialog non-blocking. * * * @@ -81,7 +82,7 @@ public class MessageViewerDlg extends CaveSWTDialog { */ public MessageViewerDlg(Composite parent, StatusMessageType msgType) { super(parent.getShell(), SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MODELESS, - CAVE.PERSPECTIVE_INDEPENDENT); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK); setText("Message Log"); this.msgType = msgType; @@ -178,16 +179,4 @@ public class MessageViewerDlg extends CaveSWTDialog { } msgList.setSelection(0); } - - /** - * Show the dialog. - */ - public void showDialog() { - - if (shell.isVisible() == false) { - shell.setVisible(true); - } - - shell.setActive(); - } } diff --git a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/MonitoringCriteriaDlg.java b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/MonitoringCriteriaDlg.java index 84f85402f1..55a69f882e 100644 --- a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/MonitoringCriteriaDlg.java +++ b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/MonitoringCriteriaDlg.java @@ -35,8 +35,6 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Dialog; -import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TabFolder; @@ -46,6 +44,7 @@ import org.eclipse.swt.widgets.Text; import com.raytheon.uf.common.localization.exception.LocalizationException; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; import com.raytheon.viz.avnconfig.AvnConfigConstants.DataSource; +import com.raytheon.viz.ui.dialogs.CaveSWTDialog; /** * Dialog displaying the monitoring criteria controls. The dialog has a tab @@ -59,6 +58,9 @@ import com.raytheon.viz.avnconfig.AvnConfigConstants.DataSource; * 16 Mar 2011 8599 rferrel Create msgStatusComp then load tabs. * 27 Sep 2011 10958 rferrel Display more details when handling * ConfigurationException. + * 12 Oct 2012 1229 rferrel Convert to subclass of CaveSWTDialog + * and made non-blocking. + * 15 OCT 2012 1229 rferrel Changes for non-blocking HelpUsageDlg. * * * @@ -66,16 +68,7 @@ import com.raytheon.viz.avnconfig.AvnConfigConstants.DataSource; * @version 1.0 * */ -public class MonitoringCriteriaDlg extends Dialog { - /** - * Dialog shell. - */ - private Shell shell; - - /** - * The display control. - */ - private Display display; +public class MonitoringCriteriaDlg extends CaveSWTDialog { /** * Composite containing message status controls. @@ -108,6 +101,8 @@ public class MonitoringCriteriaDlg extends Dialog { */ private DefaultRuleData defaultRuleData; + private HelpUsageDlg usageDlg; + /** * Constructor. * @@ -115,20 +110,12 @@ public class MonitoringCriteriaDlg extends Dialog { * Parent shell. */ public MonitoringCriteriaDlg(Shell parent) { - super(parent, 0); + super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK); + setText("AvnFPS Monitoring Criteria"); } - /** - * Open method used to display the dialog. - * - * @return Null. - */ - public Object open() { - Shell parent = getParent(); - display = parent.getDisplay(); - shell = new Shell(parent, SWT.DIALOG_TRIM); - shell.setText("AvnFPS Monitoring Criteria"); - + @Override + protected void initializeComponents(Shell shell) { // Create the main layout for the shell. GridLayout mainLayout = new GridLayout(1, false); mainLayout.marginHeight = 3; @@ -138,17 +125,6 @@ public class MonitoringCriteriaDlg extends Dialog { // Initialize all of the controls and layouts initializeComponents(); - - shell.pack(); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) { - display.sleep(); - } - } - - return null; } /** @@ -329,11 +305,15 @@ public class MonitoringCriteriaDlg extends Dialog { helpBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String description = "AvnFPS - Monitoring Criteria Help"; - String helpText = "This dialog is used to define and configure TAF monitoring\nrules.\n\nTo load current configuration, enter site id and press\n or use the \"Load\" button. Site id XXXX loads\ndefault rules.\n\nSelect a tab for the monitoring module you wish to modify\nthe rules. The top list displays current rules: severity\nlevels (colors) and associated messages. The list is sorted\nwith respect to the severity level.\n\nTo view detailed rule description, select an item on this\nlist. All rule parameters will be displayed in the \"Rule\nEditor\" window. You may modify editable parameters. Press \n\"Replace\" when finished. To remove a rule from the list,\npress \"Remove\". To add a new rule, first select one of\nthe available methods, then modify rule parameters as\ndesired. You must enter a message. Press \"Add\" to add the\nrule to the list.\n\nNOTE: \n1. argument types and values are not verified by the\n editor.\n2. if an argument is a list, the separators are commas.\n \nPress 'Save' when finished.\n\nTo restore default rules for a TAF Site and a currently\nselected monitoring module, use the \"Delete\" button."; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - helpText); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "AvnFPS - Monitoring Criteria Help"; + + String helpText = "This dialog is used to define and configure TAF monitoring\nrules.\n\nTo load current configuration, enter site id and press\n or use the \"Load\" button. Site id XXXX loads\ndefault rules.\n\nSelect a tab for the monitoring module you wish to modify\nthe rules. The top list displays current rules: severity\nlevels (colors) and associated messages. The list is sorted\nwith respect to the severity level.\n\nTo view detailed rule description, select an item on this\nlist. All rule parameters will be displayed in the \"Rule\nEditor\" window. You may modify editable parameters. Press \n\"Replace\" when finished. To remove a rule from the list,\npress \"Remove\". To add a new rule, first select one of\nthe available methods, then modify rule parameters as\ndesired. You must enter a message. Press \"Add\" to add the\nrule to the list.\n\nNOTE: \n1. argument types and values are not verified by the\n editor.\n2. if an argument is a list, the separators are commas.\n \nPress 'Save' when finished.\n\nTo restore default rules for a TAF Site and a currently\nselected monitoring module, use the \"Delete\" button."; + usageDlg = new HelpUsageDlg(shell, description, helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } diff --git a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/OpenDlg.java b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/OpenDlg.java new file mode 100644 index 0000000000..3b272fb6bc --- /dev/null +++ b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/OpenDlg.java @@ -0,0 +1,242 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.viz.avnconfig; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Map; +import java.util.TreeMap; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.List; +import org.eclipse.swt.widgets.Shell; + +import com.raytheon.uf.common.localization.LocalizationContext; +import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; +import com.raytheon.uf.common.localization.LocalizationFile; +import com.raytheon.uf.common.localization.PathManagerFactory; +import com.raytheon.viz.ui.dialogs.CaveSWTDialog; + +/** + * This class generates a list of localized files that can be opened in the + * AvnFPS Text Editor. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ *                                     Initial creation.
+ * Oct 12, 2012 1229       rferrel     Made subclass of CaveSWTDialog
+ *                                      and non-blocking.
+ * 
+ * 
+ * + * @version 1.0 + */ +public class OpenDlg extends CaveSWTDialog { + + /** + * Font used to display file list. + */ + private Font controlFont; + + /** + * List of localized files that can be edited. + */ + private List cfgFileList; + + /** + * List of localized files used to generate the file list. + */ + private LocalizationFile[] locFiles; + + /** + * Uses file's display name as key to get the associated localized file. + */ + private Map locFileMap; + + /** + * Constructor + * + * @param parent + * shell + * @param type + */ + public OpenDlg(Shell parent) { + super(parent, SWT.TITLE, CAVE.DO_NOT_BLOCK); + setText("Open Configuration File"); + } + + @Override + protected void initializeComponents(Shell shell) { + // Create the main layout for the shell. + GridLayout mainLayout = new GridLayout(1, false); + mainLayout.marginHeight = 2; + mainLayout.marginWidth = 2; + mainLayout.verticalSpacing = 2; + shell.setLayout(mainLayout); + + // Initialize all of the controls and layouts + initializeComponents(); + } + + @Override + protected void disposed() { + if (controlFont != null) { + controlFont.dispose(); + } + } + + /** + * Set up the dialog's display components. + */ + private void initializeComponents() { + locFileMap = new TreeMap(); + controlFont = new Font(shell.getDisplay(), "Monospace", 10, SWT.NORMAL); + + createListControl(); + + // Create the buttons at the bottom of the display. + createBottomButtons(); + + getAvailableConfigFiles(); + } + + /** + * Create the label and the scroll list that will contain the files the user + * can edit. + */ + private void createListControl() { + GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); + Composite listComp = new Composite(shell, SWT.NONE); + listComp.setLayout(new GridLayout(1, false)); + listComp.setLayoutData(gd); + + Label listLbl = new Label(listComp, SWT.NONE); + listLbl.setText("Available Config Files:"); + + gd = new GridData(SWT.FILL, SWT.FILL, true, true); + gd.widthHint = 400; + gd.heightHint = 400; + gd.horizontalSpan = 2; + cfgFileList = new List(listComp, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL + | SWT.H_SCROLL); + cfgFileList.setLayoutData(gd); + cfgFileList.setFont(controlFont); + } + + /** + * Determine based on DialogType what kind of action button to place at the + * bottom of the dialog. + */ + private void createBottomButtons() { + GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false); + Composite mainButtonComp = new Composite(shell, SWT.NONE); + mainButtonComp.setLayout(new GridLayout(1, false)); + mainButtonComp.setLayoutData(gd); + + gd = new GridData(SWT.CENTER, SWT.DEFAULT, false, false); + Composite buttonComp = new Composite(shell, SWT.NONE); + buttonComp.setLayout(new GridLayout(2, false)); + buttonComp.setLayoutData(gd); + + gd = new GridData(100, SWT.DEFAULT); + Button openBtn = new Button(buttonComp, SWT.PUSH); + openBtn.setText("Open"); + openBtn.setLayoutData(gd); + openBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + int selectedIndex = cfgFileList.getSelectionIndex(); + String str = cfgFileList.getItem(selectedIndex); + LocalizationFile selectedFile = locFileMap.get(str); + setReturnValue(selectedFile); + close(); + } + }); + + gd = new GridData(100, SWT.DEFAULT); + Button cancelBtn = new Button(buttonComp, SWT.PUSH); + cancelBtn.setText("Cancel"); + cancelBtn.setLayoutData(gd); + cancelBtn.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent event) { + shell.dispose(); + } + }); + } + + /** + * Obtain from localization the configuration file information and populate + * the dialog scroll list. + */ + private void getAvailableConfigFiles() { + String[] extensions = new String[] { ".xml", ".cfg" }; + LocalizationType[] types = new LocalizationType[] { + LocalizationType.CAVE_CONFIG, LocalizationType.CAVE_STATIC, + LocalizationType.COMMON_STATIC }; + ArrayList localFiles = new ArrayList(); + for (LocalizationType type : types) { + LocalizationContext[] contexts = PathManagerFactory + .getPathManager().getLocalSearchHierarchy(type); + for (LocalizationContext context : contexts) { + localFiles.addAll(Arrays.asList(PathManagerFactory + .getPathManager().listFiles(context, "aviation", + extensions, true, true))); + } + } + locFiles = localFiles.toArray(new LocalizationFile[0]); + if (locFiles == null) { + return; + } + + for (int i = 0; i < locFiles.length; i++) { + if (locFiles[i].getName().startsWith("aviation/avnsetup") == false) { + String contextName = locFiles[i].getContext().getContextName(); + if (contextName == null) { + contextName = " - " + "BASE"; + } else { + contextName = " - " + contextName; + } + locFileMap + .put(locFiles[i].getName() + contextName, locFiles[i]); + } + } + + for (String str : locFileMap.keySet()) { + cfgFileList.add(str); + } + + if (cfgFileList.getSelectionCount() > 0) { + cfgFileList.setSelection(0); + } + } +} diff --git a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafProductConfigDlg.java b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafProductConfigDlg.java index 2dfaf780e3..989b4623fc 100644 --- a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafProductConfigDlg.java +++ b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafProductConfigDlg.java @@ -36,7 +36,6 @@ import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Dialog; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; @@ -55,6 +54,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; +import com.raytheon.viz.ui.dialogs.CaveSWTDialog; /** * TAF product configuration dialog. @@ -66,6 +66,9 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; * 22 MAY 2008 1119 lvenable Initial creation * 9 Jul 2010 5078 rferrel Added catches for File Not Found. * 1 Oct 2010 4345 rferrel Cleanup to work like AWIPS I. + * 12 Oct 2012 1229 rferrel Convert to CaveSWTDialog subclass + * and make non-blocking. + * 15 OCT 2012 1229 rferrel Changes for non-blocking HelpUsageDlg. * * * @@ -73,20 +76,10 @@ import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; * @version 1.0 * */ -public class TafProductConfigDlg extends Dialog { - private static final transient IUFStatusHandler statusHandler = UFStatus +public class TafProductConfigDlg extends CaveSWTDialog { + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(TafProductConfigDlg.class); - /** - * Dialog shell. - */ - private Shell shell; - - /** - * The display control. - */ - private Display display; - /** * Composite containing message status controls. */ @@ -132,26 +125,20 @@ public class TafProductConfigDlg extends Dialog { */ private Map> productsMap; + private HelpUsageDlg usageDlg; + /** * Constructor. * * @param parent */ public TafProductConfigDlg(Shell parent) { - super(parent, 0); + super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK); + setText("AvnFPS TAF Product Configuration"); } - /** - * Open method used to display the dialog. - * - * @return Null. - */ - public Object open() { - Shell parent = getParent(); - display = parent.getDisplay(); - shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE); - shell.setText("AvnFPS TAF Product Configuration"); - + @Override + protected void initializeComponents(Shell shell) { // Create the main layout for the shell. GridLayout mainLayout = new GridLayout(1, false); mainLayout.marginHeight = 3; @@ -161,25 +148,18 @@ public class TafProductConfigDlg extends Dialog { // Initialize all of the controls and layouts initializeComponents(); + } - shell.pack(); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) { - display.sleep(); - } - } - + @Override + protected void disposed() { listFont.dispose(); - - return null; } /** * Initialize the components on the display. */ private void initializeComponents() { + Display display = getParent().getDisplay(); listFont = new Font(display, "Monospace", 10, SWT.NORMAL); createBottomMessageControls(); @@ -562,11 +542,16 @@ public class TafProductConfigDlg extends Dialog { helpBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String description = "TAF Product Configuration Help"; - String helpText = "This dialog is used to define TAF/TWEB product (list of\nforecasts).\n\nThee products should be defined AFTER relevant site/route\nconfiguration files have been created.\n\nTo add a new product, enter product label in the \"Products\"\nentry field and press . Then enter all TAF ids or\nTWEB routes in the \"Idents\" entry field, press \nafter typing one item. Press \"Save\" button to save\nconfiguration file.\n\nTo remove a product, press \"Delede\" below \"Products\" list.\n\nTo remove an ident from the product definition, use\n\"Delete\" button in the \"Idents\" column. You must then save\nthe product. This will NOT delete TAF/TWEB configuration\nfiles, this can only be done from the command line.\n\nThe \"Verify\" button can be used to check for existence and\nproper syntax of all relevant files."; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - helpText); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "TAF Product Configuration Help"; + + String helpText = "This dialog is used to define TAF/TWEB product (list of\nforecasts).\n\nThee products should be defined AFTER relevant site/route\nconfiguration files have been created.\n\nTo add a new product, enter product label in the \"Products\"\nentry field and press . Then enter all TAF ids or\nTWEB routes in the \"Idents\" entry field, press \nafter typing one item. Press \"Save\" button to save\nconfiguration file.\n\nTo remove a product, press \"Delede\" below \"Products\" list.\n\nTo remove an ident from the product definition, use\n\"Delete\" button in the \"Idents\" column. You must then save\nthe product. This will NOT delete TAF/TWEB configuration\nfiles, this can only be done from the command line.\n\nThe \"Verify\" button can be used to check for existence and\nproper syntax of all relevant files."; + usageDlg = new HelpUsageDlg(shell, description, + helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); diff --git a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteInfoEditorDlg.java b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteInfoEditorDlg.java index b6809446c6..4981cd8a81 100644 --- a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteInfoEditorDlg.java +++ b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TafSiteInfoEditorDlg.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.Map; import org.apache.commons.configuration.ConfigurationException; import org.eclipse.swt.SWT; @@ -39,7 +40,6 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Combo; import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Dialog; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Group; import org.eclipse.swt.widgets.Label; @@ -63,6 +63,8 @@ import com.raytheon.uf.viz.core.comm.Loader; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.requests.ThriftClient; import com.raytheon.viz.avncommon.AvnMessageMgr.StatusMessageType; +import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.vividsolutions.jts.geom.Point; /** @@ -78,6 +80,10 @@ import com.vividsolutions.jts.geom.Point; * Make and Edit buttons to work. * 10 Dec 2010 7662 rferrel Create and use getObStation. * 9 May 2011 8856 rferrel Code cleanup + * 12 Oct 2012 1229 rferrel Now a subclass of CaveSWTDialog + * and made non-blocking. + * 15 Oct 2012 1229 rferrel Changes for non-blocking TextEditorSetupDlg. + * 15 OCT 2012 1229 rferrel Changes for non-blocking HelpUsageDlg. * * * @@ -85,24 +91,14 @@ import com.vividsolutions.jts.geom.Point; * @version 1.0 * */ -public class TafSiteInfoEditorDlg extends Dialog { - private static final transient IUFStatusHandler statusHandler = UFStatus +public class TafSiteInfoEditorDlg extends CaveSWTDialog { + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(TafSiteInfoEditorDlg.class); /** * A site's template hours. */ - private final static String[] START_HOURS = { "00", "06", "12", "18" }; - - /** - * Dialog shell. - */ - private Shell shell; - - /** - * The display control. - */ - private Display display; + private final String[] START_HOURS = { "00", "06", "12", "18" }; /** * Composite containing message status controls. @@ -241,6 +237,13 @@ public class TafSiteInfoEditorDlg extends Dialog { */ private Color correctColor; + /** + * Possible to have a different dialog for each issue time. + */ + private Map editorDlgMap; + + private HelpUsageDlg usageDlg; + /** * Constructor. * @@ -248,19 +251,13 @@ public class TafSiteInfoEditorDlg extends Dialog { * Parent shell. */ public TafSiteInfoEditorDlg(Shell parent) { - super(parent, 0); + super(parent, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK); + setText("AvnFPS TAF Site Info Editor"); + editorDlgMap = new HashMap(); } - /** - * Open method used to display the dialog. - * - * @return Null. - */ - public Object open() { - Shell parent = getParent(); - display = parent.getDisplay(); - shell = new Shell(parent, SWT.DIALOG_TRIM); - shell.setText("AvnFPS TAF Site Info Editor"); + @Override + protected void initializeComponents(Shell shell) { // Create the main layout for the shell. GridLayout mainLayout = new GridLayout(1, false); @@ -271,25 +268,25 @@ public class TafSiteInfoEditorDlg extends Dialog { // Initialize all of the controls and layouts initializeComponents(); + } - shell.pack(); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) { - display.sleep(); - } + @Override + protected void disposed() { + if (incorrectColor != null) { + incorrectColor.dispose(); } - incorrectColor.dispose(); - - return null; + if (correctColor != null) { + correctColor.dispose(); + } } /** * Initialize the components on the display. */ private void initializeComponents() { + Display display = getParent().getDisplay(); + incorrectColor = new Color(display, new RGB(255, 215, 220)); createTopControls(); @@ -486,11 +483,16 @@ public class TafSiteInfoEditorDlg extends Dialog { helpBtn.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String description = "AvnFPS - Site Info Editor Help"; - String helpText = "This dialog is used to define TAF site information.\n\nTo add a new site, enter site id and press \"Update\". Edit\ndisplayed entries and press \"Save\". Create default template\nfiles.\n\nTo change an existing TAF site attribute, enter site id and\npress the \"Load\" button.\n\nTo create template files, press \"Make\" in the \"Templates\"\narea.\n\nTo edit template file, select issue hour, then press \"Edit\"\nin the \"Templates\" area.\n\nYou can use \"Update\" button to extract information from\nAWIPS configuration files. Only non-empty fields will be\noverwritten."; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - helpText); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "AvnFPS - Site Info Editor Help"; + + String helpText = "This dialog is used to define TAF site information.\n\nTo add a new site, enter site id and press \"Update\". Edit\ndisplayed entries and press \"Save\". Create default template\nfiles.\n\nTo change an existing TAF site attribute, enter site id and\npress the \"Load\" button.\n\nTo create template files, press \"Make\" in the \"Templates\"\narea.\n\nTo edit template file, select issue hour, then press \"Edit\"\nin the \"Templates\" area.\n\nYou can use \"Update\" button to extract information from\nAWIPS configuration files. Only non-empty fields will be\noverwritten."; + usageDlg = new HelpUsageDlg(shell, description, + helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } @@ -877,15 +879,30 @@ public class TafSiteInfoEditorDlg extends Dialog { public void widgetSelected(SelectionEvent event) { if (isSiteIdValid()) { try { - String issueTime = issueCbo.getText().substring(0, 2); - ITafSiteConfig config = TafSiteConfigFactory - .getInstance(); - String siteId = siteIdTF.getText(); - LocalizationFile lFile = config.getTemplateFile(siteId, - issueTime); - TextEditorSetupDlg editorDlg = new TextEditorSetupDlg( - shell, lFile); - editorDlg.open(); + final String issueTime = issueCbo.getText().substring( + 0, 2); + TextEditorSetupDlg editorDlg = editorDlgMap + .get(issueTime); + if (mustCreate(editorDlg)) { + ITafSiteConfig config = TafSiteConfigFactory + .getInstance(); + String siteId = siteIdTF.getText(); + LocalizationFile lFile = config.getTemplateFile( + siteId, issueTime); + editorDlg = new TextEditorSetupDlg(shell, lFile); + editorDlgMap.put(issueTime, editorDlg); + editorDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + editorDlgMap.remove(issueTime); + } + }); + + editorDlg.open(); + } else { + editorDlg.bringToTop(); + } } catch (FileNotFoundException e) { msgStatusComp.setMessageText(e.getMessage(), new RGB( 255, 0, 0)); @@ -1109,6 +1126,7 @@ public class TafSiteInfoEditorDlg extends Dialog { * @return boolean - True if all the data is valid. */ private boolean validateData() { + Display display = getParent().getDisplay(); boolean isValid = true; correctColor = new Color(display, new RGB(255, 255, 255)); diff --git a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TextEditorSetupDlg.java b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TextEditorSetupDlg.java index 962848b611..1ae42bfec2 100644 --- a/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TextEditorSetupDlg.java +++ b/cave/com.raytheon.viz.avnconfig/src/com/raytheon/viz/avnconfig/TextEditorSetupDlg.java @@ -60,8 +60,8 @@ import com.raytheon.uf.common.localization.LocalizationFile; import com.raytheon.uf.common.localization.PathManagerFactory; import com.raytheon.uf.common.localization.exception.LocalizationOpFailedException; import com.raytheon.uf.viz.core.localization.LocalizationManager; -import com.raytheon.viz.avnconfig.OpenSaveDlg.DialogType; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * A simple text Editor dialog allowing the user to modify a localized file. @@ -75,6 +75,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * 7 DEC 2010 7621 rferrel Modified constructor to take a * LocalizedFile and added preOpen() to * open the LocalizedFile. + * 11 OCT 2012 1229 rferrel Changes for non-blocking FindReplaceDlg. + * 15 OCT 2012 1229 rferrel Made dialog non-blocking. + * 15 OCT 2012 1229 rferrel Changes for non-blocking HelpUsageDlg. * * * @@ -141,6 +144,12 @@ public class TextEditorSetupDlg extends CaveSWTDialog { private String template; + private FindReplaceDlg findDlg; + + private OpenDlg openDlg; + + private HelpUsageDlg usageDlg; + /** * Constructor. * @@ -160,7 +169,8 @@ public class TextEditorSetupDlg extends CaveSWTDialog { * When not null a localized file to load into the editor. */ public TextEditorSetupDlg(Shell parent, LocalizationFile lFile) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("AvnFPS Text Editor"); this.template = null; @@ -323,8 +333,12 @@ public class TextEditorSetupDlg extends CaveSWTDialog { @Override public void widgetSelected(SelectionEvent event) { // Use the AvnFPS Find/Replace dialog - FindReplaceDlg findDlg = new FindReplaceDlg(shell, editorStTxt); - findDlg.open(); + if (mustCreate(findDlg)) { + findDlg = new FindReplaceDlg(shell, editorStTxt); + findDlg.open(); + } else { + findDlg.bringToTop(); + } } }); @@ -383,33 +397,36 @@ public class TextEditorSetupDlg extends CaveSWTDialog { usageMI.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { - String description = "Text Editor Help"; - String helpText = "This is a generic text editor. Edit any text file via the file\n"; - helpText += "selection dialog that is invoked by pressing the 'Open' button.\n"; - helpText += "\n"; - helpText += "Menu items:\n"; - helpText += " File:\n"; - helpText += " Print invokes print dialog\n"; - helpText += " Edit:\n"; - helpText += " provides the usual editing functions (i.e. Cut, Copy, Paste,\n"; - helpText += " and Find/Replace). The menu can be also invoked by pressing\n"; - helpText += " right mouse button within the text window area.\n"; - helpText += "\n"; - helpText += "Buttons:\n"; - helpText += " Clear: clears text window.\n"; - helpText += " Open: invokes file selection dialog\n"; - helpText += " Save: saves content of the text window\n"; - helpText += " Save as: invokes file selection dialog\n"; - helpText += "\n"; - helpText += "Toggles:\n"; - helpText += " Insert: toggles insert/overwrite mode\n"; - helpText += " Wrap: toggles word wrap\n"; - helpText += "\n"; - helpText += "The currently loaded (if any) file name is displayed in a label above the\n"; - helpText += "text window."; - HelpUsageDlg usageDlg = new HelpUsageDlg(shell, description, - helpText); - usageDlg.open(); + if (mustCreate(usageDlg)) { + String description = "Text Editor Help"; + String helpText = "This is a generic text editor. Edit any text file via the file\n" + + "selection dialog that is invoked by pressing the 'Open' button.\n" + + "\n" + + "Menu items:\n" + + " File:\n" + + " Print invokes print dialog\n" + + " Edit:\n" + + " provides the usual editing functions (i.e. Cut, Copy, Paste,\n" + + " and Find/Replace). The menu can be also invoked by pressing\n" + + " right mouse button within the text window area.\n" + + "\n" + + "Buttons:\n" + + " Clear: clears text window.\n" + + " Open: invokes file selection dialog\n" + + " Save: saves content of the text window\n" + + " Save as: invokes file selection dialog\n" + + "\n" + + "Toggles:\n" + + " Insert: toggles insert/overwrite mode\n" + + " Wrap: toggles word wrap\n" + + "\n" + + "The currently loaded (if any) file name is displayed in a label above the\n" + + "text window."; + usageDlg = new HelpUsageDlg(shell, description, helpText); + usageDlg.open(); + } else { + usageDlg.bringToTop(); + } } }); } @@ -509,7 +526,6 @@ public class TextEditorSetupDlg extends CaveSWTDialog { Button saveAsBtn = new Button(buttonComp, SWT.PUSH); saveAsBtn.setText("Save As"); saveAsBtn.setToolTipText("Save file with new name"); - // saveAsBtn.setEnabled(false); saveAsBtn.setLayoutData(gd); saveAsBtn.addSelectionListener(new SelectionAdapter() { @Override @@ -799,8 +815,6 @@ public class TextEditorSetupDlg extends CaveSWTDialog { path = path.substring(1, path.lastIndexOf('/')); dlg.setFilterPath(path); - // dlg.setFilterNames(FILTER_NAMES); - // dlg.setFilterExtensions(FILTER_EXTS); String fn = dlg.open(); if (fn != null) { try { @@ -839,9 +853,23 @@ public class TextEditorSetupDlg extends CaveSWTDialog { * Show the 'Open' file dialog. */ private void openFile() { - OpenSaveDlg dlg = new OpenSaveDlg(shell, DialogType.OPEN); - dlg.open(); - openFile(dlg.getSelectedFile()); + if (mustCreate(openDlg)) { + openDlg = new OpenDlg(shell); + openDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + LocalizationFile selectedFile = null; + if (returnValue instanceof LocalizationFile) { + selectedFile = (LocalizationFile) returnValue; + } + openFile(selectedFile); + } + }); + openDlg.open(); + } else { + openDlg.bringToTop(); + } } /** @@ -880,41 +908,4 @@ public class TextEditorSetupDlg extends CaveSWTDialog { } } } - - // private void openFile() { - // FileDialog dlg = new FileDialog(shell, SWT.OPEN); - // IPathManager pm = PathManagerFactory.getPathManager(); - // String path = pm.getFile( - // pm.getContext(LocalizationType.CAVE_STATIC, - // LocalizationLevel.BASE), "aviation").getAbsolutePath(); - // dlg.setFilterPath(path); - // String fn = dlg.open(); - // StringBuilder contents = new StringBuilder(); - // - // if (fn != null) { - // try { - // BufferedReader input = new BufferedReader(new FileReader( - // new File(fn))); - // String line = null; - // - // while ((line = input.readLine()) != null) { - // contents.append(line); - // contents.append(System.getProperty("line.separator")); - // } - // - // editorStTxt.setText(contents.toString()); - // - // input.close(); - // msgStatusComp.setMessageText("File " + fn - // + " opened successfully.", new RGB(0, 255, 0)); - // } catch (FileNotFoundException e) { - // msgStatusComp.setMessageText("File " + fn + " not found.", - // new RGB(255, 0, 0)); - // } catch (IOException e) { - // msgStatusComp.setMessageText( - // "An error occured while opening file " + fn, new RGB( - // 255, 0, 0)); - // } - // } - // } } diff --git a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ToolsAlterBundleContributor.java b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ToolsAlterBundleContributor.java index 392a090273..a2a53e08c8 100644 --- a/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ToolsAlterBundleContributor.java +++ b/cave/com.raytheon.viz.awipstools/src/com/raytheon/viz/awipstools/ToolsAlterBundleContributor.java @@ -31,6 +31,8 @@ import java.util.regex.Pattern; import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay; import com.raytheon.uf.viz.core.drawables.IDescriptor; import com.raytheon.uf.viz.core.drawables.ResourcePair; +import com.raytheon.uf.viz.core.procedures.AlterBundleChangeEvent; +import com.raytheon.uf.viz.core.procedures.AlterBundleContributorAdapter; import com.raytheon.uf.viz.core.procedures.Bundle; import com.raytheon.uf.viz.core.procedures.IAlterBundleContributor; import com.raytheon.uf.viz.core.rsc.AbstractResourceData; @@ -39,6 +41,7 @@ import com.raytheon.uf.viz.core.rsc.IPointsToolContainer; import com.raytheon.uf.viz.core.rsc.IResourceGroup; import com.raytheon.uf.viz.core.rsc.ResourceList; import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureDlg; +import com.raytheon.uf.viz.points.IPointChangedListener; import com.raytheon.uf.viz.points.PointUtilities; import com.raytheon.uf.viz.points.PointsDataManager; import com.raytheon.uf.viz.points.data.IPointNode; @@ -46,8 +49,7 @@ import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.LineString; /** - * This class generates the alternate bundle's contributions for points and - * lines. + * This class generates the alter bundle's contributions for points and lines. * *
  * 
@@ -57,6 +59,7 @@ import com.vividsolutions.jts.geom.LineString;
  * ------------ ---------- ----------- --------------------------
  *                                     Initial creation
  * Aug 08, 2012 #875       rferrel     Generate menu entries for points.
+ * Oct 03, 2012 #1248      rferrel     Added listener for when points change.
  * 
  * 
  * 
@@ -65,7 +68,7 @@ import com.vividsolutions.jts.geom.LineString; * @version 1.0 */ -public class ToolsAlterBundleContributor implements IAlterBundleContributor { +public class ToolsAlterBundleContributor extends AlterBundleContributorAdapter { private static final String POINTS_PREFIX = "Point-"; @@ -75,6 +78,8 @@ public class ToolsAlterBundleContributor implements IAlterBundleContributor { private static final String LINES_KEY = "line"; + private IPointChangedListener pointChangedListener; + /* * (non-Javadoc) * @@ -85,37 +90,8 @@ public class ToolsAlterBundleContributor implements IAlterBundleContributor { @Override public Map getAlterables() { Map alterables = new HashMap(); - ToolsDataManager tdm = ToolsDataManager.getInstance(); - PointsDataManager pdm = PointsDataManager.getInstance(); - Collection blNames = tdm.getBaselineNames(); - String[] lines = new String[blNames.size()]; - int i = 0; - for (String line : blNames) { - lines[i] = LINES_PREFIX + line; - ++i; - } - Arrays.sort(lines); - - Collection pNames = pdm.getPointNames(); - String[] points = new String[pNames.size()]; - i = 0; - for (String point : pNames) { - points[i] = POINTS_PREFIX + point; - ++i; - } - Arrays.sort(points); - - List pointsList = new ArrayList(); - pointsList.add(ProcedureDlg.ORIGINAL); - pointsList.add(ProcedureDlg.CURRENT); - pointsList.add(IAlterBundleContributor.MI_SEPARATOR); - pointsList.addAll(createChildrenList(pdm, null)); - String[] pointsValues = pointsList.toArray(new String[0]); - - String[] linesValues = new String[lines.length + 2]; - linesValues[0] = ProcedureDlg.ORIGINAL; - linesValues[1] = ProcedureDlg.CURRENT; - System.arraycopy(lines, 0, linesValues, 2, lines.length); + String[] linesValues = createLineArray(); + String[] pointsValues = createPointArray(); alterables.put(LINES_KEY, linesValues); alterables.put(POINTS_KEY, pointsValues); @@ -149,6 +125,39 @@ public class ToolsAlterBundleContributor implements IAlterBundleContributor { return childrenList; } + private String[] createLineArray() { + ToolsDataManager tdm = ToolsDataManager.getInstance(); + Collection blNames = tdm.getBaselineNames(); + String[] lines = new String[blNames.size()]; + int i = 0; + for (String line : blNames) { + lines[i] = LINES_PREFIX + line; + ++i; + } + + Arrays.sort(lines); + String[] linesValues = new String[lines.length + 2]; + linesValues[0] = ProcedureDlg.ORIGINAL; + linesValues[1] = ProcedureDlg.CURRENT; + System.arraycopy(lines, 0, linesValues, 2, lines.length); + return linesValues; + } + + /** + * @return pointsValues + */ + private String[] createPointArray() { + PointsDataManager pdm = PointsDataManager.getInstance(); + + List pointsList = new ArrayList(); + pointsList.add(ProcedureDlg.ORIGINAL); + pointsList.add(ProcedureDlg.CURRENT); + pointsList.add(IAlterBundleContributor.MI_SEPARATOR); + pointsList.addAll(createChildrenList(pdm, null)); + String[] pointsValues = pointsList.toArray(new String[0]); + return pointsValues; + } + /* * (non-Javadoc) * @@ -183,6 +192,9 @@ public class ToolsAlterBundleContributor implements IAlterBundleContributor { } } + /** + * @param list + */ private void replaceWithCurrentPoints(ResourceList list) { for (ResourcePair rp : list) { AbstractResourceData rData = rp.getResourceData(); @@ -196,6 +208,9 @@ public class ToolsAlterBundleContributor implements IAlterBundleContributor { } } + /** + * @param b + */ private void replaceWithCurrentLines(Bundle b) { for (AbstractRenderableDisplay display : b.getDisplays()) { IDescriptor desc = display.getDescriptor(); @@ -219,6 +234,10 @@ public class ToolsAlterBundleContributor implements IAlterBundleContributor { } } + /** + * @param list + * @param selectedString + */ private void alterResourceList(ResourceList list, String selectedString) { for (ResourcePair rp : list) { AbstractResourceData rData = rp.getResourceData(); @@ -256,6 +275,10 @@ public class ToolsAlterBundleContributor implements IAlterBundleContributor { } } + /** + * @param container + * @param selectedString + */ private void alterContainer(IBaseLinesContainer container, String selectedString) { LineString line = ToolsDataManager.getInstance().getBaseline( @@ -264,4 +287,65 @@ public class ToolsAlterBundleContributor implements IAlterBundleContributor { container.setBaseLineString(line); } + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.core.procedures.AlterBundleContributorAdapter# + * getAlterables(java.lang.String) + */ + @Override + public String[] getAlterables(String key) { + if (key == POINTS_KEY) { + return createPointArray(); + } else if (key == LINES_KEY) { + return createLineArray(); + } + return null; + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.core.procedures.AlterBundleContributorAdapter# + * listenerSetup() + */ + @Override + public void listenerSetup() { + if (pointChangedListener == null) { + pointChangedListener = new IPointChangedListener() { + + @Override + public void pointChanged() { + notifyBundleListeners(); + } + }; + PointsDataManager.getInstance().addPointsChangedListener( + pointChangedListener); + } + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.uf.viz.core.procedures.AlterBundleContributorAdapter# + * listenerShutdown() + */ + @Override + public void listenerShutdown() { + if (pointChangedListener != null) { + PointsDataManager.getInstance().removePointsChangedListener( + pointChangedListener); + pointChangedListener = null; + } + } + + /** + * Received notification of changes to points notify anyone interested in + * the change. + */ + private void notifyBundleListeners() { + AlterBundleChangeEvent event = new AlterBundleChangeEvent( + new String[] { POINTS_KEY }); + fireAlterBundleChangeListener(event); + } } diff --git a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/rsc/hdf5/MemoryBasedTileSet.java b/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/rsc/hdf5/MemoryBasedTileSet.java index 3768231f00..47968ca8a6 100644 --- a/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/rsc/hdf5/MemoryBasedTileSet.java +++ b/cave/com.raytheon.viz.core/src/com/raytheon/viz/core/rsc/hdf5/MemoryBasedTileSet.java @@ -49,7 +49,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; * * This memory-based tileset pulls a small raster from an hdf5 file and * interpolates it to a larger size. The raster is then split once it is already - * loaded in memory. + * loaded in memory.git pull * *
  * 
@@ -116,23 +116,28 @@ public class MemoryBasedTileSet extends AbstractTileSet {
      */
     @Override
     protected void preloadDataObject(int level) throws StorageException {
-        IDataRecord rec = getDataRecord();
+        synchronized (isLoaded) {
+            if (isLoaded[level]) {
+                return;
+            }
+            IDataRecord rec = getDataRecord();
 
-        if (loadedData == null) {
-            loadedData = new Object[levels];
-            dims = new int[levels][];
+            if (loadedData == null) {
+                loadedData = new Object[levels];
+                dims = new int[levels][];
+            }
+
+            if (rec != null) {
+
+                loadedData[level] = rec.getDataObject();
+
+                long[] d = rec.getSizes();
+                dims[level] = new int[] { (int) d[0], (int) d[1] };
+
+            }
+
+            isLoaded[level] = true;
         }
-
-        if (rec != null) {
-
-            loadedData[level] = rec.getDataObject();
-
-            long[] d = rec.getSizes();
-            dims[level] = new int[] { (int) d[0], (int) d[1] };
-
-        }
-
-        isLoaded[level] = true;
     }
 
     protected IDataRecord getDataRecord() throws StorageException {
diff --git a/cave/com.raytheon.viz.gfe/plugin.xml b/cave/com.raytheon.viz.gfe/plugin.xml
index d92419afd9..44302aa996 100644
--- a/cave/com.raytheon.viz.gfe/plugin.xml
+++ b/cave/com.raytheon.viz.gfe/plugin.xml
@@ -34,9 +34,14 @@
 						
 					
 				
-          	  	
-       				
-    	      	
+				
+				    
+				       
+				    
+	          	  	
+	       				
+	    	      	
+    	      	
     		
 		
 	
@@ -356,12 +361,6 @@
            optional="false">
      
   
-  
-  
   
             
   
-  
-     
-        
-        
-     
-  
   
diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ActivateSiteComponent.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ActivateSiteComponent.java
index ad1f7e71ea..e827c37c88 100644
--- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ActivateSiteComponent.java
+++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ActivateSiteComponent.java
@@ -26,7 +26,7 @@ import com.raytheon.viz.gfe.dialogs.sbu.SiteActivationDlg;
 import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
 
 /**
- * TODO Add Description
+ * Display Activate Site dialog standalone and blocked.
  * 
  * 
  * 
@@ -35,6 +35,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Aug 15, 2011            bphillip     Initial creation
+ * Oct 26, 2012 1287       rferrel     Force blocking of SiteActivationDlg.
  * 
  * 
* @@ -55,6 +56,7 @@ public class ActivateSiteComponent extends AbstractCAVEComponent { protected void startInternal(String componentName) throws Exception { SiteActivationDlg dlg = new SiteActivationDlg(new Shell( Display.getCurrent())); + dlg.setBlockOnOpen(true); dlg.open(); } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ServiceBackupComponent.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ServiceBackupComponent.java index 58d75e19d9..d81c2aeed3 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ServiceBackupComponent.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/ServiceBackupComponent.java @@ -22,12 +22,11 @@ package com.raytheon.viz.gfe; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; -import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.dialogs.sbu.ServiceBackupDlg; import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; /** - * TODO Add Description + * Bring up the Service Backup Dialog in stand alone mode as a blocking dialog. * *
  * 
@@ -36,6 +35,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Aug 12, 2011            bphillip     Initial creation
+ * Oct 26, 2012 1287       rferrel     Change to force blocking of ServiceBackupDlg.
  * 
  * 
* @@ -56,6 +56,7 @@ public class ServiceBackupComponent extends AbstractCAVEComponent { protected void startInternal(String componentName) throws Exception { ServiceBackupDlg svcBuDlg = new ServiceBackupDlg(new Shell( Display.getCurrent())); + svcBuDlg.setBlockOnOpen(true); svcBuDlg.open(); } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/DisplayAttributesAction.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/DisplayAttributesAction.java index acc8ab9bc8..21df806fec 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/DisplayAttributesAction.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/DisplayAttributesAction.java @@ -27,7 +27,7 @@ import com.raytheon.viz.gfe.rsc.GFEResource; import com.raytheon.viz.ui.cmenu.AbstractRightClickAction; /** - * TODO Add Description + * Action to bring up the Dispaly attributes dialog. * *
  * 
@@ -35,6 +35,7 @@ import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Jan 13, 2009            mschenke     Initial creation
+ * Oct 22, 2012 1287       rferrel     Changes for non-blocking DisplayAttributesDialog.
  * 
  * 
* @@ -46,6 +47,8 @@ public class DisplayAttributesAction extends AbstractRightClickAction { private GFEResource rsc; + private DisplayAttributesDialog dialog; + /* * (non-Javadoc) * @@ -53,14 +56,18 @@ public class DisplayAttributesAction extends AbstractRightClickAction { */ @Override public void run() { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - rsc = ((GFEResource) this.getSelectedRsc()); + rsc = ((GFEResource) this.getSelectedRsc()); - DisplayAttributesDialog dad = new DisplayAttributesDialog(shell, rsc); - dad.setBlockOnOpen(true); - dad.open(); + dialog = new DisplayAttributesDialog(shell, rsc); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } } /* diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/FormatterlauncherAction.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/FormatterlauncherAction.java index a75169c76e..ef0a34ad85 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/FormatterlauncherAction.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/FormatterlauncherAction.java @@ -35,6 +35,7 @@ import com.raytheon.viz.gfe.dialogs.FormatterLauncherDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 11, 2008 Eric Babin Initial Creation + * Oct 23, 2012 1287 rferrel Changes for non-blocking FormatterLauncherDialog. * *
* @@ -56,28 +57,31 @@ public class FormatterlauncherAction extends AbstractHandler { @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - - if (dialog == null) { + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); dialog = new FormatterLauncherDialog(shell); - dialog.setBlockOnOpen(true); - dialog.open(); - dialog.dispose(); - dialog = null; - } else if (dialog.getShell() == null) { + dialog.setBlockOnOpen(false); dialog.open(); } else { - dialog.getShell().setVisible(true); - dialog.getShell().setActive(); + dialog.bringToTop(); if (dialog.buttonBar != null) { dialog.buttonBar.moveAbove(null); } } return null; } - - public static FormatterLauncherDialog getFormatterLauncher() { - return dialog; + + public static void closeFormatters() { + if (dialog != null && dialog.getShell() != null && !dialog.isDisposed()) { + dialog.closeFormatters(); + } + } + + public static void closeDialog() { + if (dialog != null && dialog.getShell() != null && !dialog.isDisposed()) { + dialog.closeDialog(); + } + dialog = null; } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowAutoSaveIntervalDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowAutoSaveIntervalDialog.java index c49f4b8106..994663a5a9 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowAutoSaveIntervalDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowAutoSaveIntervalDialog.java @@ -30,6 +30,7 @@ import org.eclipse.ui.PlatformUI; import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.dialogs.AutoSaveIntervalDialog; import com.raytheon.viz.gfe.jobs.AutoSaveJob; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * Action for launching auto save dialog @@ -40,6 +41,7 @@ import com.raytheon.viz.gfe.jobs.AutoSaveJob; * ------------ ---------- ----------- -------------------------- * Jan 23, 2008 Eric Babin Initial Creation * Jul 8, 2008 randerso reworked + * Oct 23, 2012 1287 rferrel Changes for non-blocking AutoSaveIntervalDialog. * * * @@ -47,6 +49,7 @@ import com.raytheon.viz.gfe.jobs.AutoSaveJob; * @version 1.0 */ public class ShowAutoSaveIntervalDialog extends AbstractHandler { + private AutoSaveIntervalDialog dialog; /** * @@ -58,36 +61,50 @@ public class ShowAutoSaveIntervalDialog extends AbstractHandler { /* * (non-Javadoc) * - * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) + * @see + * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands + * .ExecutionEvent) */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - int interval = AutoSaveJob.getInterval(); - boolean autoSaveEnabled = interval > 0; - if (!autoSaveEnabled) { - interval = AutoSaveJob.MAX_INTERVAL; - } - - AutoSaveIntervalDialog dialog = new AutoSaveIntervalDialog(shell, - interval, autoSaveEnabled); - dialog.setBlockOnOpen(true); - dialog.open(); - - if (dialog.getReturnCode() == Window.OK) { - // update - if (dialog.isAutoSaveEnabled()) { - interval = dialog.getCurrentInterval(); - AutoSaveJob.setInterval(interval); - DataManager.enableAutoSave(); - } else { - AutoSaveJob.setInterval(0); - DataManager.disableAutoSave(); + int interval = AutoSaveJob.getInterval(); + boolean autoSaveEnabled = interval > 0; + if (!autoSaveEnabled) { + interval = AutoSaveJob.MAX_INTERVAL; } - } // else do nothing... + dialog = new AutoSaveIntervalDialog(shell, interval, + autoSaveEnabled); + dialog.setBlockOnOpen(false); + dialog.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof Integer) { + int returnCode = (Integer) returnValue; + if (returnCode == Window.OK) { + // update + if (dialog.isAutoSaveEnabled()) { + int interval = dialog.getCurrentInterval(); + AutoSaveJob.setInterval(interval); + DataManager.enableAutoSave(); + } else { + AutoSaveJob.setInterval(0); + DataManager.disableAutoSave(); + } + + } + } + } + }); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowBreakLock.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowBreakLock.java index f01e90d7f5..18e14eb625 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowBreakLock.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowBreakLock.java @@ -29,13 +29,14 @@ import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.dialogs.BreakLockDialog; /** - * TODO Add Description ShowBreakLock.java Jun 17, 2008 + * Action class to bring up the break locck dialog. * *
  * SOFTWARE HISTORY
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * 	Jun 17, 2008					Eric Babin Initial Creation
+ * Oct 27, 2012 1287       rferrel     Changes for non-blocking BreakLockDialog.
  * 
  * 
* @@ -44,6 +45,7 @@ import com.raytheon.viz.gfe.dialogs.BreakLockDialog; */ public class ShowBreakLock extends AbstractHandler { + private BreakLockDialog dialog; /* * (non-Javadoc) @@ -59,12 +61,16 @@ public class ShowBreakLock extends AbstractHandler { return null; } - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - BreakLockDialog dialog = new BreakLockDialog(shell, dm); - dialog.setBlockOnOpen(true); - dialog.open(); + dialog = new BreakLockDialog(shell, dm); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowCopyGridsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowCopyGridsDialog.java index afb7617abe..d4678d3cc2 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowCopyGridsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowCopyGridsDialog.java @@ -38,6 +38,7 @@ import com.raytheon.viz.gfe.dialogs.CopyGridsDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Feb 27, 2008 Eric Babin Initial Creation + * Oct 23, 2012 1287 rferrel Changes for non-blocking CopyGridsDialog. * * * @@ -47,9 +48,16 @@ import com.raytheon.viz.gfe.dialogs.CopyGridsDialog; public class ShowCopyGridsDialog extends AbstractHandler { - private static IUFStatusHandler statusHandler = UFStatus + private IUFStatusHandler statusHandler = UFStatus .getHandler(ShowCopyGridsDialog.class); + /** + * The active dialog. This assumes the dialog is modal. If the dialog is not + * modal then the current logic will bring the active dialog back to the top + * no matter which option is selected. + */ + private CopyGridsDialog dialog; + /* * (non-Javadoc) * @@ -64,27 +72,32 @@ public class ShowCopyGridsDialog extends AbstractHandler { return null; } - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - boolean isSelected; - String selectedOrAll = event.getParameter("selectedOrAll"); - if ("selected".equalsIgnoreCase(selectedOrAll)) { - isSelected = true; - } else if ("all".equalsIgnoreCase(selectedOrAll)) { - isSelected = false; + boolean isSelected; + String selectedOrAll = event.getParameter("selectedOrAll"); + if ("selected".equalsIgnoreCase(selectedOrAll)) { + isSelected = true; + } else if ("all".equalsIgnoreCase(selectedOrAll)) { + isSelected = false; + } else { + statusHandler + .error("Invalid parmeter \"" + + selectedOrAll + + "\" in ShowCopyGridsDialog. Value must be \"selected\" or \"all\"."); + dialog = null; + return null; + } + + dialog = new CopyGridsDialog(shell, dm, isSelected); + dialog.setBlockOnOpen(false); + dialog.open(); } else { - statusHandler - .error("Invalid parmeter \"" - + selectedOrAll - + "\" in ShowCopyGridsDialog. Value must be \"selected\" or \"all\"."); - return null; + dialog.bringToTop(); } - CopyGridsDialog dialog = new CopyGridsDialog(shell, dm, isSelected); - dialog.setBlockOnOpen(true); - dialog.open(); - return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowCreateFromScratchDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowCreateFromScratchDialog.java index 56f999a2ca..454abd7345 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowCreateFromScratchDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowCreateFromScratchDialog.java @@ -36,6 +36,7 @@ import com.raytheon.viz.gfe.dialogs.CreateFromScratchDialog; * ------------ ---------- ----------- -------------------------- * Feb 27, 2008 Eric Babin Initial Creation * 04/18/08 #857 bphillip Implemented interaction with server + * Oct 24, 2012 #1287 rferrel Changes for non-blocking CreateFromScratchDialog. * * * @@ -44,6 +45,7 @@ import com.raytheon.viz.gfe.dialogs.CreateFromScratchDialog; */ public class ShowCreateFromScratchDialog extends AbstractHandler { + private CreateFromScratchDialog dialog; /* * (non-Javadoc) @@ -54,12 +56,16 @@ public class ShowCreateFromScratchDialog extends AbstractHandler { */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - CreateFromScratchDialog dialog = new CreateFromScratchDialog(shell); - dialog.setBlockOnOpen(true); - dialog.open(); + dialog = new CreateFromScratchDialog(shell); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDefineRefSetDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDefineRefSetDialog.java index eb673f52bc..6609f65f73 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDefineRefSetDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDefineRefSetDialog.java @@ -36,6 +36,7 @@ import com.raytheon.viz.gfe.dialogs.DefineRefSetDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 11, 2008 Eric Babin Initial Creation + * Oct 24, 2012 1287 rferrel Changes for non-blocking DefineRefSetDialog. * * * @@ -63,11 +64,13 @@ public class ShowDefineRefSetDialog extends AbstractHandler { return null; } - if (dialog == null || dialog.getShell() == null) { + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { dialog = new DefineRefSetDialog(shell, dm); dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); } - dialog.open(); return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDefineSamplesLatLongAction.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDefineSamplesLatLongAction.java index 5f4fb08d4d..72ba619ce7 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDefineSamplesLatLongAction.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDefineSamplesLatLongAction.java @@ -36,6 +36,7 @@ import com.raytheon.viz.gfe.dialogs.DefineSamplesViaLatLongDialog; * ------------ ---------- ----------- -------------------------- * Feb 15, 2008 Eric Babin Initial Creation * Apr 9, 2009 1288 rjpeter Removed explicit refresh of SpatialDisplayManager. + * Oct 24, 2012 1287 rferrel Changes for non-blocking DefineSamplesViaLatLongDialog. * * * @@ -44,6 +45,7 @@ import com.raytheon.viz.gfe.dialogs.DefineSamplesViaLatLongDialog; */ public class ShowDefineSamplesLatLongAction extends AbstractHandler { + private DefineSamplesViaLatLongDialog dialog; /* * (non-Javadoc) @@ -54,13 +56,16 @@ public class ShowDefineSamplesLatLongAction extends AbstractHandler { */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - DefineSamplesViaLatLongDialog dialog = new DefineSamplesViaLatLongDialog( - shell); - dialog.setBlockOnOpen(true); - dialog.open(); + dialog = new DefineSamplesViaLatLongDialog(shell); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDeleteSampleSetDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDeleteSampleSetDialog.java index 3b5263ef2c..d4f11e3d5d 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDeleteSampleSetDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDeleteSampleSetDialog.java @@ -22,6 +22,7 @@ package com.raytheon.viz.gfe.actions; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.List; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; @@ -35,10 +36,9 @@ import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.viz.gfe.Activator; -import com.raytheon.viz.gfe.constants.StatusConstants; import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.dialogs.SampleSetDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * Action for launching delete samples dialog. @@ -49,6 +49,7 @@ import com.raytheon.viz.gfe.dialogs.SampleSetDialog; * ------------ ---------- ----------- -------------------------- * Mar 7, 2008 Eric Babin Initial Creation * 22JUL2008 #1275. Eric Babin Remove inadvertent dispose on parent shell. + * Oct 24, 2012 #1287 rferrel Changes for non-blocking SampleSetDialog. * * * @@ -57,7 +58,10 @@ import com.raytheon.viz.gfe.dialogs.SampleSetDialog; */ public class ShowDeleteSampleSetDialog extends AbstractHandler { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(ShowDeleteSampleSetDialog.class); + private final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(ShowDeleteSampleSetDialog.class); + + private SampleSetDialog dialog; /* * (non-Javadoc) @@ -68,44 +72,65 @@ public class ShowDeleteSampleSetDialog extends AbstractHandler { */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - ArrayList sampleIdList = DataManager.getCurrentInstance() - .getSampleSetManager().getInventoryAsList(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + ArrayList sampleIdList = DataManager.getCurrentInstance() + .getSampleSetManager().getInventoryAsList(); - Collections.sort(sampleIdList, new Comparator() { + Collections.sort(sampleIdList, new Comparator() { - @Override - public int compare(SampleId o1, SampleId o2) { - return o1.getName().compareTo(o2.getName()); - } + @Override + public int compare(SampleId o1, SampleId o2) { + return o1.getName().compareTo(o2.getName()); + } - }); + }); - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - SampleSetDialog dialog = new SampleSetDialog(shell, sampleIdList, - SampleSetDialog.DELETE); + dialog = new SampleSetDialog(shell, sampleIdList, + SampleSetDialog.DELETE); - dialog.setBlockOnOpen(true); - dialog.open(); - if (dialog.getReturnCode() != Window.CANCEL + dialog.setBlockOnOpen(false); + dialog.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof Integer) { + int returnCode = (Integer) returnValue; + doDialogClose(returnCode); + } + dialog = null; + } + }); + dialog.open(); + } else { + dialog.bringToTop(); + } + + return null; + } + + private void doDialogClose(int returnCode) { + if (returnCode != Window.CANCEL && dialog.getSelectedSampleIdIndexes() != null) { + List sampleIdList = dialog.getSamples(); SampleId id = sampleIdList .get(dialog.getSelectedSampleIdIndexes()[0]); + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); if (MessageDialog.openConfirm(shell, "Delete sample set", "Delete selected sample set?")) { if (DataManager.getCurrentInstance().getSampleSetManager() .deleteSampleSet(id)) { statusHandler.handle(Priority.EVENTA, id.getName() - + ", Sample set deleted successfully"); + + ", Sample set deleted successfully"); } else { statusHandler.handle(Priority.PROBLEM, "Error deleting sample set, " + id.getName()); } } } - - return null; } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDeleteSelectionTimeRangeDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDeleteSelectionTimeRangeDialog.java index b3a1fdf8bf..008605118d 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDeleteSelectionTimeRangeDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowDeleteSelectionTimeRangeDialog.java @@ -37,6 +37,7 @@ import com.raytheon.viz.gfe.dialogs.SaveDeleteSelectTRDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jan 23, 2008 Eric Babin Initial Creation + * Oct 25, 2012 1287 rferrel Changes for non-blocking ShowDeleteSelectionTimeRangeDialog. * * * @@ -46,7 +47,7 @@ import com.raytheon.viz.gfe.dialogs.SaveDeleteSelectTRDialog; public class ShowDeleteSelectionTimeRangeDialog extends AbstractHandler { - protected static final String DEFAULT_MSG = "You have selected delete on a default period. Only the user's entry of this item will be deleted. That is, the item will be reset to the Base default value. Continue?"; + private SaveDeleteSelectTRDialog dialog; /** * @@ -68,42 +69,17 @@ public class ShowDeleteSelectionTimeRangeDialog extends AbstractHandler { return null; } - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { - SaveDeleteSelectTRDialog dialog = new SaveDeleteSelectTRDialog(shell, - dataManager, "Delete"); - dialog.setBlockOnOpen(true); - dialog.open(); - // String delName = null; - // if (dialog.getReturnCode() == Window.OK) { - // delName = dialog.getItemToDelete(); - // if (selectTRmgr.getRange(delName).getLevel() != - // LocalizationLevel.USER) { - // // Confirm - // if (!MessageDialog.openConfirm(shell, - // "Default Time Period", DEFAULT_MSG)) { - // returnCode = Window.CANCEL; - // } - // } - // } - // - // if (returnCode == Window.OK) { - // selectTRmgr.remove(delName); - // TimeScaleDisplayedPeriodsPreference - // .removeTimeScaleDisplayedPeriod(delName); - // try { - // selectTRmgr.save(LocalizationLevel.USER); - // } catch (Exception e) { - // throw new ExecutionException( - // "Error saving SelectTimeRanges", e); - // } - // } - // } else { - // UFStatus.handle(Priority.PROBLEM, Activator.PLUGIN_ID, - // StatusConstants.CATEGORY_GFE, null, - // "Error loading time ranges"); - // } + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + + dialog = new SaveDeleteSelectTRDialog(shell, dataManager, "Delete"); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowEditActionsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowEditActionsDialog.java index 5032710dbe..22b72d5164 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowEditActionsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowEditActionsDialog.java @@ -36,6 +36,7 @@ import com.raytheon.viz.gfe.dialogs.EditActionsDialog; * ------------ ---------- ----------- -------------------------- * Feb 19, 2007 njensen Initial creation * Aug 05, 2010 6112 mpduff One, and only one, dialog open + * Oct 25, 2012 1287 rferrel Changes for non-blocking EditActionsDialog. * * * @@ -61,11 +62,13 @@ public class ShowEditActionsDialog extends AbstractHandler { // If the dialog doesn't exist, create one, otherwise call its open // method - if (dialog == null || dialog.getShell() == null) { + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { dialog = new EditActionsDialog(shell); dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); } - dialog.open(); return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowGridsInterpolationDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowGridsInterpolationDialog.java index c1c5175107..146eb577e3 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowGridsInterpolationDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowGridsInterpolationDialog.java @@ -30,6 +30,7 @@ import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.core.parm.Parm.InterpState; import com.raytheon.viz.gfe.core.parm.ParmState.InterpMode; import com.raytheon.viz.gfe.dialogs.GridsInterpolateDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * Handler to show Grid Interpolation Dialog and initiate interpolation @@ -40,6 +41,7 @@ import com.raytheon.viz.gfe.dialogs.GridsInterpolateDialog; * ------------ ---------- -------------- -------------------------- * Feb 27, 2008 Eric Babin Initial Creation * Jun 4, 2008 #1161 Ron Anderson Reworked + * Oct 25, 2012 #1287 rferrel Changes for non-blocking GridsInterpolateDialog. * * * @@ -48,6 +50,7 @@ import com.raytheon.viz.gfe.dialogs.GridsInterpolateDialog; */ public class ShowGridsInterpolationDialog extends AbstractHandler { + private GridsInterpolateDialog dialog; /* * (non-Javadoc) @@ -58,20 +61,38 @@ public class ShowGridsInterpolationDialog extends AbstractHandler { */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - GridsInterpolateDialog dialog = new GridsInterpolateDialog(shell); - dialog.setBlockOnOpen(true); + dialog = new GridsInterpolateDialog(shell); + dialog.setBlockOnOpen(false); + dialog.setCloseCallback(new ICloseCallback() { - if (dialog.open() == IDialogConstants.OK_ID) { - InterpMode interpMode = dialog.getInterpMode(); - int interval = dialog.getInterval() * 3600; - int duration = dialog.getDuration() * 3600; + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof Integer) { + int returnCode = (Integer) returnValue; + if (returnCode == IDialogConstants.OK_ID) { + InterpMode interpMode = dialog.getInterpMode(); + int interval = dialog.getInterval() * 3600; + int duration = dialog.getDuration() * 3600; - DataManager.getCurrentInstance().getParmOp().interpolateSelected( - interpMode, InterpState.ASYNC, interval, duration); - } // else do nothing... + DataManager + .getCurrentInstance() + .getParmOp() + .interpolateSelected(interpMode, + InterpState.ASYNC, interval, + duration); + } + } + dialog = null; + } + }); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowHiddenWeatherElementDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowHiddenWeatherElementDialog.java index 3dd26a91dc..8a2577c5ec 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowHiddenWeatherElementDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowHiddenWeatherElementDialog.java @@ -30,13 +30,14 @@ import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.dialogs.HiddenWeatherElementDialog; /** - * TODO Add Description ShowHiddenWeatherElementDialog.java Feb 27, 2008 + * Action class to dispaly the Hidden Weather Dialog. * *
  * SOFTWARE HISTORY
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * 	Feb 27, 2008					Eric Babin Initial Creation
+ * Oct 25, 2012 1287       rferrel     Changes for non-blocking HiddenWeatherElementDialog.
  * 
  * 
* @@ -45,6 +46,7 @@ import com.raytheon.viz.gfe.dialogs.HiddenWeatherElementDialog; */ public class ShowHiddenWeatherElementDialog extends AbstractHandler { + private HiddenWeatherElementDialog dialog; /* * (non-Javadoc) @@ -61,18 +63,24 @@ public class ShowHiddenWeatherElementDialog extends AbstractHandler { return null; } - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { - if (dataManager.getParmManager().getUndisplayedParms().length > 0) { - HiddenWeatherElementDialog dialog = new HiddenWeatherElementDialog( - shell, dataManager); - dialog.setBlockOnOpen(true); - dialog.open(); + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + if (dataManager.getParmManager().getUndisplayedParms().length > 0) { + dialog = new HiddenWeatherElementDialog(shell, dataManager); + dialog.setBlockOnOpen(false); + dialog.open(); + + } else { + dialog = null; + MessageDialog.openInformation(null, + "No Hidden Weather Elements", + "No Hidden Weather Elements found."); + } } else { - MessageDialog.openInformation(null, "No Hidden Weather Elements", - "No Hidden Weather Elements found."); + dialog.bringToTop(); } return null; diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowLoadSampleSetDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowLoadSampleSetDialog.java index a548be78a5..0ec6d9b48f 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowLoadSampleSetDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowLoadSampleSetDialog.java @@ -22,6 +22,7 @@ package com.raytheon.viz.gfe.actions; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.List; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; @@ -31,10 +32,14 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.viz.gfe.GFEException; import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.core.ISampleSetManager; import com.raytheon.viz.gfe.dialogs.SampleSetDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * Action to launch sampele set dialog. @@ -45,6 +50,7 @@ import com.raytheon.viz.gfe.dialogs.SampleSetDialog; * ------------ ---------- ----------- -------------------------- * Mar 7, 2008 Eric Babin Initial Creation * Apr 9, 2009 1288 rjpeter Removed explicit refresh of SpatialDisplayManager. + * Oct 24, 2012 1287 rferrel Changes for non-blocking SampleSetDialog. * * * @@ -53,14 +59,12 @@ import com.raytheon.viz.gfe.dialogs.SampleSetDialog; */ public class ShowLoadSampleSetDialog extends AbstractHandler { + private final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(ShowLoadSampleSetDialog.class); - // SampleRenderable sample; + private SampleSetDialog dialog; - // public ShowLoadSampleSetDialog() { - // - // super(); - // this.sample = new SampleRenderable(); - // } + private DataManager dm; /* * (non-Javadoc) @@ -71,96 +75,81 @@ public class ShowLoadSampleSetDialog extends AbstractHandler { */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - - DataManager dm = DataManager.getCurrentInstance(); - if (dm == null) { - return null; - } - - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - - ArrayList sampleIdList = dm.getSampleSetManager() - .getInventoryAsList(); - - Collections.sort(sampleIdList, new Comparator() { - - @Override - public int compare(SampleId o1, SampleId o2) { - return o1.getName().compareTo(o2.getName()); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + dm = DataManager.getCurrentInstance(); + if (dm == null) { + return null; } - }); + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - SampleSetDialog dialog = new SampleSetDialog(shell, sampleIdList, - SampleSetDialog.LOAD); + ArrayList sampleIdList = dm.getSampleSetManager() + .getInventoryAsList(); - dialog.setBlockOnOpen(true); - dialog.open(); - if (dialog.getReturnCode() != Window.CANCEL - && dialog.getSelectedSampleIdIndexes() != null) { - if (dialog.getReturnCode() == SampleSetDialog.OK) { - if (dialog.getType() == SampleSetDialog.LOAD) { - for (int i = 0; i < dialog.getSelectedSampleIdIndexes().length; i++) { - SampleId id = sampleIdList.get(dialog - .getSelectedSampleIdIndexes()[i]); - try { - dm.getSampleSetManager().loadSampleSet(id, - ISampleSetManager.SampleSetLoadMode.ADD); - } catch (GFEException e) { - e.printStackTrace(); - } - } - } else if (dialog.getType() == SampleSetDialog.SAVE) { - dm.getSampleSetManager().saveActiveSampleSet( - new SampleId(dialog.getSampleName())); - } - if (dialog.getType() == SampleSetDialog.DELETE) { - for (int i = 0; i < dialog.getSelectedSampleIdIndexes().length; i++) { - SampleId id = sampleIdList.get(dialog - .getSelectedSampleIdIndexes()[i]); - dm.getSampleSetManager().deleteSampleSet(id); - } - } - } else if (dialog.getReturnCode() == SampleSetDialog.REMOVE) { - for (int i = 0; i < dialog.getSelectedSampleIdIndexes().length; i++) { - SampleId id = sampleIdList.get(dialog - .getSelectedSampleIdIndexes()[i]); - try { - dm.getSampleSetManager().loadSampleSet(id, - ISampleSetManager.SampleSetLoadMode.REMOVE); - } catch (GFEException e) { - e.printStackTrace(); - } + Collections.sort(sampleIdList, new Comparator() { + + @Override + public int compare(SampleId o1, SampleId o2) { + return o1.getName().compareTo(o2.getName()); } - } else if (dialog.getReturnCode() == SampleSetDialog.REPLACE) { - for (int i = 0; i < dialog.getSelectedSampleIdIndexes().length; i++) { - SampleId id = sampleIdList.get(dialog - .getSelectedSampleIdIndexes()[i]); - try { - dm.getSampleSetManager().loadSampleSet(id, - ISampleSetManager.SampleSetLoadMode.REPLACE); - } catch (GFEException e) { - e.printStackTrace(); + }); + + dialog = new SampleSetDialog(shell, sampleIdList, + SampleSetDialog.LOAD); + + dialog.setBlockOnOpen(false); + dialog.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof Integer) { + int returnCode = (Integer) returnValue; + doDialogClosed(returnCode); } + dialog = null; } - } + }); + + dialog.open(); + } else { + dialog.bringToTop(); } - // refresh(); return null; } - /* - * (non-Javadoc) - * - * @see com.raytheon.viz.ui.tools.AbstractTool#refresh() - */ - // @Override - // protected void refresh() { - // IEditorPart part = VizApp.getCurrentEditor(); - // if (part instanceof AbstractEditor) { - // ((AbstractEditor) part).refresh(); - // } - // } + private void doDialogClosed(int returnCode) { + if (returnCode != Window.CANCEL + && dialog.getSelectedSampleIdIndexes() != null) { + List sampleIdList = dialog.getSamples(); + ISampleSetManager.SampleSetLoadMode mode = null; + switch (returnCode) { + case SampleSetDialog.OK: + mode = ISampleSetManager.SampleSetLoadMode.ADD; + break; + case SampleSetDialog.REMOVE: + mode = ISampleSetManager.SampleSetLoadMode.REMOVE; + break; + case SampleSetDialog.REPLACE: + mode = ISampleSetManager.SampleSetLoadMode.REPLACE; + break; + default: + statusHandler.handle(Priority.PROBLEM, + "Load unknow return code: " + returnCode); + return; + } + + for (int index : dialog.getSelectedSampleIdIndexes()) { + SampleId id = sampleIdList.get(index); + try { + dm.getSampleSetManager().loadSampleSet(id, mode); + } catch (GFEException e) { + statusHandler.handle(Priority.ERROR, + "Load failed for mode: " + mode.toString() + + ", sample id: " + id.toString(), e); + } + } + } + } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowProcessMonitorDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowProcessMonitorDialog.java index ed16c356bf..ed02a3eb95 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowProcessMonitorDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowProcessMonitorDialog.java @@ -35,6 +35,7 @@ import com.raytheon.viz.gfe.dialogs.ProcessMonitorDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 7, 2008 Eric Babin Initial Creation + * Oct 25, 2012 1287 rferrel Change for non-blocking ProcessMonitorDialog. * * * @@ -43,6 +44,7 @@ import com.raytheon.viz.gfe.dialogs.ProcessMonitorDialog; */ public class ShowProcessMonitorDialog extends AbstractHandler { + private ProcessMonitorDialog dialog; /* * (non-Javadoc) @@ -53,13 +55,16 @@ public class ShowProcessMonitorDialog extends AbstractHandler { */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - ProcessMonitorDialog dialog = new ProcessMonitorDialog(shell); - - dialog.setBlockOnOpen(false); - dialog.open(); + dialog = new ProcessMonitorDialog(shell); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowProductScriptsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowProductScriptsDialog.java index 6826a15751..93b5ba9975 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowProductScriptsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowProductScriptsDialog.java @@ -36,6 +36,7 @@ import com.raytheon.viz.gfe.dialogs.ProductScriptsDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 6, 2008 Eric Babin Initial Creation + * Oct 25, 2012 12878 rferrel Changes for non-blocking ProductScriptsDialog. * * * @@ -44,6 +45,7 @@ import com.raytheon.viz.gfe.dialogs.ProductScriptsDialog; */ public class ShowProductScriptsDialog extends AbstractHandler { + private ProductScriptsDialog dialog; /* * (non-Javadoc) @@ -59,12 +61,16 @@ public class ShowProductScriptsDialog extends AbstractHandler { return null; } - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - ProductScriptsDialog dialog = new ProductScriptsDialog(shell, dm); - dialog.setBlockOnOpen(true); - dialog.open(); + dialog = new ProductScriptsDialog(shell, dm); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowPublishDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowPublishDialog.java index 4df859103f..8ce0df6218 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowPublishDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowPublishDialog.java @@ -36,6 +36,7 @@ import com.raytheon.viz.gfe.dialogs.PublishDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 6, 2008 Eric Babin Initial Creation + * Oct 25, 2012 1287 rferrel Changes for non-blocking PublishDialog. * * * @@ -44,6 +45,7 @@ import com.raytheon.viz.gfe.dialogs.PublishDialog; */ public class ShowPublishDialog extends AbstractHandler { + private PublishDialog dialog; /* * (non-Javadoc) @@ -54,14 +56,21 @@ public class ShowPublishDialog extends AbstractHandler { */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - DataManager dm = DataManager.getCurrentInstance(); - if (dm != null) { + + if (dm == null) { + return null; + } + + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + PublishDialog dialog = new PublishDialog(shell, dm); - dialog.setBlockOnOpen(true); + dialog.setBlockOnOpen(false); dialog.open(); + } else { + dialog.bringToTop(); } return null; @@ -80,8 +89,8 @@ public class ShowPublishDialog extends AbstractHandler { DataManager dm = DataManager.getCurrentInstance(); if (dm != null) { - return !dm.getParmManager().getMutableDatabase().equals( - dm.getParmManager().getProductDB()); + return !dm.getParmManager().getMutableDatabase() + .equals(dm.getParmManager().getProductDB()); } return false; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowRefSetAreaAppearance.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowRefSetAreaAppearance.java index 8fe6aceae5..9029af0bb9 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowRefSetAreaAppearance.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowRefSetAreaAppearance.java @@ -36,6 +36,7 @@ import com.raytheon.viz.gfe.dialogs.RefSetAppearanceDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Aug 24, 2009 #2948 randerso Initial creation + * Oct 25, 2012 #1287 rferrel Changes for non-blocking RefSetAppearanceDialog. * * * @@ -44,6 +45,7 @@ import com.raytheon.viz.gfe.dialogs.RefSetAppearanceDialog; */ public class ShowRefSetAreaAppearance extends AbstractHandler { + private RefSetAppearanceDialog dialog; /* * (non-Javadoc) @@ -54,11 +56,15 @@ public class ShowRefSetAreaAppearance extends AbstractHandler { */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - RefSetAppearanceDialog dlg = new RefSetAppearanceDialog(shell); - dlg.setBlockOnOpen(false); - dlg.open(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + dialog = new RefSetAppearanceDialog(shell); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowRevertForecastDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowRevertForecastDialog.java index a18a22d948..9ee2322d98 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowRevertForecastDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowRevertForecastDialog.java @@ -37,6 +37,7 @@ import com.raytheon.viz.gfe.dialogs.WERevertDialog; * ------------ ---------- ----------- -------------------------- * Feb 27, 2008 Eric Babin Initial Creation * 07/09/2008 962 bphillip Integrated functionality + * Oct 26, 2012 1287 rferrel Changes for non-blocking WERevertDialog. * * * @@ -45,6 +46,7 @@ import com.raytheon.viz.gfe.dialogs.WERevertDialog; */ public class ShowRevertForecastDialog extends AbstractHandler { + private WERevertDialog dialog; /* * (non-Javadoc) @@ -60,13 +62,17 @@ public class ShowRevertForecastDialog extends AbstractHandler { return null; } - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - WERevertDialog dialog = new WERevertDialog(shell, dm); + dialog = new WERevertDialog(shell, dm); - dialog.setBlockOnOpen(true); - dialog.open(); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSaveForecastDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSaveForecastDialog.java index 67d515c49e..e5d7cf4e61 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSaveForecastDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSaveForecastDialog.java @@ -37,6 +37,7 @@ import com.raytheon.viz.gfe.dialogs.WESaveDialog; * ------------ ---------- ----------- -------------------------- * Feb 27, 2008 Eric Babin Initial Creation * Apr 17, 2008 875 bphillip Added interaction with server + * Oct 26, 2012 1287 rferrel Changes for non-blocking WESaveDialog. * * * @@ -45,6 +46,7 @@ import com.raytheon.viz.gfe.dialogs.WESaveDialog; */ public class ShowSaveForecastDialog extends AbstractHandler { + private WESaveDialog dialog; /* * (non-Javadoc) @@ -60,13 +62,17 @@ public class ShowSaveForecastDialog extends AbstractHandler { return null; } - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - WESaveDialog dialog = new WESaveDialog(shell, dm); + WESaveDialog dialog = new WESaveDialog(shell, dm); - dialog.setBlockOnOpen(true); - dialog.open(); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSaveSampleSetDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSaveSampleSetDialog.java index 6f9395daef..bc60450472 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSaveSampleSetDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSaveSampleSetDialog.java @@ -26,7 +26,6 @@ import java.util.Comparator; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import org.eclipse.jface.window.Window; import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.PlatformUI; @@ -34,6 +33,7 @@ import com.raytheon.uf.common.dataplugin.gfe.sample.SampleId; import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.core.ISampleSetManager; import com.raytheon.viz.gfe.dialogs.SampleSetDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * Action to show save sample set dialog. @@ -43,6 +43,7 @@ import com.raytheon.viz.gfe.dialogs.SampleSetDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 7, 2008 Eric Babin Initial Creation + * Oct 24, 2012 1287 rferrel Changes for non-blocking SampleSetDialog. * * * @@ -51,54 +52,62 @@ import com.raytheon.viz.gfe.dialogs.SampleSetDialog; */ public class ShowSaveSampleSetDialog extends AbstractHandler { + private SampleSetDialog dialog; + + private ISampleSetManager sampleMgr; /* * (non-Javadoc) * - * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent) + * @see + * org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands + * .ExecutionEvent) */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + sampleMgr = DataManager.getCurrentInstance().getSampleSetManager(); - ISampleSetManager sampleMgr = DataManager.getCurrentInstance() - .getSampleSetManager(); + ArrayList sampleIdList = sampleMgr.getInventoryAsList(); + Collections.sort(sampleIdList, new Comparator() { - ArrayList sampleIdList = sampleMgr.getInventoryAsList(); - Collections.sort(sampleIdList, new Comparator() { + @Override + public int compare(SampleId o1, SampleId o2) { + return o1.getName().compareTo(o2.getName()); + } - @Override - public int compare(SampleId o1, SampleId o2) { - return o1.getName().compareTo(o2.getName()); - } + }); - }); + dialog = new SampleSetDialog(shell, sampleIdList, + SampleSetDialog.SAVE); - SampleSetDialog dialog = new SampleSetDialog(shell, sampleIdList, - SampleSetDialog.SAVE); + dialog.setBlockOnOpen(false); + dialog.setCloseCallback(new ICloseCallback() { - dialog.setBlockOnOpen(true); - dialog.open(); - - if (dialog.getReturnCode() != Window.CANCEL - && dialog.getSelectedSampleIdIndexes() != null) { - - if (dialog.getReturnCode() == SampleSetDialog.OK) { - if (dialog.getType() == SampleSetDialog.LOAD) { - } else if (dialog.getType() == SampleSetDialog.SAVE) { - if (dialog.getSampleName() != null) { - sampleMgr.saveActiveSampleSet(new SampleId(dialog - .getSampleName())); + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof Integer) { + int returnCode = (Integer) returnValue; + doDialogClose(returnCode); } + dialog = null; } - if (dialog.getType() == SampleSetDialog.DELETE) { - } - } else if (dialog.getReturnCode() == SampleSetDialog.REMOVE) { - } else if (dialog.getReturnCode() == SampleSetDialog.REPLACE) { - } + }); + dialog.open(); + } else { + dialog.bringToTop(); } return null; } + + private void doDialogClose(int returnCode) { + if ((returnCode == SampleSetDialog.OK) + && (dialog.getSelectedSampleIdIndexes() != null) + && (dialog.getSampleName() != null)) { + sampleMgr.saveActiveSampleSet(new SampleId(dialog.getSampleName())); + } + } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSaveSelectionTimeRangeDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSaveSelectionTimeRangeDialog.java index d7f4f6472b..570c6cadaa 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSaveSelectionTimeRangeDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSaveSelectionTimeRangeDialog.java @@ -38,6 +38,7 @@ import com.raytheon.viz.gfe.dialogs.SaveDeleteSelectTRDialog; * ------------ ---------- ----------- -------------------------- * Jan 23, 2008 Eric Babin Initial Creation * Nov 11, 2008 1213 wdougherty Use SelectTimeRangeContainer + * Oct 25, 2012 1287 rferrel Code changes for non-blocking SaveDeleteSelectTRDialog. * * * @@ -46,6 +47,7 @@ import com.raytheon.viz.gfe.dialogs.SaveDeleteSelectTRDialog; */ public class ShowSaveSelectionTimeRangeDialog extends AbstractHandler { + private SaveDeleteSelectTRDialog dialog; public ShowSaveSelectionTimeRangeDialog() { } @@ -64,13 +66,16 @@ public class ShowSaveSelectionTimeRangeDialog extends AbstractHandler { return null; } - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - SaveDeleteSelectTRDialog dialog = new SaveDeleteSelectTRDialog(shell, - dataManager, "Save"); - dialog.setBlockOnOpen(true); - dialog.open(); + dialog = new SaveDeleteSelectTRDialog(shell, dataManager, "Save"); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSetInterpolationAlgorithmDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSetInterpolationAlgorithmDialog.java index 43677f6af8..c3096d8110 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSetInterpolationAlgorithmDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSetInterpolationAlgorithmDialog.java @@ -36,6 +36,7 @@ import com.raytheon.viz.gfe.dialogs.SetInterpolationAlgorithmDialog; * ------------ ---------- ----------- -------------------------- * Feb 27, 2008 Eric Babin Initial Creation * Jun 4, 2008 #1161 randerso Reworked + * Oct 26, 2012 1287 rferrel Change for non-blocking SetInterpolationAlgorithmDialog. * * * @@ -43,16 +44,20 @@ import com.raytheon.viz.gfe.dialogs.SetInterpolationAlgorithmDialog; * @version 1.0 */ public class ShowSetInterpolationAlgorithmDialog extends AbstractHandler { + private SetInterpolationAlgorithmDialog dialog; @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - SetInterpolationAlgorithmDialog dialog = new SetInterpolationAlgorithmDialog( - shell); - dialog.setBlockOnOpen(true); - dialog.open(); + dialog = new SetInterpolationAlgorithmDialog(shell); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSiteActivationDlg.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSiteActivationDlg.java index 54759e3ff4..e61c8257fd 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSiteActivationDlg.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowSiteActivationDlg.java @@ -37,6 +37,7 @@ import com.raytheon.viz.gfe.dialogs.sbu.SiteActivationDlg; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Aug 5, 2011 randerso Initial creation + * Oct 26, 2012 1287 rferrel Changes for non-blocking SiteActivationDlg. * * * @@ -45,6 +46,7 @@ import com.raytheon.viz.gfe.dialogs.sbu.SiteActivationDlg; */ public class ShowSiteActivationDlg extends AbstractHandler { + private SiteActivationDlg dialog; /* * (non-Javadoc) @@ -55,12 +57,16 @@ public class ShowSiteActivationDlg extends AbstractHandler { */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - SiteActivationDlg dialog = new SiteActivationDlg(shell); - dialog.setBlockOnOpen(true); - dialog.open(); + dialog = new SiteActivationDlg(shell); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowTemporalEditorRangeStatisticsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowTemporalEditorRangeStatisticsDialog.java index f8564885ce..53c4281bb2 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowTemporalEditorRangeStatisticsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowTemporalEditorRangeStatisticsDialog.java @@ -36,12 +36,15 @@ import com.raytheon.viz.gfe.dialogs.TemporalEditorRangeStatisticsDialog; * ------------ ---------- ------------- -------------------------- * Feb 14, 2008 Eric Babin Initial Creation * Jun 04, 2009 #2159 Richard Peter Moved initialization to Dialog. + * Oct 26, 2012 1287 rferrel Changes for non-blocking TemporalEditorRangeStatisticsDialog. * * * @author ebabin * @version 1.0 */ public class ShowTemporalEditorRangeStatisticsDialog extends AbstractHandler { + private TemporalEditorRangeStatisticsDialog dialog; + /* * (non-Javadoc) * @@ -51,13 +54,16 @@ public class ShowTemporalEditorRangeStatisticsDialog extends AbstractHandler { */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - TemporalEditorRangeStatisticsDialog dialog = new TemporalEditorRangeStatisticsDialog( - shell); - dialog.setBlockOnOpen(true); - dialog.open(); + dialog = new TemporalEditorRangeStatisticsDialog(shell); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowTimeScalePeriodsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowTimeScalePeriodsDialog.java index 7a92a1d4e5..3e2285aac2 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowTimeScalePeriodsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/actions/ShowTimeScalePeriodsDialog.java @@ -30,7 +30,7 @@ import com.raytheon.viz.gfe.core.ISelectTimeRangeManager; import com.raytheon.viz.gfe.dialogs.TimeScalePeriodsDialog; /** - * TODO Add Description + * Action class to display the Time Scale Periods dialog. * *
  * 
@@ -38,6 +38,7 @@ import com.raytheon.viz.gfe.dialogs.TimeScalePeriodsDialog;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Apr 23, 2009            randerso     Initial creation
+ * Oct 29, 2012 1287       rferrel     Changes for non-blocking TimeScalePeriodsDialog.
  * 
  * 
* @@ -46,6 +47,7 @@ import com.raytheon.viz.gfe.dialogs.TimeScalePeriodsDialog; */ public class ShowTimeScalePeriodsDialog extends AbstractHandler { + private TimeScalePeriodsDialog dialog; /* * (non-Javadoc) @@ -61,16 +63,20 @@ public class ShowTimeScalePeriodsDialog extends AbstractHandler { return null; } - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { - ISelectTimeRangeManager selectTRmgr = dataManager - .getSelectTimeRangeManager(); + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - TimeScalePeriodsDialog dialog = new TimeScalePeriodsDialog(shell, - selectTRmgr); - dialog.setBlockOnOpen(true); - dialog.open(); + ISelectTimeRangeManager selectTRmgr = dataManager + .getSelectTimeRangeManager(); + + dialog = new TimeScalePeriodsDialog(shell, selectTRmgr); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } return null; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/CopyGridsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/CopyGridsDialog.java index 6f3a8fd575..fa7a0c5bfe 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/CopyGridsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/CopyGridsDialog.java @@ -46,6 +46,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Feb 26, 2008 Eric Babin Initial Creation + * Oct 23, 2012 1287 rferrel Made dialog modal like AWIPS 1. * * * @@ -70,7 +71,7 @@ public class CopyGridsDialog extends CaveJFACEDialog { super(parent); this.dataManager = dataManager; this.parmMgr = dataManager.getParmManager(); - this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE); + this.setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL); this.isSelected = isSelectedType; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/CreateFromScratchDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/CreateFromScratchDialog.java index 151221aef4..6bb169e0b2 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/CreateFromScratchDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/CreateFromScratchDialog.java @@ -46,6 +46,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Feb 26, 2008 Eric Babin Initial Creation + * Oct 24, 2012 1287 rferrel Changes for non-blocking dialog. * * * @@ -75,7 +76,7 @@ public class CreateFromScratchDialog extends CaveJFACEDialog { public CreateFromScratchDialog(Shell parent) { super(parent); - this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE); + this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS); } @@ -130,8 +131,8 @@ public class CreateFromScratchDialog extends CaveJFACEDialog { intervalLabel = new Label(top, SWT.NONE); data = new GridData(30, SWT.DEFAULT); intervalLabel.setLayoutData(data); - intervalLabel.setText(Integer - .toString(intervalScale.getSelection())); + intervalLabel + .setText(Integer.toString(intervalScale.getSelection())); } @@ -157,8 +158,8 @@ public class CreateFromScratchDialog extends CaveJFACEDialog { durationLabel = new Label(top, SWT.NONE); data = new GridData(30, SWT.DEFAULT); durationLabel.setLayoutData(data); - durationLabel.setText(Integer - .toString(durationScale.getSelection())); + durationLabel + .setText(Integer.toString(durationScale.getSelection())); } } @@ -167,8 +168,8 @@ public class CreateFromScratchDialog extends CaveJFACEDialog { if (displayDuration) { durationScale.setSelection(intervalScale.getSelection()); - durationLabel.setText(Integer - .toString(durationScale.getSelection())); + durationLabel + .setText(Integer.toString(durationScale.getSelection())); } } @@ -272,7 +273,9 @@ public class CreateFromScratchDialog extends CaveJFACEDialog { createDuration = durationScale.getSelection(); } - DataManager.getCurrentInstance().getParmOp() + DataManager + .getCurrentInstance() + .getParmOp() .createFromScratchSelected(mode, createInterval * 3600, createDuration * 3600); diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DefineRefSetDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DefineRefSetDialog.java index 4324498a8d..fe939c7d8e 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DefineRefSetDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DefineRefSetDialog.java @@ -90,6 +90,9 @@ import com.vividsolutions.jts.geom.MultiPolygon; * ------------ ---------- ----------- -------------------------- * Mar 11, 2008 Eric Babin Initial Creation * Jul 15, 2008 njensen Hooked into backend/fixes + * Oct 24, 2012 1287 rferrel Code clean up for non-blocking dialog. + * Oct 24, 2012 1287 rferrel Changes for non-blocking SaveDeleteRefDialog. + * Oct 24, 2012 1287 rferrel Changes for non-blocking SaveDeleteEditAreaGroupDialog. * * * @@ -101,18 +104,18 @@ public class DefineRefSetDialog extends CaveJFACEDialog implements IReferenceSetChangedListener, IReferenceSetIDChangedListener, IReferenceSetInvChangedListener, IDisplayedParmListChangedListener, IEditAreaGroupInvChangedListener { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(DefineRefSetDialog.class); - private static final int NUM_ITEMS = 13; + private final int NUM_ITEMS = 13; - private static final int CLEAR_QUERY_ID = IDialogConstants.CLIENT_ID + 1; + private final int CLEAR_QUERY_ID = IDialogConstants.CLIENT_ID + 1; - private static final int RECALL_QUERY_ID = IDialogConstants.CLIENT_ID + 2; + private final int RECALL_QUERY_ID = IDialogConstants.CLIENT_ID + 2; - private static final int UNDO_EDIT_AREA_ID = IDialogConstants.CLIENT_ID + 3; + private final int UNDO_EDIT_AREA_ID = IDialogConstants.CLIENT_ID + 3; - private static final int CONVERT_TO_LOCATION_ID = IDialogConstants.CLIENT_ID + 4; + private final int CONVERT_TO_LOCATION_ID = IDialogConstants.CLIENT_ID + 4; private Composite top; @@ -154,10 +157,6 @@ public class DefineRefSetDialog extends CaveJFACEDialog implements { "3", "" }, { "-", "" }, { "0", "" }, { ".", "" }, { "BS", "BackSpace" }, { "", "" }, { "SP", "Space" }, }; - // private java.util.List gList; - - // private HashMap> editAreaMap; - private IReferenceSetManager refSetMgr; private IParmManager parmManager; @@ -166,9 +165,17 @@ public class DefineRefSetDialog extends CaveJFACEDialog implements private String[] initialGroups; + private SaveDeleteRefDialog deleteDlg; + + private SaveDeleteRefDialog saveDlg; + + private SaveDeleteEditAreaGroupDialog deleteGroupDlg; + + private SaveDeleteEditAreaGroupDialog saveGroupDlg; + public DefineRefSetDialog(Shell parent, DataManager dataManager) { super(parent); - this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE); + this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS); this.dataManager = dataManager; this.refSetMgr = this.dataManager.getRefManager(); this.parmManager = this.dataManager.getParmManager(); @@ -1002,34 +1009,53 @@ public class DefineRefSetDialog extends CaveJFACEDialog implements private void saveAreaCB() { - SaveDeleteRefDialog dialog = new SaveDeleteRefDialog(getShell(), - this.refSetMgr, "Save"); - - dialog.open(); - + if (saveDlg == null || saveDlg.getShell() == null + || saveDlg.isDisposed()) { + saveDlg = new SaveDeleteRefDialog(getShell(), this.refSetMgr, + "Save"); + saveDlg.setBlockOnOpen(false); + saveDlg.open(); + } else { + saveDlg.bringToTop(); + } } private void deleteAreaCB() { - SaveDeleteRefDialog dialog = new SaveDeleteRefDialog(this.getShell(), - refSetMgr, "Delete"); - dialog.open(); - + if (deleteDlg == null || deleteDlg.getShell() == null + || deleteDlg.isDisposed()) { + deleteDlg = new SaveDeleteRefDialog(this.getShell(), refSetMgr, + "Delete"); + deleteDlg.setBlockOnOpen(false); + deleteDlg.open(); + } else { + deleteDlg.bringToTop(); + } } private void saveGroupCB() { - SaveDeleteEditAreaGroupDialog dialog = new SaveDeleteEditAreaGroupDialog( - getShell(), this.refSetMgr, "Save"); - dialog.setBlockOnOpen(true); - dialog.open(); + if (deleteGroupDlg == null || deleteGroupDlg.getShell() == null + || deleteGroupDlg.isDisposed()) { + deleteGroupDlg = new SaveDeleteEditAreaGroupDialog(getShell(), + this.refSetMgr, "Save"); + deleteGroupDlg.setBlockOnOpen(false); + deleteGroupDlg.open(); + } else { + deleteGroupDlg.bringToTop(); + } } private void deleteGroupCB() { - SaveDeleteEditAreaGroupDialog dialog = new SaveDeleteEditAreaGroupDialog( - getShell(), this.refSetMgr, "Delete"); - dialog.setBlockOnOpen(true); - dialog.open(); + if (saveGroupDlg == null || saveGroupDlg.getShell() == null + || saveGroupDlg.isDisposed()) { + saveGroupDlg = new SaveDeleteEditAreaGroupDialog(getShell(), + this.refSetMgr, "Delete"); + saveGroupDlg.setBlockOnOpen(false); + saveGroupDlg.open(); + } else { + saveGroupDlg.bringToTop(); + } } private void addToQueryField(String s) { diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DefineSamplesViaLatLongDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DefineSamplesViaLatLongDialog.java index 49bcd0d708..56533b3245 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DefineSamplesViaLatLongDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DefineSamplesViaLatLongDialog.java @@ -43,6 +43,7 @@ import com.vividsolutions.jts.geom.Coordinate; * ------------ ---------- ----------- -------------------------- * Feb 15, 2008 Eric Babin Initial Creation * 04/10/2009 #1290 rjpeter Moved field validation to when ok pressed. + * Oct 24, 2012 #1287 rferrel Change shell style. * * * @author ebabin @@ -61,7 +62,7 @@ public class DefineSamplesViaLatLongDialog extends CaveJFACEDialog { public DefineSamplesViaLatLongDialog(Shell parent) { super(parent); - this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE); + this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS); } @Override diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DisplayAttributesDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DisplayAttributesDialog.java index 8b617519c5..15f4f03bd5 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DisplayAttributesDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/DisplayAttributesDialog.java @@ -51,6 +51,8 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jun 11, 2008 Eric Babin Initial Creation + * Oct 22, 2012 1287 rferrel Make dialog application modal + * and non-blocking. * * * @@ -84,7 +86,7 @@ public class DisplayAttributesDialog extends CaveJFACEDialog { public DisplayAttributesDialog(Shell parent, GFEResource rsc) { super(parent); - this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE); + this.setShellStyle(SWT.TITLE | SWT.APPLICATION_MODAL | SWT.CLOSE); this.parm = rsc.getParm(); @@ -100,6 +102,7 @@ public class DisplayAttributesDialog extends CaveJFACEDialog { startImageTypes = null; startGraphicTypes = null; + setBlockOnOpen(false); } @Override diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/EditActionsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/EditActionsDialog.java index fb0bf29d5b..57d87ac4c5 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/EditActionsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/EditActionsDialog.java @@ -58,6 +58,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; * ------------ ---------- ----------- -------------------------- * Feb 18, 2007 njensen Initial creation. * 05Aug2008 #1407 ebabin Dim delta button for wx/discrete types. + * Oct 25, 2012 #1287 rferrel Code clean up part of non-blocking dialog. * * * @author njensen @@ -67,15 +68,15 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; public class EditActionsDialog extends CaveJFACEDialog implements ISmartToolInventoryChanged { - private static final String XCOORD_SETTING = "EditActionDialog_Xcoord"; + private final String XCOORD_SETTING = "EditActionDialog_Xcoord"; - private static final String YCOORD_SETTING = "EditActionDialog_Ycoord"; + private final String YCOORD_SETTING = "EditActionDialog_Ycoord"; - public static final int PICKUP_ID = 2; + private final int PICKUP_ID = 2; - public static final int DELTA_ID = 3; + private final int DELTA_ID = 3; - private static final int HEIGHT = 330; + private final int HEIGHT = 330; private String title; @@ -135,11 +136,6 @@ public class EditActionsDialog extends CaveJFACEDialog implements dataManager.getSpatialDisplayManager().addActivatedParmChangedListener( parmChanged); - // LocalizationContext baseCtx = PathManagerFactory.getPathManager() - // .getContext(LocalizationType.CAVE_STATIC, - // LocalizationLevel.BASE); - // baseLF = GfePyIncludeUtil.getSmartToolsLF(baseCtx); - // baseLF.addFileUpdatedObserver(this); dataManager.getSmartToolInterface().addListener(this); } @@ -147,9 +143,6 @@ public class EditActionsDialog extends CaveJFACEDialog implements public boolean close() { dataManager.getSpatialDisplayManager() .removeActivatedParmChangedListener(parmChanged); - // if (baseLF != null) { - // baseLF.removeFileUpdatedObserver(this); - // } dataManager.getSmartToolInterface().removeListener(this); return super.close(); @@ -354,17 +347,13 @@ public class EditActionsDialog extends CaveJFACEDialog implements } - // @Override - // public void fileUpdated(FileUpdatedMessage message) { - // VizApp.runAsync(new Runnable() { - // @Override - // public void run() { - // toolsList.setItems(getSmartTools(parm)); - // } - // - // }); - // } - + /* + * (non-Javadoc) + * + * @see + * org.eclipse.jface.dialogs.Dialog#getInitialLocation(org.eclipse.swt.graphics + * .Point) + */ @Override protected Point getInitialLocation(Point initialSize) { Point result = super.getInitialLocation(initialSize); diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/FormatterLauncherDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/FormatterLauncherDialog.java index 9f123d61a4..c9f0f3f5ff 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/FormatterLauncherDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/FormatterLauncherDialog.java @@ -89,6 +89,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; * Sep 16, 2010 6831 ryu Show same product for different areas on a sub-menu * Nov 22, 2011 8781 mli remove Processor menu * Jul 26, 2012 15165 ryu Set default db source when formatter has no db defined. + * Oct 23, 2012 1287 rferrel Changes for non-blocking dialogs and code clean up. * * * @@ -98,27 +99,22 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; public class FormatterLauncherDialog extends CaveJFACEDialog implements IProductTab { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(FormatterLauncherDialog.class); - private static final String BASELINE = "Baseline"; + private final String BASELINE = "Baseline"; - private static final String CIVIL_EMERGENCY = "CivilEmergency"; + private final String CIVIL_EMERGENCY = "CivilEmergency"; - private static final String HAZARD = "Hazard"; + private final String HAZARD = "Hazard"; - private static final String BASELINE_HAZARD = BASELINE + HAZARD; + private final String BASELINE_HAZARD = BASELINE + HAZARD; - private static final String REGION = "Region"; + private final String REGION = "Region"; - private static final String OTHERS = ""; + private final String OTHERS = ""; - private static final String PRODUCT_EDITOR = "Product Editor"; - - /** - * Return object when the shell is disposed. - */ - private Boolean returnObj = null; + private final String PRODUCT_EDITOR = "Product Editor"; /** * Tab folder containing the product tabs. @@ -207,6 +203,8 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements private String selectedDataSource = null; + private boolean doClose = false; + /** * Constructor. * @@ -273,7 +271,6 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements createProductsMenu(menuBar); createDataSourceMenu(menuBar); -// createProcessorMenu(menuBar); createIssuedByMenu(menuBar); createHelpMenu(menuBar); @@ -380,67 +377,12 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements public void widgetSelected(SelectionEvent event) { } }); - // - // // Set selected data source to official database name - // try { - // ServerResponse> sr = DataManager - // .getCurrentInstance().getClient().getOfficialDBName(); - // selectedDataSource = sr.getPayload().get(0).toString(); - // } catch (GFEServerException e) { - // UFStatus.handle(Priority.PROBLEM, Activator.PLUGIN_ID, - // StatusConstants.CATEGORY_GFE, - // StatusConstants.SUBCATEGORY_TEXTFORMATTER, - // "Unable to determine official db", e); - // } } else { selectedDataSource = DataManager.getCurrentInstance() .getParmManager().getMutableDatabase().toString(); } } - /** - * Create the Processor menu. - * - * @param menuBar - * Menu bar. - */ - /* - private void createProcessorMenu(Menu menuBar) { - // ------------------------------------- - // Create the Processor menu - // ------------------------------------- - MenuItem processorMenuItem = new MenuItem(menuBar, SWT.CASCADE); - processorMenuItem.setText("&Processor"); - - // Create the Processor menu item with a Products "dropdown" menu - Menu processorMenu = new Menu(menuBar); - processorMenuItem.setMenu(processorMenu); - - // ------------------------------------------------------ - // Create all the items in the Processor dropdown menu - // ------------------------------------------------------ - - // Server menu item - MenuItem serverMI = new MenuItem(processorMenu, SWT.RADIO); - serverMI.setText("Server"); - serverMI.setSelection(true); - serverMI.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - } - }); - - // Local menu item - MenuItem localMI = new MenuItem(processorMenu, SWT.RADIO); - localMI.setText("Local"); - localMI.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - } - }); - } - */ - /** * Create the Issued By menu. * @@ -932,9 +874,13 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements return null; } - public void createHideButton() { + /** + * Have the Hide button act like an OK button so it will call the close + * method when selected. + */ + private void createHideButton() { Composite bar = (Composite) super.createButtonBar(top); - createButton(bar, IDialogConstants.CLIENT_ID, "Hide", false); + createButton(bar, IDialogConstants.OK_ID, "Hide", false); } /** @@ -976,31 +922,34 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements } private void showViewMessagesDialog() { - viewMessageDialog = new ViewMessagesDialog(getParentShell()); - - viewMessageDialog.open(); + if (viewMessageDialog == null || viewMessageDialog.getShell() == null + || viewMessageDialog.isDisposed()) { + viewMessageDialog = new ViewMessagesDialog(getParentShell()); + viewMessageDialog.setBlockOnOpen(false); + viewMessageDialog.open(); + } else { + viewMessageDialog.setMessageItems(); + viewMessageDialog.bringToTop(); + } } - public void dispose() { + private void dispose() { textProductMgr.dispose(); } - class ViewMessagesDialog extends org.eclipse.swt.widgets.Dialog { + class ViewMessagesDialog extends CaveJFACEDialog { private List messageList; - private Shell shell; - - private Display display; - public ViewMessagesDialog(Shell parentShell) { super(parentShell); + setShellStyle(SWT.DIALOG_TRIM); + } - display = getParent().getDisplay(); - shell = new Shell(getParent(), SWT.DIALOG_TRIM); - + @Override + protected void configureShell(Shell shell) { + super.configureShell(shell); shell.setText("View Messages"); - // Create the main layout for the shell. GridLayout mainLayout = new GridLayout(1, false); mainLayout.marginHeight = 2; @@ -1016,31 +965,15 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements gd.heightHint = 320; gd.widthHint = 475; messageList.setLayoutData(gd); - + setMessageItems(); } - public void setMessageItems(String[] messageItems) { - messageList.removeAll(); - messageList.setItems(messageItems); - - } - - public Object open() { + public void setMessageItems() { String[] messages = new String[statusMessages.size()]; statusMessages.toArray(messages); + messageList.removeAll(); messageList.setItems(messages); - - shell.pack(); - - shell.open(); - while (!shell.isDisposed()) { - if (!display.readAndDispatch()) { - display.sleep(); - } - } - - return returnObj; } } @@ -1093,18 +1026,42 @@ public class FormatterLauncherDialog extends CaveJFACEDialog implements return source; } - @Override - public boolean close() { - // make clicking the x in the upper right corner just hide the dialog - // instead of closing it - getShell().setVisible(false); - return false; + /** + * Perform a real close of the dialog instead of just hiding it. + * + * @return + */ + public boolean closeDialog() { + doClose = true; + return close(); } + /** + * This hides the fromat launcher dialog and any dialogs it creates. + */ + public void hideDialog() { + if (viewMessageDialog != null) { + viewMessageDialog.hide(); + } + hide(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.jface.dialogs.Dialog#close() + */ @Override - protected void finalize() throws Throwable { - dispose(); - super.finalize(); + public boolean close() { + if (doClose) { + dispose(); + return super.close(); + } + + // make clicking the x in the upper right corner just hide the dialog + // instead of closing it + hideDialog(); + return false; } public void closeFormatters() { diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/GridsInterpolateDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/GridsInterpolateDialog.java index 21a926f762..b70cd9e178 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/GridsInterpolateDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/GridsInterpolateDialog.java @@ -52,6 +52,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; * ------------ ---------- -------------- -------------------------- * Feb 26, 2008 Eric Babin Initial Creation * Jun 4, 2008 #1161 Ron Anderson Reworked + * Oct 25, 2012 #1287 rferrel Code clean for non-blocking dialog. * * * @@ -60,7 +61,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; */ public class GridsInterpolateDialog extends CaveJFACEDialog { - private static final int MAX_INTERVAL = 24; + private final int MAX_INTERVAL = 24; private Composite top; diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/HiddenWeatherElementDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/HiddenWeatherElementDialog.java index 9bba0fb3b9..d80927199f 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/HiddenWeatherElementDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/HiddenWeatherElementDialog.java @@ -33,6 +33,9 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.viz.gfe.core.DataManager; import com.raytheon.viz.gfe.core.UIFormat; import com.raytheon.viz.gfe.core.UIFormat.FilterType; @@ -49,6 +52,7 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList; * ------------ ---------- ----------- -------------------------- * Feb 22, 2008 Eric Babin Initial Creation * Dec 02, 2009 #945 randerso reworked + * Oct 25, 2012 #1287 rferrel Code clean up for non-blocking dialog. * * * @@ -57,10 +61,12 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList; */ public class HiddenWeatherElementDialog extends CaveJFACEDialog { + private final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(SaveDeleteSelectTRDialog.class); - public static final int UNLOAD = IDialogConstants.CLIENT_ID + 1; + private final int UNLOAD = IDialogConstants.CLIENT_ID + 1; - public static final int MAKE_VISIBLE = IDialogConstants.CLIENT_ID + 2; + private final int MAKE_VISIBLE = IDialogConstants.CLIENT_ID + 2; private Composite top; @@ -164,16 +170,28 @@ public class HiddenWeatherElementDialog extends CaveJFACEDialog { } protected void unload() { - // LogStream.logUse("UnloadHidden:", self.__lbox.getSelections()) + if (statusHandler.isPriorityEnabled(Priority.DEBUG)) { + StringBuilder sb = new StringBuilder("UnloadHidden: "); + for (String s : this.lbox.getSelection()) { + sb.append(s).append("\n"); + } + statusHandler.debug(sb.toString()); + } ParmID[] unload = parmIDsFromUINames(this.lbox.getSelection()); Parm[] unloadParms = dataManager.getParmManager().getParms(unload); dataManager.getParmManager().deleteParm(unloadParms); } protected void makeVisible() { - // LogStream.logUse("MakeVisibleHidden:", self.__lbox.getSelections()) - List visParmIDs = new ArrayList(Arrays - .asList(dataManager.getParmManager().getParmIDs( + if (statusHandler.isPriorityEnabled(Priority.DEBUG)) { + StringBuilder sb = new StringBuilder("MakeVisibleHidden: "); + for (String s : this.lbox.getSelection()) { + sb.append(s).append("\n"); + } + statusHandler.debug(sb.toString()); + } + List visParmIDs = new ArrayList( + Arrays.asList(dataManager.getParmManager().getParmIDs( dataManager.getParmManager().getDisplayedParms()))); ParmID[] load = parmIDsFromUINames(this.lbox.getSelection()); for (int i = 0; i < load.length; i++) { diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/ProductScriptsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/ProductScriptsDialog.java index b972582369..1470da1644 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/ProductScriptsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/ProductScriptsDialog.java @@ -20,8 +20,8 @@ package com.raytheon.viz.gfe.dialogs; import java.text.SimpleDateFormat; -import java.util.Arrays; import java.util.ArrayList; +import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; @@ -63,6 +63,8 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 7, 2008 Eric Babin Initial Creation + * Oct 27, 2012 1287 rferrel Code cleanup for non-blocking dialog. + * Oct 25, 2012 1287 rferrel Code changes for non-blocking PublishDialog. * * * @@ -71,12 +73,12 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList; */ public class ProductScriptsDialog extends CaveJFACEDialog { - private static final String TIME_FORMAT_STRING = "yyyyMMdd_HHmm"; + private final String TIME_FORMAT_STRING = "yyyyMMdd_HHmm"; - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(ProductScriptsDialog.class); - public final static int RUN_ID = IDialogConstants.CLIENT_ID + 1; + private final int RUN_ID = IDialogConstants.CLIENT_ID + 1; private String[] scripts; @@ -94,6 +96,8 @@ public class ProductScriptsDialog extends CaveJFACEDialog { private DatabaseID mutableDB; + private PublishDialog publishDlg; + public ProductScriptsDialog(Shell parent, DataManager dataManager) { super(parent); this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS); @@ -115,9 +119,14 @@ public class ProductScriptsDialog extends CaveJFACEDialog { } private void launchPublishToOfficial() { - PublishDialog dialog = new PublishDialog(getParentShell(), dataManager); - dialog.setBlockOnOpen(true); - dialog.open(); + if (publishDlg == null || publishDlg.getShell() == null + || publishDlg.isDisposed()) { + publishDlg = new PublishDialog(getParentShell(), dataManager); + publishDlg.setBlockOnOpen(false); + publishDlg.open(); + } else { + publishDlg.bringToTop(); + } } @Override @@ -168,13 +177,8 @@ public class ProductScriptsDialog extends CaveJFACEDialog { cmd = cmd.replace("{productDB}", productDB.toString()); cmd = cmd.replace("{SEstart}", gmtTime.format(seStart)); cmd = cmd.replace("{SEend}", gmtTime.format(seEnd)); - // cmd = cmd.replace("{SelectedStart}", - // gmtTime.format(selStart)); - // cmd = cmd.replace("{SelectedEnd}", gmtTime.format(selEnd)); cmd = cmd.replace("{time}", curLocalTime); cmd = cmd.replace("{ztime}", curGMTTime); - // cmd = cmd.replace("{module:}", replaceWith); - // cmd = cmd.replace("{home}", siteConfig.GFESUITE_HOME); cmd = cmd.replace("{prddir}", prddir); // The user is prompted to enter the value with which to replace @@ -193,39 +197,53 @@ public class ProductScriptsDialog extends CaveJFACEDialog { // {entryButtons: : } - int count = cmd.split("entryButtons").length - 1; + int count = cmd.split("entryButtons").length - 1; if (count > 0) { - int entryIdx = 0, i = 0, start = 0; - List fieldDefs = new ArrayList (); - - while (entryIdx != -1) { - entryIdx = cmd.indexOf("{entryButtons:",entryIdx); - if (entryIdx >= 0) { - int endEntryIdx = cmd.indexOf("}", entryIdx); - String[] entry = cmd.substring(entryIdx + 1, endEntryIdx) - .split(":"); - String [] fields = entry[2].split(","); + int entryIdx = 0, i = 0, start = 0; + List fieldDefs = new ArrayList(); - fieldDefs.add(new FieldDefinition((Object)entry[1], entry[1], FieldType.RADIO, (Object)fields[0], - Arrays.asList(Arrays.asList(fields).toArray(new Object[fields.length])), (float)1.0, (int)3)); - if (i == 0) start = entryIdx; - entryIdx=endEntryIdx+1; + while (entryIdx != -1) { + entryIdx = cmd.indexOf("{entryButtons:", entryIdx); + if (entryIdx >= 0) { + int endEntryIdx = cmd.indexOf("}", entryIdx); + String[] entry = cmd.substring(entryIdx + 1, + endEntryIdx).split(":"); + String[] fields = entry[2].split(","); + + fieldDefs + .add(new FieldDefinition( + (Object) entry[1], + entry[1], + FieldType.RADIO, + (Object) fields[0], + Arrays.asList(Arrays + .asList(fields) + .toArray( + new Object[fields.length])), + (float) 1.0, (int) 3)); + if (i == 0) { + start = entryIdx; + } + entryIdx = endEntryIdx + 1; i++; } if (entryIdx == -1) { - ValuesDialog buttonDlg = new ValuesDialog(name, fieldDefs, dataManager); - if (buttonDlg.open() > 0) { - run = false; - continue; - } - - Map map = buttonDlg.getValues(); - String returnMsg = ""; - - for (Map.Entry entry : map.entrySet()) { - returnMsg = returnMsg + entry.getValue().toString() + " "; - } + ValuesDialog buttonDlg = new ValuesDialog(name, + fieldDefs, dataManager); + if (buttonDlg.open() > 0) { + run = false; + continue; + } + + Map map = buttonDlg.getValues(); + String returnMsg = ""; + + for (Map.Entry entry : map + .entrySet()) { + returnMsg = returnMsg + + entry.getValue().toString() + " "; + } start = start - 3; cmd = cmd.substring(0, start) + returnMsg; @@ -240,36 +258,50 @@ public class ProductScriptsDialog extends CaveJFACEDialog { count = cmd.split("entryChecks").length - 1; if (count > 0) { int entryIdx = 0, i = 0, start = 0; - List fieldDefs = new ArrayList (); + List fieldDefs = new ArrayList(); while (entryIdx != -1) { - entryIdx = cmd.indexOf("{entryChecks:",entryIdx); + entryIdx = cmd.indexOf("{entryChecks:", entryIdx); if (entryIdx >= 0) { - int endEntryIdx = cmd.indexOf("}", entryIdx); - String[] entry = cmd.substring(entryIdx + 1, endEntryIdx) - .split(":"); - String [] fields = entry[2].split(","); + int endEntryIdx = cmd.indexOf("}", entryIdx); + String[] entry = cmd.substring(entryIdx + 1, + endEntryIdx).split(":"); + String[] fields = entry[2].split(","); - fieldDefs.add(new FieldDefinition((Object)entry[1], entry[1], FieldType.CHECK, (Object)null, - Arrays.asList(Arrays.asList(fields).toArray(new Object[fields.length])), (float)1.0, (int)3)); - if (i == 0) start = entryIdx; - entryIdx=endEntryIdx+1; + fieldDefs + .add(new FieldDefinition( + (Object) entry[1], + entry[1], + FieldType.CHECK, + (Object) null, + Arrays.asList(Arrays + .asList(fields) + .toArray( + new Object[fields.length])), + (float) 1.0, (int) 3)); + if (i == 0) { + start = entryIdx; + } + entryIdx = endEntryIdx + 1; i++; } if (entryIdx == -1) { - ValuesDialog buttonDlg = new ValuesDialog(name, fieldDefs, dataManager); - if (buttonDlg.open() > 0) { - run = false; - continue; - } - - Map map = buttonDlg.getValues(); - String returnMsg = ""; - - for (Map.Entry entry : map.entrySet()) { - returnMsg = returnMsg + entry.getValue().toString() + " "; - } + ValuesDialog buttonDlg = new ValuesDialog(name, + fieldDefs, dataManager); + if (buttonDlg.open() > 0) { + run = false; + continue; + } + + Map map = buttonDlg.getValues(); + String returnMsg = ""; + + for (Map.Entry entry : map + .entrySet()) { + returnMsg = returnMsg + + entry.getValue().toString() + " "; + } start = start - 3; cmd = cmd.substring(0, start) + returnMsg; @@ -292,7 +324,7 @@ public class ProductScriptsDialog extends CaveJFACEDialog { String returnMsg = entryDlg.open(); if (returnMsg == null) { // cancel pressed - run = false; + run = false; continue; } configFile = returnMsg; @@ -301,7 +333,9 @@ public class ProductScriptsDialog extends CaveJFACEDialog { + cmd.substring(endEntryIdx + 1); } - if (run) TaskManager.getInstance().createScriptTask(name, cmd); + if (run) { + TaskManager.getInstance().createScriptTask(name, cmd); + } } catch (Exception e) { statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/PublishDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/PublishDialog.java index ec2c0d1094..92629760fa 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/PublishDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/PublishDialog.java @@ -76,6 +76,7 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList; * Mar 6, 2008 Eric Babin Initial Creation * Sep 01, 2009 #1370 randerso Completely reworked * Aug 05, 2010 6698 mpduff Moved Publish work to its own thread. + * Oct 25, 2012 1287 rferrel Code cleanup for non-blocking dialog. * * * @@ -83,12 +84,12 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList; * @version 1.0 */ public class PublishDialog extends CaveJFACEDialog { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(PublishDialog.class); - private static final int MAX_LIST_HEIGHT = 10; + private final int MAX_LIST_HEIGHT = 10; - private static final PythonPreferenceStore prefs = Activator.getDefault() + private final PythonPreferenceStore prefs = Activator.getDefault() .getPreferenceStore(); private static Boolean IscStateP; @@ -514,8 +515,6 @@ public class PublishDialog extends CaveJFACEDialog { @Override protected void okPressed() { this.getShell().setEnabled(false); - // getButton(IDialogConstants.OK_ID).setEnabled(false); - // getButton(IDialogConstants.CANCEL_ID).setEnabled(false); publishCB(); } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/RefSetAppearanceDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/RefSetAppearanceDialog.java index 1c7ad84c17..287649b291 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/RefSetAppearanceDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/RefSetAppearanceDialog.java @@ -45,6 +45,7 @@ import com.raytheon.viz.ui.widgets.SpinScale; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Aug 24, 2009 randerso Initial creation + * Oct 25, 2012 1287 rferrel Code clean up for non-blocking dialog. * * * @@ -53,9 +54,9 @@ import com.raytheon.viz.ui.widgets.SpinScale; */ public class RefSetAppearanceDialog extends CaveJFACEDialog { - private static final int APPLY_ID = IDialogConstants.CLIENT_ID; + private final int APPLY_ID = IDialogConstants.CLIENT_ID; - private static final String APPLY_LABEL = "Apply"; + private final String APPLY_LABEL = "Apply"; private ColorWheelComp colorWheel; diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SampleSetDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SampleSetDialog.java index ff689b8892..ffa0f33261 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SampleSetDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SampleSetDialog.java @@ -19,8 +19,6 @@ **/ package com.raytheon.viz.gfe.dialogs; -import java.util.ArrayList; - import org.eclipse.jface.window.Window; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; @@ -47,6 +45,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Mar 7, 2008 Eric Babin Initial Creation + * Oct 24, 2012 1287 rferrel Code clean up for non-blocking dialog. * * * @@ -72,7 +71,7 @@ public class SampleSetDialog extends CaveJFACEDialog { private Composite top; - private ArrayList samples; + private java.util.List samples; private List sampleSetList; @@ -82,13 +81,14 @@ public class SampleSetDialog extends CaveJFACEDialog { private int[] selectedSamples; - private int returnCode = OK; + private int returnCode = CANCEL; - private int type = 1; + private int type; - public SampleSetDialog(Shell parent, ArrayList samples, int type) { + public SampleSetDialog(Shell parent, java.util.List samples, + int type) { super(parent); - this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE); + this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS); this.samples = samples; this.type = type; } @@ -221,4 +221,7 @@ public class SampleSetDialog extends CaveJFACEDialog { this.sampleName = sampleName; } + public java.util.List getSamples() { + return samples; + } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SaveDeleteEditAreaGroupDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SaveDeleteEditAreaGroupDialog.java index f8718a39c0..6689b505f8 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SaveDeleteEditAreaGroupDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SaveDeleteEditAreaGroupDialog.java @@ -38,7 +38,6 @@ import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; -import com.raytheon.uf.common.dataplugin.gfe.StatusConstants; import com.raytheon.uf.common.dataplugin.gfe.reference.GroupID; import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceID; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; @@ -46,20 +45,20 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.viz.gfe.Activator; import com.raytheon.viz.gfe.core.IReferenceSetManager; import com.raytheon.viz.gfe.ui.AccessMgr; import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; import com.raytheon.viz.ui.widgets.ToggleSelectList; /** - * TODO Add Description ListTypeDialog.java Mar 11, 2008 + * Dialog to perform a save or delete of an Edit Area Group. * *
  * SOFTWARE HISTORY
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * 	Mar 11, 2008					Eric Babin Initial Creation
+ * Oct 24, 2012 1287       rferrel     Code clean part of non-blocking dialog.
  * 
  * 
* @@ -68,7 +67,8 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList; */ public class SaveDeleteEditAreaGroupDialog extends CaveJFACEDialog { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(SaveDeleteEditAreaGroupDialog.class); + private final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(SaveDeleteEditAreaGroupDialog.class); private IReferenceSetManager refSetManager; @@ -160,8 +160,8 @@ public class SaveDeleteEditAreaGroupDialog extends CaveJFACEDialog { groupList = new List(leftGroup, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL); layoutData = new GridData(SWT.DEFAULT, SWT.FILL, false, true); groupList.setLayoutData(layoutData); - groupList.setItems(this.groupNames - .toArray(new String[groupNames.size()])); + groupList + .setItems(this.groupNames.toArray(new String[groupNames.size()])); groupList.select(0); groupList.deselectAll(); groupList.addSelectionListener(new SelectionAdapter() { @@ -271,7 +271,7 @@ public class SaveDeleteEditAreaGroupDialog extends CaveJFACEDialog { String groupName = identifer.getText(); String[] areas = areaListbox.getSelection(); statusHandler.handle(Priority.DEBUG, "Save Edit Area Group: " - + groupName + " sel:" + areas); + + groupName + " sel:" + areas); if (!groupName.isEmpty() && !groupName.equals("Misc") && !protectedGroupNames.contains(groupName)) { @@ -298,8 +298,8 @@ public class SaveDeleteEditAreaGroupDialog extends CaveJFACEDialog { java.util.List areas = refSetManager .getGroupData(groupName); - statusHandler.handle(Priority.DEBUG, - "Delete Edit Area Group: " + groupName); + statusHandler.handle(Priority.DEBUG, "Delete Edit Area Group: " + + groupName); refSetManager.deleteGroup(groupName); // Delete areas within the group if desired diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SaveDeleteRefDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SaveDeleteRefDialog.java index ee17a6834a..07a611f3a5 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SaveDeleteRefDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SaveDeleteRefDialog.java @@ -42,20 +42,18 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData; -import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceID; import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceData.RefType; +import com.raytheon.uf.common.dataplugin.gfe.reference.ReferenceID; import com.raytheon.uf.common.localization.LocalizationContext.LocalizationLevel; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; import com.raytheon.uf.common.status.UFStatus.Priority; -import com.raytheon.viz.gfe.Activator; -import com.raytheon.viz.gfe.constants.StatusConstants; import com.raytheon.viz.gfe.core.IReferenceSetManager; import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; import com.raytheon.viz.ui.widgets.ToggleSelectList; /** - * TODO Add Description + * Dialog for performing a save or delete of an Edit Area. * *
  * 
@@ -63,6 +61,7 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Sep 10, 2010            randerso     Initial creation
+ * Oct 24, 2012 1287       rferrel     Code clean up part of non-blocking dialog.
  * 
  * 
* @@ -71,11 +70,12 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList; */ public class SaveDeleteRefDialog extends CaveJFACEDialog { - private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(SaveDeleteRefDialog.class); - private static final Pattern pythonVariable = Pattern - .compile("\\p{Alpha}\\w*"); + private final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(SaveDeleteRefDialog.class); - private static final int NUM_ITEMS = 10; + private final Pattern pythonVariable = Pattern.compile("\\p{Alpha}\\w*"); + + private final int NUM_ITEMS = 10; private IReferenceSetManager refSetMgr; @@ -156,9 +156,9 @@ public class SaveDeleteRefDialog extends CaveJFACEDialog { editAreaList = new org.eclipse.swt.widgets.List(areaFrame, SWT.BORDER | SWT.V_SCROLL | SWT.SINGLE); - Rectangle rect = editAreaList.computeTrim(0, 0, this - .convertWidthInCharsToPixels(24), editAreaList.getItemHeight() - * NUM_ITEMS); + Rectangle rect = editAreaList.computeTrim(0, 0, + this.convertWidthInCharsToPixels(24), + editAreaList.getItemHeight() * NUM_ITEMS); layoutData = new GridData(GridData.FILL_BOTH); layoutData.minimumWidth = rect.width; layoutData.heightHint = rect.height; @@ -207,10 +207,9 @@ public class SaveDeleteRefDialog extends CaveJFACEDialog { groupListBox = new ToggleSelectList(groupFrame, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI); - rect = groupListBox.computeTrim(0, 0, this - .convertWidthInCharsToPixels(24), groupListBox - .getItemHeight() - * NUM_ITEMS); + rect = groupListBox.computeTrim(0, 0, + this.convertWidthInCharsToPixels(24), + groupListBox.getItemHeight() * NUM_ITEMS); layoutData = new GridData(GridData.FILL_BOTH); layoutData.minimumWidth = rect.width; layoutData.heightHint = rect.height; @@ -282,8 +281,8 @@ public class SaveDeleteRefDialog extends CaveJFACEDialog { // Check that name is a legal Python variable so // it can be used subsequently in queries if (!pythonVariable.matcher(name).matches()) { - statusHandler.handle( - Priority.SIGNIFICANT, + statusHandler + .handle(Priority.SIGNIFICANT, "Illegal Name: Must begin with a letter and be alphanumeric or '_'. Please rename."); return false; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SaveDeleteSelectTRDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SaveDeleteSelectTRDialog.java index 72a83422b2..906cd408d1 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SaveDeleteSelectTRDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/SaveDeleteSelectTRDialog.java @@ -54,7 +54,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; import com.raytheon.viz.ui.widgets.SpinScale; /** - * TODO Add Description + * Dialog for performing selected time range save or delete. * *
  * 
@@ -63,6 +63,7 @@ import com.raytheon.viz.ui.widgets.SpinScale;
  * ------------ ---------- ----------- --------------------------
  * Dec 7, 2009            randerso     Initial creation
  * Aug 1, 2012   #965     dgilling     Change location of SelectTimeRange.
+ * Oct 25, 2012  #1287     rferrel     Code cleanup part of non-blocking dialogs.
  * 
  * 
* @@ -338,8 +339,6 @@ public class SaveDeleteSelectTRDialog extends CaveJFACEDialog { } else { mode = Mode.ZULU; } - // LogStream.logUse("Save",id, self.__modeVar.get(), - // self.__startScale.get(), self.__stopScale.get()) dataManager.getSelectTimeRangeManager().save(id, startScale.getSelection(), stopScale.getSelection(), mode); @@ -361,10 +360,6 @@ public class SaveDeleteSelectTRDialog extends CaveJFACEDialog { } if (!protectedIds.contains(id[0]) && ids.contains(id[0])) { - // verify = self.__accessMgr.verifyDelete( - // id, self.__category, self.__parent) - // if verify == 1: - // LogStream.logUse("Delete", id) if (!MessageDialog.openConfirm(this.getShell(), "Confirm Delete", "Delete Select Time Range: \"" + id[0] + "\"?")) { return; diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/TimeScalePeriodsDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/TimeScalePeriodsDialog.java index 179793c775..72742915b5 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/TimeScalePeriodsDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/TimeScalePeriodsDialog.java @@ -43,6 +43,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 23, 2009 randerso Initial creation + * Oct 29, 2012 1287 rferrel Code clean up for non-blocking dialog. * * * @@ -63,7 +64,7 @@ public class TimeScalePeriodsDialog extends CaveJFACEDialog { ISelectTimeRangeManager selectTRmgr) { super(parent); - this.setShellStyle(SWT.TITLE | SWT.CLOSE); + this.setShellStyle(SWT.DIALOG_TRIM); this.selectTRmgr = selectTRmgr; } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/WERevertDialog.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/WERevertDialog.java index 768f1d92dc..779fec1dbf 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/WERevertDialog.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/WERevertDialog.java @@ -58,6 +58,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jan 21, 2011 randerso Initial creation + * Oct 25, 2012 1287 rferrel Code clean up for non-blocking dialog. * * * @@ -66,7 +67,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; */ public class WERevertDialog extends CaveJFACEDialog implements DisposeListener { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(WERevertDialog.class); private Composite master; @@ -83,7 +84,7 @@ public class WERevertDialog extends CaveJFACEDialog implements DisposeListener { public WERevertDialog(Shell parent, DataManager dataManager) { super(parent); - this.setShellStyle(SWT.TITLE | SWT.MODELESS | SWT.CLOSE); + this.setShellStyle(SWT.DIALOG_TRIM | SWT.MODELESS); this.dataManager = dataManager; this.modparms = dataManager.getParmManager().getModifiedParms(); diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/ServiceBackupDlg.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/ServiceBackupDlg.java index 34cbf3c6e8..3b02517223 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/ServiceBackupDlg.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/ServiceBackupDlg.java @@ -89,6 +89,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; * ------------ ---------- ----------- -------------------------- * Aug 4, 2011 randerso Initial creation * Sep 19, 2011 10955 rferrel Use RunProcess + * Oct 25, 2012 1287 rferrel Code clean up for non-blocking dialog. * * * @@ -102,14 +103,14 @@ public class ServiceBackupDlg extends CaveJFACEDialog { ghg, wait, imprtGrdMode, imprtMode, exprtbksiteGrdToCSMode, exprtMode, exprtbksiteGrdMode, svcbuMode, exprtGrdMode, no_backup } - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(ServiceBackupDlg.class); public static final String NOTIFY_TOPIC = "edex.alerts.gfe"; public static final String ACTIVATION_TOPIC = "edex.alerts.siteActivate"; - private static int REFRESH_ID = IDialogConstants.CLIENT_ID; + private int REFRESH_ID = IDialogConstants.CLIENT_ID; private String site; @@ -776,9 +777,9 @@ public class ServiceBackupDlg extends CaveJFACEDialog { break; default: doRefresh(); - if(confirmExit()) { - doClean(false); - jobManager.addJob(new SvcbuExitJob(this, this.site)); + if (confirmExit()) { + doClean(false); + jobManager.addJob(new SvcbuExitJob(this, this.site)); } } @@ -850,8 +851,8 @@ public class ServiceBackupDlg extends CaveJFACEDialog { private boolean confirmExit() { MessageBox mb = new MessageBox(getShell(), SWT.YES | SWT.NO); mb.setText("Exit Service Backup"); - mb.setMessage("Are you sure you want to remove " + this.failedSite + - "'s configuration and digital data from your system?"); + mb.setMessage("Are you sure you want to remove " + this.failedSite + + "'s configuration and digital data from your system?"); int close = mb.open(); if (close == SWT.YES) { return true; @@ -859,7 +860,7 @@ public class ServiceBackupDlg extends CaveJFACEDialog { return false; } - + @SuppressWarnings("unchecked") private void doRefresh() { @@ -1198,7 +1199,8 @@ public class ServiceBackupDlg extends CaveJFACEDialog { + UserController.getUserObject().uniqueId()); } - if ((!runningAsPrimary) && (!LocalizationManager.getInstance().isNationalCenter())) { + if ((!runningAsPrimary) + && (!LocalizationManager.getInstance().isNationalCenter())) { doExCon.setEnabled(false); } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/SiteActivationDlg.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/SiteActivationDlg.java index 941be21c64..832c052879 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/SiteActivationDlg.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/dialogs/sbu/SiteActivationDlg.java @@ -56,7 +56,6 @@ import com.raytheon.uf.viz.core.notification.NotificationException; import com.raytheon.uf.viz.core.notification.NotificationMessage; import com.raytheon.uf.viz.core.notification.jobs.NotificationManagerJob; import com.raytheon.uf.viz.core.requests.ThriftClient; -import com.raytheon.viz.gfe.core.internal.IFPClient; import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; /** @@ -69,6 +68,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Aug 5, 2011 randerso Initial creation + * Oct 26, 2012 1287 rferrel Code clean up for non-blocking dialog. * * * @@ -79,7 +79,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; public class SiteActivationDlg extends CaveJFACEDialog implements INotificationObserver { private static final transient IUFStatusHandler statusHandler = UFStatus - .getHandler(IFPClient.class); + .getHandler(SiteActivationDlg.class); private SimpleDateFormat dateFormat; diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SamplePainter.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SamplePainter.java index 03d528d974..802fcf52bb 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SamplePainter.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/edittool/sample/SamplePainter.java @@ -23,6 +23,7 @@ import java.awt.Point; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collections; import java.util.Date; import java.util.List; @@ -68,7 +69,8 @@ import com.vividsolutions.jts.geom.Coordinate; * 04/08/2008 chammack Initial Port from AWIPS I (minus ISC support) * 07/23/2012 #936 dgilling Reinstate config-handling code to * calcGridLabels(). - * + * 11/05/2012 #14566 jzeng Reverse the order of grids + * in calcGridLabels () * * * @author chammack @@ -282,6 +284,8 @@ public class SamplePainter { inGrid = true; } + Collections.reverse(grids); + // get the list of samples that should be painted and in the // order for (GridID grid : grids) { diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/gridmanager/action/GFEFrameTool.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/gridmanager/action/GFEFrameTool.java index 9510ef10c3..da1b8157a8 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/gridmanager/action/GFEFrameTool.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/gridmanager/action/GFEFrameTool.java @@ -22,9 +22,9 @@ package com.raytheon.viz.gfe.gridmanager.action; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; -import com.raytheon.uf.viz.core.drawables.IDescriptor.FrameChangeOperation; +import com.raytheon.uf.viz.core.drawables.IFrameCoordinator.FrameChangeOperation; import com.raytheon.viz.gfe.core.DataManager; -import com.raytheon.viz.ui.EditorUtil; +import com.raytheon.viz.gfe.gridmanager.IGridManager; import com.raytheon.viz.ui.tools.AbstractTool; /** @@ -56,36 +56,28 @@ public class GFEFrameTool extends AbstractTool { @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - this.editor = EditorUtil.getActiveVizContainer(); - if (this.editor == null) { - return null; - } - - this.editor.getLoopProperties().setLooping(false); - String operationStr = arg0.getParameter("operation"); FrameChangeOperation operation = FrameChangeOperation .valueOf(operationStr); - DataManager dm = DataManager.getCurrentInstance(); + IGridManager gm = DataManager.getCurrentInstance().getGridManager(); switch (operation) { case PREVIOUS: - dm.getGridManager().previousSelectedGrid(); + gm.previousSelectedGrid(); break; case NEXT: - dm.getGridManager().nextSelectedGrid(); + gm.nextSelectedGrid(); break; case FIRST: - dm.getGridManager().firstSelectedGrid(); + gm.firstSelectedGrid(); break; case LAST: - dm.getGridManager().lastSelectedGrid(); + gm.lastSelectedGrid(); break; } - editor.refresh(); - dm.getGridManager().redraw(); + gm.redraw(); return null; diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/perspective/GFEPerspectiveManager.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/perspective/GFEPerspectiveManager.java index 0537c4b3d8..712f93f141 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/perspective/GFEPerspectiveManager.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/perspective/GFEPerspectiveManager.java @@ -48,8 +48,8 @@ import com.raytheon.uf.viz.core.IDisplayPane; import com.raytheon.uf.viz.core.IDisplayPaneContainer; import com.raytheon.uf.viz.core.IExtent; import com.raytheon.uf.viz.core.PixelExtent; -import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; import com.raytheon.uf.viz.core.RGBColors; +import com.raytheon.uf.viz.core.drawables.IRenderableDisplay; import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.map.IMapDescriptor; @@ -88,6 +88,7 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener; * Apr 27, 2010 mschenke refactor for common perspective switching * Jul 7, 2011 #9897 ryu close formatters on perspective close/reset * Aug 20,2012 #1077 randerso Added support for bgColor setting + * Oct 23, 2012 #1287 rferrel Changes for non-blocking FormattrLauncherDialog. * * * @author randerso @@ -247,9 +248,7 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager { SmartToolJob.shutdown(); } }).start(); - if (FormatterlauncherAction.getFormatterLauncher() != null) { - FormatterlauncherAction.getFormatterLauncher().closeFormatters(); - } + FormatterlauncherAction.closeDialog(); } @Override @@ -258,10 +257,7 @@ public class GFEPerspectiveManager extends AbstractCAVEPerspectiveManager { if (IWorkbenchPage.CHANGE_RESET.equals(VizPerspectiveListener .getInstance().getPerspectiveChangeId( GFEPerspective.ID_PERSPECTIVE))) { - if (FormatterlauncherAction.getFormatterLauncher() != null) { - FormatterlauncherAction.getFormatterLauncher() - .closeFormatters(); - } + FormatterlauncherAction.closeFormatters(); } } diff --git a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/rsc/colorbar/ChangeColorMapRangeAction.java b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/rsc/colorbar/ChangeColorMapRangeAction.java index a5cc5813ae..d7e08dc049 100644 --- a/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/rsc/colorbar/ChangeColorMapRangeAction.java +++ b/cave/com.raytheon.viz.gfe/src/com/raytheon/viz/gfe/rsc/colorbar/ChangeColorMapRangeAction.java @@ -27,6 +27,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; import com.raytheon.viz.gfe.core.parm.Parm; import com.raytheon.viz.ui.cmenu.AbstractRightClickAction; import com.raytheon.viz.ui.dialogs.ColormapDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * Action for right click menu for changing range of color map values. @@ -38,6 +39,7 @@ import com.raytheon.viz.ui.dialogs.ColormapDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Feb 2, 2011 7999 dgilling Initial creation + * Oct 17, 2012 1229 rferrel Changes for non-blocking ColormapDialog. * * * @@ -49,6 +51,8 @@ public class ChangeColorMapRangeAction extends AbstractRightClickAction { private Parm parm; + private ColormapDialog colorMapDlg; + public ChangeColorMapRangeAction(Parm parm) { super("Set Range..."); this.parm = parm; @@ -61,21 +65,42 @@ public class ChangeColorMapRangeAction extends AbstractRightClickAction { */ @Override public void run() { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - ColorMapCapability cap = getSelectedRsc().getCapability( - ColorMapCapability.class); - IColorMap prevColorMap = cap.getColorMapParameters().getColorMap(); - float prevMax = cap.getColorMapParameters().getColorMapMax(); - float prevMin = cap.getColorMapParameters().getColorMapMin(); + if (colorMapDlg == null || colorMapDlg.getShell() == null + || colorMapDlg.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + ColorMapCapability cap = getSelectedRsc().getCapability( + ColorMapCapability.class); + final IColorMap prevColorMap = cap.getColorMapParameters() + .getColorMap(); + final float prevMax = cap.getColorMapParameters().getColorMapMax(); + final float prevMin = cap.getColorMapParameters().getColorMapMin(); - ColormapDialog cmd = new ColormapDialog(shell, "Set Color Table Range", - cap, parm.getGridInfo().getPrecision()); - if (cmd.open() != ColormapDialog.OK) { - cap.getColorMapParameters().setColorMap(prevColorMap); - cap.getColorMapParameters().setColorMapMax(prevMax); - cap.getColorMapParameters().setColorMapMin(prevMin); - cap.notifyResources(); + colorMapDlg = new ColormapDialog(shell, "Set Color Table Range", + cap, parm.getGridInfo().getPrecision()); + colorMapDlg.setBlockOnOpen(false); + colorMapDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof Integer) { + int status = (Integer) returnValue; + if (status != ColormapDialog.OK) { + ColorMapCapability cap = colorMapDlg + .getColorMapCapability(); + cap.getColorMapParameters().setColorMap( + prevColorMap); + cap.getColorMapParameters().setColorMapMax(prevMax); + cap.getColorMapParameters().setColorMapMin(prevMin); + cap.notifyResources(); + } + } + colorMapDlg = null; + } + }); + colorMapDlg.open(); + } else { + colorMapDlg.bringToTop(); } } } diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GribDataCubeAlertMessageParser.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GribDataCubeAlertMessageParser.java index a3d029ded3..188969bd41 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GribDataCubeAlertMessageParser.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/inv/GribDataCubeAlertMessageParser.java @@ -20,23 +20,15 @@ package com.raytheon.viz.grid.inv; import java.util.HashMap; -import java.util.List; import java.util.Map; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import com.raytheon.uf.common.dataplugin.PluginDataObject; -import com.raytheon.uf.common.dataquery.requests.RequestConstraint; -import com.raytheon.uf.common.time.DataTime; -import com.raytheon.uf.viz.core.RecordFactory; import com.raytheon.uf.viz.core.alerts.AlertMessage; import com.raytheon.uf.viz.core.alerts.DataCubeAlertMessageParser; -import com.raytheon.uf.viz.core.catalog.LayerProperty; -import com.raytheon.uf.viz.core.datastructure.DataCubeContainer; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; -import com.raytheon.uf.viz.core.rsc.ResourceType; /** * @@ -66,56 +58,14 @@ public class GribDataCubeAlertMessageParser extends DataCubeAlertMessageParser { public Object parseAlertMessage(AlertMessage message, AbstractRequestableResourceData reqResourceData) throws VizException { - Object objectToSend = null; Map attribs = new HashMap( message.decodedAlert); - String dataURI = message.dataURI; - if (reqResourceData.isUpdatingOnMetadataOnly()) { - PluginDataObject record = RecordFactory.getInstance() - .loadRecordFromUri(dataURI); - objectToSend = record; - } else { - attribs.put("dataURI", message.dataURI); - Map vals = new HashMap(); - for (String column : attribs.keySet()) { - if (column.equals("dataURI")) { - continue; - } - if ((attribs.get(column) == null) - || attribs.get(column).toString().equals("null")) { - vals.put(column, new RequestConstraint(null, - RequestConstraint.ConstraintType.ISNULL)); - } else { - vals.put(column, new RequestConstraint(attribs.get(column) - .toString())); - } - } - // remove cache'd entry from grib time cache - GribMapKey mapKey = new GribMapKey(attribs); - GribTimeCache.getInstance().clearTimes(mapKey); + // remove cache'd entry from grib time cache + GribMapKey mapKey = new GribMapKey(attribs); + GribTimeCache.getInstance().clearTimes(mapKey); - // Make sure there is really data before sending it to be loaded - DataTime[] availableTimes = DataCubeContainer.performTimeQuery( - vals, false); - if (availableTimes == null) { - return objectToSend; - } - for (DataTime time : availableTimes) { - if (time.equals(attribs.get("dataTime"))) { - LayerProperty lp = new LayerProperty(); - lp.setDesiredProduct(ResourceType.PLAN_VIEW); - lp.setEntryQueryParameters(vals, false); - lp.setSelectedEntryTimes(new DataTime[] { time }); - List resp = DataCubeContainer.getData(lp, 60000); - if (resp.size() == 0) - return null; - objectToSend = resp.get(0); - break; - } - } - } - return objectToSend; + return super.parseAlertMessage(message, reqResourceData); } } diff --git a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridResourceData.java b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridResourceData.java index 474a6b69aa..32dd1b967d 100644 --- a/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridResourceData.java +++ b/cave/com.raytheon.viz.grid/src/com/raytheon/viz/grid/rsc/GridResourceData.java @@ -107,18 +107,6 @@ public class GridResourceData extends AbstractRequestableResourceData implements setAlertParser(new GribDataCubeAlertMessageParser()); } - /* - * (non-Javadoc) - * - * @see - * com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData#update(java - * .lang.Object) - */ - @Override - public void update(Object updateData) { - super.update(updateData); - } - @Override public AbstractVizResource construct(LoadProperties loadProperties, IDescriptor descriptor) throws VizException { diff --git a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDisplayCanvas.java b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDisplayCanvas.java index 2624866ef4..adcdb70247 100644 --- a/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDisplayCanvas.java +++ b/cave/com.raytheon.viz.hydro/src/com/raytheon/viz/hydro/timeseries/TimeSeriesDisplayCanvas.java @@ -125,6 +125,9 @@ import com.raytheon.viz.hydrocommon.util.DbUtils; * 24 April 2012 14669 wkwock Handle invalid color name * 08 May 2012 14958 wkwock Fix overcrowded TS list * 30 May 2012 14967 wkwock Fix incorrect product time + * 06 Nov 2012 15399 wkwock Fix refine the plot algorithm and sampling algorithm + * 06 Nov 2012 15459 lbousaidi update data when page/up or page/down is pressed without having + * to click in graph button again. * @author lvenable * @version 1.0 * @@ -423,8 +426,10 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements @Override public void keyPressed(KeyEvent e) { if (e.keyCode == SWT.ARROW_UP) { + newRequest=true; dialog.pageUpAction(); } else if (e.keyCode == SWT.ARROW_DOWN) { + newRequest=true; dialog.pageDownAction(); } } @@ -1274,8 +1279,8 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements swapPoints(rubberBandX1, rubberBandX2, rubberBandY1, rubberBandY2); } - Date xMin = pixel2x(gd, rubberBandX1); - Date xMax = pixel2x(gd, rubberBandX2); + Date xMin = pixel2x(gd, rubberBandX1-GRAPHBORDER_LEFT); + Date xMax = pixel2x(gd, rubberBandX2-GRAPHBORDER_LEFT); gd.setXMin(xMin); gd.setXMax(xMax); @@ -1587,7 +1592,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements */ private String buildPointString(int x, int y) { StringBuilder sb = new StringBuilder(); - Date xValue = pixel2x(graphData, x); + Date xValue = pixel2x(graphData, x-GRAPHBORDER_LEFT); SimpleDateFormat format = new SimpleDateFormat("MM/dd/yyyy HH:mm'Z'"); format.setTimeZone(TimeZone.getTimeZone("GMT")); sb.append(format.format(xValue)); @@ -2066,7 +2071,7 @@ public class TimeSeriesDisplayCanvas extends TimeSeriesGraphCanvas implements getAgain = false; } else if (traceSelected && dialog.isInsert()) { insertedPoint = new TimeSeriesPoint(); - insertedPoint.setX(pixel2x(graphData, e.x)); + insertedPoint.setX(pixel2x(graphData, e.x-GRAPHBORDER_LEFT)); insertedPoint.setY(pixel2y(graphData, e.y)); ForecastData data = createPoint( graphData.getTraceData(selectedTraceId), insertedPoint); diff --git a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResourceData.java b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResourceData.java index c19d251b0a..819a94935e 100644 --- a/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResourceData.java +++ b/cave/com.raytheon.viz.pointdata/src/com/raytheon/viz/pointdata/rsc/PlotResourceData.java @@ -38,16 +38,13 @@ import com.raytheon.uf.common.dataquery.requests.RequestConstraint; import com.raytheon.uf.common.dataquery.requests.RequestableMetadataMarshaller; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; -import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.BinOffset; import com.raytheon.uf.common.time.DataTime; import com.raytheon.uf.viz.core.exception.VizException; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractVizResource; -import com.raytheon.uf.viz.core.rsc.IResourceDataChanged.ChangeType; import com.raytheon.uf.viz.core.rsc.LoadProperties; import com.raytheon.viz.pointdata.LocalizationParsedURLHandler; -import com.raytheon.viz.pointdata.PlotInfo; import com.raytheon.viz.pointdata.rsc.retrieve.AbstractPlotInfoRetriever; import com.raytheon.viz.pointdata.rsc.retrieve.PointDataPlotInfoRetriever; @@ -336,51 +333,6 @@ public class PlotResourceData extends AbstractRequestableResourceData { return available; } - @Override - public void update(Object updateData) { - // Validate.isTrue(updateData instanceof PlotInfo[], - // "Update expected PlotInfo[]"); - if (updateData instanceof PlotInfo[]) { - PlotInfo[] plots = (PlotInfo[]) updateData; - for (PlotInfo info : plots) { - DataTime time = info.dataTime; - if (binOffset != null) { - time = binOffset.getNormalizedTime(time); - } - synchronized (cachedAvailableTimes) { - if (!cachedAvailableTimes.contains(time)) { - cachedAvailableTimes.add(time); - } - } - } - } else if (updateData instanceof PluginDataObject[]) { - PluginDataObject[] plots = (PluginDataObject[]) updateData; - for (PluginDataObject info : plots) { - DataTime time = info.getDataTime(); - if (binOffset != null) { - time = binOffset.getNormalizedTime(time); - } - synchronized (cachedAvailableTimes) { - if (!cachedAvailableTimes.contains(time)) { - cachedAvailableTimes.add(time); - } - } - } - } else { - statusHandler - .handle(Priority.PROBLEM, - "expected PlotInfo[] or PluginDataObject[] but got " - + updateData.getClass().toString(), - new Exception()); - } - - if (updateData instanceof Object[]) { - // fire change listeners only if update data is an array ( see - // AbtractRequestableResouceData.update(Object) ) - this.fireChangeListeners(ChangeType.DATA_UPDATE, updateData); - } - } - @Override public boolean equals(Object obj) { // TODO Auto-generated method stub diff --git a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/RadarAlterBundleContributor.java b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/RadarAlterBundleContributor.java index 1a73013aed..46e39a4bac 100644 --- a/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/RadarAlterBundleContributor.java +++ b/cave/com.raytheon.viz.radar/src/com/raytheon/viz/radar/ui/RadarAlterBundleContributor.java @@ -31,8 +31,8 @@ import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay; import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.localization.LocalizationConstants; import com.raytheon.uf.viz.core.localization.LocalizationManager; +import com.raytheon.uf.viz.core.procedures.AlterBundleContributorAdapter; import com.raytheon.uf.viz.core.procedures.Bundle; -import com.raytheon.uf.viz.core.procedures.IAlterBundleContributor; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractResourceData; import com.raytheon.uf.viz.core.rsc.IResourceGroup; @@ -41,7 +41,7 @@ import com.raytheon.viz.core.rsc.BestResResourceData; import com.raytheon.viz.radar.rsc.RadarResourceData; /** - * TODO Add Description + * Class to handle alter bundles for radar. * *
  * 
@@ -49,6 +49,7 @@ import com.raytheon.viz.radar.rsc.RadarResourceData;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Jan 4, 2010            mschenke     Initial creation
+ * Oct 3, 2012  #1248      rferrel     Change to use adapter.
  * 
  * 
* @@ -56,7 +57,7 @@ import com.raytheon.viz.radar.rsc.RadarResourceData; * @version 1.0 */ -public class RadarAlterBundleContributor implements IAlterBundleContributor { +public class RadarAlterBundleContributor extends AlterBundleContributorAdapter { private static final String RADAR_KEY = "Radar"; diff --git a/cave/com.raytheon.viz.satellite/localization/menus/satellite/baseSatellite.xml b/cave/com.raytheon.viz.satellite/localization/menus/satellite/baseSatellite.xml index e2cd92cec6..732314f692 100644 --- a/cave/com.raytheon.viz.satellite/localization/menus/satellite/baseSatellite.xml +++ b/cave/com.raytheon.viz.satellite/localization/menus/satellite/baseSatellite.xml @@ -39,7 +39,7 @@ - + /satellite/%/NESDIS/GOES%/%/Imager_3.9_micron_IR @@ -51,7 +51,7 @@ - + /satellite/%/NESDIS/GOES%/%/Imager_3.9_micron_IR diff --git a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatBestResResourceData.java b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatBestResResourceData.java index ab3271b5bf..6e682d0f5d 100644 --- a/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatBestResResourceData.java +++ b/cave/com.raytheon.viz.satellite/src/com/raytheon/viz/satellite/rsc/SatBestResResourceData.java @@ -67,6 +67,7 @@ import com.vividsolutions.jts.geom.Polygon; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jul 30, 2010 mschenke Initial creation + * Oct 31, 2012 DR 15287 D. Friedman Fix overlap calculation * * * @@ -334,7 +335,7 @@ public class SatBestResResourceData extends AbstractRequestableResourceData { for (Polygon last : prevs) { // Don't want to double include percentage areas - totalPercentage -= last.intersection(polygon) + totalPercentage -= last.intersection(polygon).intersection(extent) .getArea() / extent.getArea(); } } diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AfosBrowserDlg.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AfosBrowserDlg.java index f415427ec2..a1cf78d441 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AfosBrowserDlg.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/AfosBrowserDlg.java @@ -257,7 +257,7 @@ public class AfosBrowserDlg extends CaveSWTDialog implements @Override public void shellClosed(ShellEvent event) { // Block the disposal of this dialog. - AfosBrowserDlg.this.shell.setVisible(false); + AfosBrowserDlg.this.hide(); isAfosActive = false; event.doit = false; } @@ -555,7 +555,7 @@ public class AfosBrowserDlg extends CaveSWTDialog implements .getAfosCommand(currentAfosCommand)); setReturnValue(false); - shell.setVisible(false); + hide(); isAfosActive = false; } }); @@ -569,19 +569,15 @@ public class AfosBrowserDlg extends CaveSWTDialog implements @Override public void widgetSelected(SelectionEvent event) { setReturnValue(false); - shell.setVisible(false); + hide(); isAfosActive = false; } }); } public void showDialog() { - if (shell.isVisible() == false) { - shell.setVisible(true); - isAfosActive = true; - } - - shell.setActive(); + bringToTop(); + isAfosActive = true; } /** diff --git a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java index 3348207ded..6ed0692300 100644 --- a/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java +++ b/cave/com.raytheon.viz.texteditor/src/com/raytheon/viz/texteditor/dialogs/TextEditorDialog.java @@ -178,6 +178,7 @@ import com.raytheon.viz.texteditor.util.SiteAbbreviationUtil; import com.raytheon.viz.texteditor.util.TextEditorUtil; import com.raytheon.viz.texteditor.util.VtecObject; import com.raytheon.viz.texteditor.util.VtecUtil; +import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.dialogs.SWTMessageBox; @@ -294,8 +295,13 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox; * 27SEP2012 1196 rferrel Changes for non-blocking ScriptOutputDlg. * 27SEP2012 15424 S.Naples Set focus on AFOS command text field after executing retrieval of product. * 09Oct2012 14889 M.Gamazaychikov Add call to checkAndWrapPreviousLine + * 26SEP2012 1196 lvenable Refactor dialogs to prevent blocking. + * 27SEP2012 1196 rferrel Changes for non-blocking ScriptOutputDlg. + * 01OCT2012 1229 rferrel Change WmoBrowserDlg to non-blocking + * 10OCT2012 1229 rferrel Changed AwipsBrowserDlg to non-blocking. * 12OCT2012 15418 D.Friedman Do not store product when sending in operational mode. * Do not use changed BBB from OUPResponse. + * 17OCT2012 1229 rferrel Changes for non-blocking SWTMessageBox. * * * @author lvenable @@ -341,6 +347,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, private boolean wordWrapEnabled = true; + private CaveJFACEDialog browser = null; + /** * When auto wrapping the last line that needs to be wrapped. */ @@ -349,8 +357,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, /** * Last line was wrapped backwards */ - private boolean isPreviousLineWrapped = false; - private static final String PARAGRAPH_DELIMITERS = "*$.-/^#"; private static final String PADDED_PARAGRAPH_DELIMITERS = "*"; @@ -936,11 +942,6 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, */ private Combo editorInsertCmb; - /** - * Redraw flag indicating if the window should redraw on a resize. - */ - private boolean canRedraw = true; - /** * Flag indicating if the editor is in edit mode. */ @@ -1007,6 +1008,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, private AfosBrowserDlg afosBrowser; + private boolean displayAfosBrowser = false; + + private boolean cancelDoClose = false; + /** * Where the last modified text event started. */ @@ -1142,6 +1147,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, .getTimeZone(TimeTools.ZULU_TIMEZONE)); } + private boolean isPreviousLineWrapped; + /** * Constructor with additional cave style rules * @@ -1236,8 +1243,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, shell.addShellListener(new ShellAdapter() { @Override public void shellClosed(ShellEvent event) { - if (!cancelEditor(true)) { - shell.setVisible(true); + if (inEditMode) { + cancelDoClose = true; + cancelEditor(true); + bringToTop(); event.doit = false; return; } @@ -1256,8 +1265,20 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, return; } + if (afosBrowser != null + && afosBrowser.isAfosBrowserActive()) { + afosBrowser.hide(); + displayAfosBrowser = true; + } else { + displayAfosBrowser = false; + } + + if (browser != null) { + browser.hide(); + } + // Block the disposal of this dialog. - shell.setVisible(false); + hide(); event.doit = false; } }); @@ -1266,7 +1287,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, @Override public void widgetDisposed(DisposeEvent e) { inEditMode = false; - shell.dispose(); + close(); } }); } @@ -1527,9 +1548,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, @Override public void widgetSelected(SelectionEvent event) { if (disposeOnExit == true) { - shell.dispose(); + close(); } else { - shell.setVisible(false); + hide(); } inEditMode = false; } @@ -3127,14 +3148,14 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, TextDisplayModel.getInstance().setProductDesignator(token, awipsIdTF.getText(3, charCount - 1)); } + // Highlight the text contained in the Awips ID Field. + awipsIdTF.selectAll(); // Perform the query of the product identified by the Awips ID. // TODO Generate and AWIPSCommand ICommand command = CommandFactory.getAwipsCommand(awipsIdTF .getText()); executeCommand(command); - // Highlight the text contained in the Awips ID Field. - awipsIdTF.selectAll(); } }); @@ -3789,7 +3810,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, * true if prompting desired */ private boolean cancelEditor(boolean prompt) { - if (shell.isDisposed()) { + if (isDisposed()) { // If the shell has been disposed due to closing of a parent, // do not follow the normal cancel procedure. return false; @@ -3799,11 +3820,30 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, SWTMessageBox mb = new SWTMessageBox(shell, "Cancel Editor", "Any unsaved changes will be lost. Cancel anyway?", SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.ICON_WARNING); - Object rval = mb.open(); - if (!(rval instanceof Integer) || ((Integer) rval) == SWT.NO) { - return false; - } + mb.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof Integer) { + int rval = (Integer) returnValue; + if (rval == SWT.YES) { + doCancelEditor(); + if (cancelDoClose) { + hide(); + } + } + cancelDoClose = false; + } + } + }); + + mb.open(); + return false; } + return doCancelEditor(); + } + + private boolean doCancelEditor() { stopAutoSave(); @@ -4348,12 +4388,12 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, * Display the AFOS Browser dialog. */ private void displayAfosBrowser() { - if (afosBrowser == null || afosBrowser.isDisposed() == true) { + if (mustCreate(afosBrowser)) { afosBrowser = new AfosBrowserDlg(shell, shell.getText(), this, token); afosBrowser.open(); } else { - afosBrowser.showDialog(); + afosBrowser.bringToTop(); } } @@ -4366,13 +4406,13 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, open(); } - if (shell.isVisible() == false) { - shell.setVisible(true); + bringToTop(); + if (displayAfosBrowser) { + afosBrowser.showDialog(); } - shell.setActive(); - if (afosBrowser != null && afosBrowser.isAfosBrowserActive()) { - afosBrowser.showDialog(); + if (browser != null) { + browser.bringToTop(); } } @@ -4381,9 +4421,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, return; } - if (shell != null && shell.isVisible() == true) { - shell.setVisible(false); - } + // Allow the shell listener to clean up other dialogs and then hide the + // dialog. + close(); inEditMode = false; } @@ -5320,11 +5360,16 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, executeCommand(command, false); } - public void executeCommand(ICommand command, boolean isObsUpdated) { + public void executeCommand(ICommand command, final boolean isObsUpdated) { if (isDisposed()) { return; } + if (browser != null) { + browser.close(); + browser = null; + } + boolean enterEditor = false; commandHistory.addCommand(command); statusBarLabel.setText("Loading " @@ -5338,21 +5383,50 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, if (queryTransport == null) { queryTransport = TextEditorUtil.getTextDbsrvTransport(); } - List prodList = command + final List prodList = command .executeCommand(queryTransport); if (prodList != null && prodList.size() > 0) { if (prodList.size() > 1) { if (CommandType.WMO.equals(command.getType())) { - WmoBrowserDlg browser = new WmoBrowserDlg(Display - .getCurrent().getActiveShell(), this, prodList); - browser.setBlockOnOpen(true); + final boolean hasAtt = hasAttachment; + final boolean enterEd = enterEditor; + final boolean validExecuteCmd = validExecuteCommand; + final String attachedFN = attachedFilename; + browser = new WmoBrowserDlg(getShell(), this, prodList); + browser.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + postProductCheck(isObsUpdated, prodList); + postExecute(hasAtt, enterEd, validExecuteCmd, + attachedFN); + browser = null; + } + }); + browser.setBlockOnOpen(false); browser.open(); + return; } else if (CommandType.AWIPS.equals(command.getType())) { - AwipsBrowserDlg browser = new AwipsBrowserDlg(Display - .getCurrent().getActiveShell(), this, prodList); - browser.setBlockOnOpen(true); + final boolean hasAtt = hasAttachment; + final boolean enterEd = enterEditor; + final boolean validExecuteCmd = validExecuteCommand; + final String attachedFN = attachedFilename; + browser = new AwipsBrowserDlg(getShell(), this, + prodList); + browser.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + postProductCheck(isObsUpdated, prodList); + postExecute(hasAtt, enterEd, validExecuteCmd, + attachedFN); + browser = null; + } + }); + browser.setBlockOnOpen(false); browser.open(); + return; } } else { StdTextProduct prod = prodList.get(0); @@ -5396,43 +5470,8 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, enterEditor = true; } - // Once we've got products and done all our processing, we need - // to tell the system that we've got a new set of standard - // text product parameters to work with here. - String warning = prodList.get(0).getProduct(); - String[] nnnxxx = TextDisplayModel.getNnnXxx(warning); - if (nnnxxx[0].equals("WRK")) { - String siteNode = SiteAbbreviationUtil - .getSiteNode(nnnxxx[1]); - if (siteNode.isEmpty()) { - // look up failed use current siteNode. - siteNode = prodList.get(0).getCccid(); - } - String ttaaii = SiteAbbreviationUtil.getTtaaii(siteNode - + nnnxxx[0] + nnnxxx[1]); - final String w = warning.replace( - TextWarningConstants.TTAAII, ttaaii); - TextDisplayModel.getInstance().createStdTextProduct(token, - w, siteNode); - } else if (!nnnxxx[1].equals("xxx")) { - String siteNode = SiteAbbreviationUtil - .getSiteNode(nnnxxx[1]); - String ttaaii = SiteAbbreviationUtil.getTtaaii(siteNode - + nnnxxx[0] + nnnxxx[1]); - final String w = warning.replace( - TextWarningConstants.TTAAII, ttaaii); - TextDisplayModel.getInstance().createStdTextProduct(token, - w, siteNode); - } - /* - * DR15103 - do not clear AFOS command from the text box when - * obs are updated - */ - if (!isObsUpdated) { - clearAfosCmdTF(); - } - clearWmoTF(); - clearAwipsIdTF(); + postProductCheck(isObsUpdated, prodList); + } else { userInformation("No product in the database matches your request."); @@ -5447,6 +5486,69 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, validExecuteCommand = false; } + postExecute(hasAttachment, enterEditor, validExecuteCommand, + attachedFilename); + } + + /** + * This is work to perform after selecting products from the prodList. This + * allows the dialogs to select entries to be non-blocking. + * + * @param isObsUpdated + * @param prodList + */ + private void postProductCheck(boolean isObsUpdated, + List prodList) { + // Once we've got products and done all our processing, we need + // to tell the system that we've got a new set of standard + // text product parameters to work with here. + String warning = prodList.get(0).getProduct(); + String[] nnnxxx = TextDisplayModel.getNnnXxx(warning); + if (nnnxxx[0].equals("WRK")) { + String siteNode = SiteAbbreviationUtil.getSiteNode(nnnxxx[1]); + if (siteNode.isEmpty()) { + // look up failed use current siteNode. + siteNode = prodList.get(0).getCccid(); + } + String ttaaii = SiteAbbreviationUtil.getTtaaii(siteNode + nnnxxx[0] + + nnnxxx[1]); + final String w = warning.replace(TextWarningConstants.TTAAII, + ttaaii); + TextDisplayModel.getInstance().createStdTextProduct(token, w, + siteNode); + } else if (!nnnxxx[1].equals("xxx")) { + String siteNode = SiteAbbreviationUtil.getSiteNode(nnnxxx[1]); + String ttaaii = SiteAbbreviationUtil.getTtaaii(siteNode + nnnxxx[0] + + nnnxxx[1]); + final String w = warning.replace(TextWarningConstants.TTAAII, + ttaaii); + TextDisplayModel.getInstance().createStdTextProduct(token, w, + siteNode); + } + /* + * DR15103 - do not clear AFOS command from the text box when obs are + * updated + */ + if (!isObsUpdated) { + clearAfosCmdTF(); + } + clearWmoTF(); + clearAwipsIdTF(); + + } + + /** + * The final part of the executeCommand after the command is executed and + * products seleted. This allows product selection dialogs to be + * non-blocking. + * + * @param hasAttachment + * @param enterEditor + * @param validExecuteCommand + * @param attachedFilename + */ + private void postExecute(boolean hasAttachment, boolean enterEditor, + boolean validExecuteCommand, String attachedFilename) { if (!this.isDisposed()) { if (hasAttachment) { statusBarLabel.setText("Attachment: " + attachedFilename); @@ -6713,6 +6815,11 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, clipboard.dispose(); } + if (browser != null) { + browser.close(); + browser = null; + } + inEditMode = false; } @@ -7051,7 +7158,7 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, wrapAtPositionOrLock(lineStartOffset + charWrapCol, padding); } } - + /* * DR14889 - add call to checkAndWrapPreviousLine */ @@ -7150,32 +7257,35 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, // split at the column, no whitespace wrapAtPositionOrLock(lineStartOffset + charWrapCol, padding); } - + /* * DR14889 - add call to checkAndWrapPreviousLine */ checkAndWrapPreviousLine(lineNumber); - + checkAndWrapNextLine(lineNumber); } - /** checks if the previous line is part of the same paragraph and continues + /** + * checks if the previous line is part of the same paragraph and continues * wrapping if it is + * * @param line */ private void checkAndWrapPreviousLine(int line) { - // if there is a previous line - if ( isPreviousLineWrapped ){ - return; - } + // if there is a previous line + if (isPreviousLineWrapped) { + return; + } if (line - 1 > 0) { // if the previous line does not start a new paragraph if (!isParagraphStart(line - 1)) { - // if the previous line is not empty ( marks the end of a paragraph + // if the previous line is not empty ( marks the end of a + // paragraph // ) if (!textEditor.getLine(line - 1).trim().isEmpty()) { // rewrap the previous line - isPreviousLineWrapped = true; + isPreviousLineWrapped = true; rewrapInternal(line - 1); } else if (line - 1 < endWrapLine) { // See if another paragraph needs to be wrapped. @@ -7185,19 +7295,19 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener, --nextLine; } if (nextLine <= endWrapLine) { - isPreviousLineWrapped = true; + isPreviousLineWrapped = true; rewrapInternal(nextLine); } } } else if (line - 1 <= endWrapLine) { - isPreviousLineWrapped = true; + isPreviousLineWrapped = true; rewrapInternal(line - 1); } } - - } - /** + } + + /** * checks if the paragraph starting at the line passed in uses two space * padding for subsequent lines * diff --git a/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationComponent.java b/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationComponent.java index e0786f71bd..24467330e1 100644 --- a/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationComponent.java +++ b/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationComponent.java @@ -4,8 +4,7 @@ import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Shell; import com.raytheon.uf.common.serialization.SerializationUtil; -import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase.CAVE; -import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; +import com.raytheon.viz.ui.personalities.awips.AbstractCAVEDialogComponent; /** * This software was developed and / or modified by Raytheon Company, @@ -28,7 +27,8 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; **/ /** - * TODO Add Description + * This class used to made a stand alone Text workstation. + * * *
  * 
@@ -38,6 +38,8 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent;
  * ------------ ---------- ----------- --------------------------
  * Apr 28, 2011            mschenke     Initial creation
  * Oct 02, 2012 1229       rferrel     Make a blocking dialog.
+ * Oct 17, 2012 1229       rferrel     Changes for non-blocking
+ *                                      TextWorkstationDlg.
  * 
  * 
* @@ -45,7 +47,7 @@ import com.raytheon.viz.ui.personalities.awips.AbstractCAVEComponent; * @version 1.0 */ -public class TextWorkstationComponent extends AbstractCAVEComponent { +public class TextWorkstationComponent extends AbstractCAVEDialogComponent { /* * (non-Javadoc) @@ -58,8 +60,9 @@ public class TextWorkstationComponent extends AbstractCAVEComponent { protected void startInternal(String componentName) throws Exception { SerializationUtil.getJaxbContext(); TextWorkstationDlg textWorkstationDlg = new TextWorkstationDlg( - new Shell(Display.getCurrent()), CAVE.NONE); + new Shell(Display.getCurrent())); textWorkstationDlg.open(); + blockUntilClosed(textWorkstationDlg); } /* diff --git a/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationDlg.java b/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationDlg.java index b0bb8d4ce2..cdb315bbef 100644 --- a/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationDlg.java +++ b/cave/com.raytheon.viz.textworkstation/src/com/raytheon/viz/textworkstation/TextWorkstationDlg.java @@ -28,7 +28,6 @@ import java.util.TimeZone; import java.util.Timer; import java.util.TimerTask; -import org.eclipse.core.runtime.Assert; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; @@ -143,15 +142,6 @@ public class TextWorkstationDlg extends CaveSWTDialog implements /** Select user ID dialog */ private SelectUserIdDlg userIdDlg; - /** - * Create a non-blocking dialog - * - * @param parent - */ - public TextWorkstationDlg(Shell parent) { - this(parent, CAVE.DO_NOT_BLOCK); - } - /** * Create dialog specifying NONE for blocking and DO_NOT_BLOCK for * non-blocking dialog. @@ -160,10 +150,11 @@ public class TextWorkstationDlg extends CaveSWTDialog implements * @param block * - CAVE.DO_NOT_BLOCK or CAVE.NONE */ - public TextWorkstationDlg(Shell parent, int block) { + public TextWorkstationDlg(Shell parent) { super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE, - CAVE.PERSPECTIVE_INDEPENDENT | CAVE.INDEPENDENT_SHELL | block); - Assert.isTrue(block == CAVE.DO_NOT_BLOCK || block == CAVE.NONE); + CAVE.PERSPECTIVE_INDEPENDENT | CAVE.INDEPENDENT_SHELL + | CAVE.DO_NOT_BLOCK); + setText("Text Workstation"); TextDisplayModel.getInstance().setTextAviation( diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java index 4999d82d18..e9b60f47b8 100644 --- a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java +++ b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEComponent.java @@ -20,7 +20,11 @@ package com.raytheon.viz.ui.personalities.awips; import java.io.IOException; +import java.text.DateFormat; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.Date; +import java.util.TimeZone; import javax.xml.bind.JAXBException; @@ -38,7 +42,6 @@ import org.eclipse.ui.application.WorkbenchAdvisor; import org.eclipse.ui.internal.WorkbenchPlugin; import org.eclipse.ui.statushandlers.StatusAdapter; -import com.raytheon.uf.common.comm.HttpClient; import com.raytheon.uf.common.datastorage.DataStoreFactory; import com.raytheon.uf.common.pypies.PyPiesDataStoreFactory; import com.raytheon.uf.common.pypies.PypiesProperties; @@ -49,6 +52,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.common.time.SimulatedTime; import com.raytheon.uf.viz.alertviz.SystemStatusHandler; import com.raytheon.uf.viz.alertviz.ui.dialogs.AlertVisualization; +import com.raytheon.uf.viz.application.ProgramArguments; import com.raytheon.uf.viz.application.component.IStandaloneComponent; import com.raytheon.uf.viz.core.VizApp; import com.raytheon.uf.viz.core.localization.CAVELocalizationNotificationObserver; @@ -77,6 +81,11 @@ import com.raytheon.viz.core.units.UnitRegistrar; * and CAVE immediately exits * if connection cannot be made to * localization server. + * May 31, 2012 #674 dgilling Allow SimulatedTime to be set from + * the command line. + * Oct 02, 2012 #1236 dgilling Allow SimulatedTime to be set from + * the command line even if practice + * mode is off. * * * @@ -105,10 +114,6 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent { @SuppressWarnings("restriction") @Override public final Object startComponent(String componentName) throws Exception { - UnitRegistrar.registerUnits(); - CAVEMode.performStartupDuties(); - - long t0 = System.currentTimeMillis(); // This is a workaround to receive status messages because without the // PlatformUI initialized Eclipse throws out the status // messages. Once PlatformUI has started, the status handler @@ -127,6 +132,11 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent { }); + UnitRegistrar.registerUnits(); + CAVEMode.performStartupDuties(); + + long t0 = System.currentTimeMillis(); + Display display = null; int modes = getRuntimeModes(); boolean alertviz = (modes & ALERT_VIZ) != 0; @@ -192,9 +202,7 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent { System.out.println("Localization time: " + (t1 - t0) + "ms"); try { - if (CAVEMode.getMode() == CAVEMode.PRACTICE) { - restoreUserTime(); - } + initializeSimulatedTime(); if (cave) { workbenchAdvisor = getWorkbenchAdvisor(); @@ -274,14 +282,34 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent { /** * Restore the prior state of SimulatedTime */ - private void restoreUserTime() { - // Get the last saved time from the localization settings - - // If CorePlugin.getDefault() == null, assume running from a unit test + private void initializeSimulatedTime() { long timeValue = 0; boolean isFrozen = false; - if (CAVEMode.getMode() == CAVEMode.PRACTICE - && CorePlugin.getDefault() != null) { + + // If CorePlugin.getDefault() == null, assume running from a unit test + if (CorePlugin.getDefault() != null) { + String dateString = ProgramArguments.getInstance().getString( + "-time"); + if (dateString != null && !dateString.isEmpty()) { + try { + DateFormat dateParser = new SimpleDateFormat( + "yyyyMMdd_HHmm"); + dateParser.setTimeZone(TimeZone.getTimeZone("GMT")); + Date newSimTime = dateParser.parse(dateString); + timeValue = newSimTime.getTime(); + } catch (ParseException e) { + statusHandler + .handle(Priority.WARN, + "Invalid argument specified for command-line parameter '-time'.", + e); + } + } + } + + // if we're in practice mode and the user did not specify a DRT value on + // the CLI, restore their previous time setting + if ((CAVEMode.getMode() == CAVEMode.PRACTICE) && (timeValue == 0)) { + // Get the last saved time from the localization settings timeValue = CorePlugin.getDefault().getPreferenceStore() .getLong(PreferenceConstants.P_LAST_USER_TIME); @@ -321,14 +349,8 @@ public abstract class AbstractCAVEComponent implements IStandaloneComponent { * Initializes the DataStoreFactory for the component. */ protected void initializeDataStoreFactory() { - // TODO: Test changing maxConnections per host PypiesProperties pypiesProps = new PypiesProperties(); pypiesProps.setAddress(VizApp.getPypiesServer()); - int connections = HttpClient.getInstance().getMaxConnectionsPerHost(); - if (connections <= 0) { - connections = 3; - } - pypiesProps.setMaxConnections(connections); DataStoreFactory.getInstance().setUnderlyingFactory( new PyPiesDataStoreFactory(pypiesProps)); } diff --git a/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEDialogComponent.java b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEDialogComponent.java new file mode 100644 index 0000000000..ecf2f0a53b --- /dev/null +++ b/cave/com.raytheon.viz.ui.personalities.awips/src/com/raytheon/viz/ui/personalities/awips/AbstractCAVEDialogComponent.java @@ -0,0 +1,54 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.viz.ui.personalities.awips; + +import org.eclipse.swt.widgets.Display; + +import com.raytheon.viz.ui.dialogs.CaveSWTDialogBase; + +/** + * This abstract class provides a way to wait for a non-blocking dialog to + * dispose before continuing. Since having more then one dialog blocking causes + * problems the intended uses is to block the top level dialog of a component + * running in stand alone mode. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Oct 18, 2012 1229       rferrel     Initial creation
+ * 
+ * 
+ * + * @author rferrel + * @version 1.0 + */ + +public abstract class AbstractCAVEDialogComponent extends AbstractCAVEComponent { + protected void blockUntilClosed(CaveSWTDialogBase dlg) { + while (!dlg.isDisposed()) { + if (!Display.getCurrent().readAndDispatch()) { + Display.getCurrent().sleep(); + } + } + } +} diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ImagePropertiesAction.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ImagePropertiesAction.java index 5f7a6bfbdf..e2a51234bf 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ImagePropertiesAction.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ImagePropertiesAction.java @@ -37,6 +37,7 @@ import com.raytheon.viz.ui.dialogs.ImagingDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Nov 22, 2006 chammack Initial Creation. + * Oct 17, 2012 1229 rferrel Changes for non-blocking ImagingDialog. * * * @@ -56,7 +57,7 @@ public class ImagePropertiesAction extends AbstractHandler { */ @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - if (dialog == null) { + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { IDisplayPaneContainer container = EditorUtil .getActiveVizContainer(); if (container != null) { @@ -64,11 +65,12 @@ public class ImagePropertiesAction extends AbstractHandler { .getCurrentWindow().getShell(), container); // initalize dialog.open(); + } else { dialog = null; } } else { dialog.refreshComponents(); - dialog.open(); + dialog.bringToTop(); } return null; diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/SetBackgroundColor.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/SetBackgroundColor.java index 081f930b8d..dce59577a0 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/SetBackgroundColor.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/SetBackgroundColor.java @@ -38,6 +38,7 @@ import com.raytheon.viz.ui.dialogs.colordialog.BackgroundColorDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jan 7,2008 Dan Fitch Initial Creation + * Oct 16, 2012 1229 rferrel Changed for non-blocking BackgroundColorDialog. * * * @@ -50,11 +51,10 @@ public class SetBackgroundColor extends AbstractHandler { @Override public Object execute(ExecutionEvent event) throws ExecutionException { - if (dialog == null) { + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { dialog = new BackgroundColorDialog( HandlerUtil.getActiveShell(event), null, BGColorMode.GLOBAL); dialog.open(); - dialog = null; } else { dialog.bringToTop(); } diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ShowTimeDialog.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ShowTimeDialog.java index 970b2930bb..3c0fcc4a9f 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ShowTimeDialog.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/actions/ShowTimeDialog.java @@ -39,6 +39,7 @@ import com.raytheon.viz.ui.dialogs.SetTimeDialog; * Aug 23,2012 #1087 dgilling Allow DRT mode to be engaged * regardless of practice or * operational mode. + * Oct 17, 2012 1229 rferrel Changes for non-blocking SetTimeDialog. * * * @@ -49,9 +50,7 @@ public class ShowTimeDialog extends AbstractHandler { @Override public Object execute(ExecutionEvent arg0) throws ExecutionException { - if (!SetTimeDialog.getInstance().isOpen()) { - SetTimeDialog.getInstance().open(); - } + SetTimeDialog.openDialog(); return null; } diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/ChangeColorMapAction.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/ChangeColorMapAction.java index 9e40d8d1f1..0b53f327c0 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/ChangeColorMapAction.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/ChangeColorMapAction.java @@ -26,6 +26,7 @@ import org.eclipse.ui.PlatformUI; import com.raytheon.uf.common.colormap.IColorMap; import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; import com.raytheon.viz.ui.dialogs.ColormapDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; /** * @@ -38,6 +39,7 @@ import com.raytheon.viz.ui.dialogs.ColormapDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jul 24, 2007 chammack Initial Creation. + * Oct 17, 2012 1229 rferrel Changes for non-blocking ColormapDialog. * * * @@ -45,6 +47,8 @@ import com.raytheon.viz.ui.dialogs.ColormapDialog; * @version 1 */ public class ChangeColorMapAction extends AbstractRightClickAction { + private ColormapDialog colorMapDlg; + public ChangeColorMapAction() { super("Change Colormap..."); } @@ -60,21 +64,42 @@ public class ChangeColorMapAction extends AbstractRightClickAction { */ @Override public void run() { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); - ColorMapCapability cap = getSelectedRsc().getCapability( - ColorMapCapability.class); - IColorMap prevColorMap = cap.getColorMapParameters().getColorMap(); - float prevMax = cap.getColorMapParameters().getColorMapMax(); - float prevMin = cap.getColorMapParameters().getColorMapMin(); - ColormapDialog cmd = new ColormapDialog(shell, "Set Color Table Range", - cap); - if (cmd.open() != ColormapDialog.OK) { - cap.getColorMapParameters().setColorMap(prevColorMap); - cap.getColorMapParameters().setColorMapMax(prevMax); - cap.getColorMapParameters().setColorMapMin(prevMin); - cap.notifyResources(); + if (colorMapDlg == null || colorMapDlg.getShell() == null + || colorMapDlg.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); + ColorMapCapability cap = getSelectedRsc().getCapability( + ColorMapCapability.class); + final IColorMap prevColorMap = cap.getColorMapParameters() + .getColorMap(); + final float prevMax = cap.getColorMapParameters().getColorMapMax(); + final float prevMin = cap.getColorMapParameters().getColorMapMin(); + colorMapDlg = new ColormapDialog(shell, "Set Color Table Range", + cap); + colorMapDlg.setBlockOnOpen(false); + colorMapDlg.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof Integer) { + int status = (Integer) returnValue; + if (status != ColormapDialog.OK) { + ColorMapCapability cap = colorMapDlg + .getColorMapCapability(); + cap.getColorMapParameters().setColorMap( + prevColorMap); + cap.getColorMapParameters().setColorMapMax(prevMax); + cap.getColorMapParameters().setColorMapMin(prevMin); + cap.notifyResources(); + } + } + colorMapDlg = null; + } + }); + colorMapDlg.open(); + } else { + colorMapDlg.bringToTop(); } } } diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/ImagingAction.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/ImagingAction.java index 2d6278eca6..9bacea93c0 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/ImagingAction.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/ImagingAction.java @@ -32,6 +32,7 @@ import com.raytheon.viz.ui.dialogs.ImagingDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Nov 22, 2006 chammack Initial Creation. + * Oct 17, 2012 1229 rferrel Changes for non-blocking ImagingDialog. * * * @@ -39,6 +40,7 @@ import com.raytheon.viz.ui.dialogs.ImagingDialog; * @version 1 */ public class ImagingAction extends AbstractRightClickAction { + private ImagingDialog dialog; /* * (non-Javadoc) @@ -47,10 +49,14 @@ public class ImagingAction extends AbstractRightClickAction { */ @Override public void run() { - AbstractVizResource rsc = getTopMostSelectedResource(); - ImagingDialog id = new ImagingDialog(VizWorkbenchManager.getInstance() - .getCurrentWindow().getShell(), rsc); - id.open(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + AbstractVizResource rsc = getTopMostSelectedResource(); + dialog = new ImagingDialog(VizWorkbenchManager.getInstance() + .getCurrentWindow().getShell(), rsc); + dialog.open(); + } else { + dialog.bringToTop(); + } } /* diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/LabelOffsetAction.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/LabelOffsetAction.java index 76c7d03abd..c4d329bcb5 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/LabelOffsetAction.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/cmenu/LabelOffsetAction.java @@ -35,6 +35,7 @@ import com.raytheon.viz.ui.dialogs.LabelOffsetDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Feb 3, 2011 randerso Initial creation + * Oct 17, 2012 1229 rferrel Made the dialog non-blocking. * * * @@ -43,6 +44,8 @@ import com.raytheon.viz.ui.dialogs.LabelOffsetDialog; */ public class LabelOffsetAction extends AbstractRightClickAction { + private LabelOffsetDialog dialog; + /** * Constructor */ @@ -57,14 +60,18 @@ public class LabelOffsetAction extends AbstractRightClickAction { */ @Override public void run() { - Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() - .getShell(); + if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) { + Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow() + .getShell(); - LabelableCapability cap = getSelectedRsc().getCapability( - LabelableCapability.class); + LabelableCapability cap = getSelectedRsc().getCapability( + LabelableCapability.class); - LabelOffsetDialog dlg = new LabelOffsetDialog(shell, cap); - dlg.setBlockOnOpen(true); - dlg.open(); + dialog = new LabelOffsetDialog(shell, cap); + dialog.setBlockOnOpen(false); + dialog.open(); + } else { + dialog.bringToTop(); + } } } diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/CaveSWTDialogBase.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/CaveSWTDialogBase.java index fe35207c2e..26928a5584 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/CaveSWTDialogBase.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/CaveSWTDialogBase.java @@ -52,6 +52,7 @@ import org.eclipse.swt.widgets.Shell; * Nov 2, 2010 mschenke Initial creation * Sep 12, 2012 #1165 lvenable Update for the initial process * of removing the dialog blocking capability. + * Oct 11, 2012 1229 jkorman Factored out "mustCreate" method from subclasses. * * * @@ -506,4 +507,17 @@ public abstract class CaveSWTDialogBase extends Dialog { this.caveStyle = caveStyle | CAVE.DO_NOT_BLOCK; this.closeCallback = callback; } + + /** + * Determines if the supplied reference should be created. + * + * @param dialog + * A dialog reference. + * @return Should the supplied reference should be created. + */ + public boolean mustCreate(CaveSWTDialogBase dialog) { + return (dialog == null) || (dialog.getShell() == null) + || (dialog.isDisposed()); + } + } diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/CaveSWTWizardDlg.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/CaveSWTWizardDlg.java index 790c557d9a..2001961a46 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/CaveSWTWizardDlg.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/CaveSWTWizardDlg.java @@ -46,6 +46,7 @@ import org.eclipse.swt.widgets.Shell; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Dec 19, 2010 lvenable Initial creation + * Oct 22, 2012 1229 rferrel Dialog changed to non-blocking. * * * @@ -75,7 +76,7 @@ public class CaveSWTWizardDlg extends CaveSWTDialog { private ArrayList pageCompArray; public CaveSWTWizardDlg(Shell parent, CaveSWTWizard swtWizzard) { - super(parent, SWT.APPLICATION_MODAL | SWT.MIN); + super(parent, SWT.APPLICATION_MODAL | SWT.MIN, CAVE.DO_NOT_BLOCK); this.swtWizzard = swtWizzard; if (swtWizzard.getTitle() != null) { setText(swtWizzard.getTitle()); diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ColormapDialog.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ColormapDialog.java index ab7262d07f..d390c25248 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ColormapDialog.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ColormapDialog.java @@ -45,6 +45,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.ColorMapCapability; * Feb 5, 2007 chammack Initial Creation. * Aug 20, 2008 dglazesk Updated for the new ColorMap interface * Oct 31, 2010 ryu use Text widgets for alternative entry + * Oct 17, 2016 1229 rferrel Changes to allow non-blocking dialog. * * * @@ -165,4 +166,7 @@ public class ColormapDialog extends CaveJFACEDialog { super.cancelPressed(); } + public ColorMapCapability getColorMapCapability() { + return cap; + } } diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ImagingDialog.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ImagingDialog.java index d62d00f53c..a817741abb 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ImagingDialog.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/ImagingDialog.java @@ -83,6 +83,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor; * show full colormap names, and added comments & Javadoc. * Aug 20, 2008 dglazesk Updated for the new ColorMap interface * Feb 10, 2011 #7842 bkowal set caveStyle for dialog to INDEPENDENT SHELL + * Oct 17, 2012 #1229 rferrel Make dialog non-blocking. * * * @@ -92,7 +93,7 @@ import com.raytheon.viz.ui.editor.IMultiPaneEditor; public class ImagingDialog extends CaveSWTDialog implements IVizEditorChangedListener, IRenderableDisplayChangedListener, AddListener, RemoveListener, IResourceDataChanged { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(ImagingDialog.class); private static enum Type { @@ -149,7 +150,7 @@ public class ImagingDialog extends CaveSWTDialog implements */ private Button combineNextImage; - private static final String UNSAVED_CMAP_DISPLAY_NAME = "Untitled Colormap"; + private final String UNSAVED_CMAP_DISPLAY_NAME = "Untitled Colormap"; private boolean fromControl = false; @@ -196,7 +197,8 @@ public class ImagingDialog extends CaveSWTDialog implements * @param dialogTitle */ public ImagingDialog(Shell parentShell, IDisplayPaneContainer initialEditor) { - super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.INDEPENDENT_SHELL); + super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.INDEPENDENT_SHELL + | CAVE.DO_NOT_BLOCK); setText("Imaging..."); this.currentEditor = initialEditor; @@ -207,7 +209,8 @@ public class ImagingDialog extends CaveSWTDialog implements } public ImagingDialog(Shell parentShell, AbstractVizResource rscToEdit) { - super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.INDEPENDENT_SHELL); + super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.INDEPENDENT_SHELL + | CAVE.DO_NOT_BLOCK); setText("Imaging..."); this.rscToEdit = rscToEdit; } diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/LabelOffsetDialog.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/LabelOffsetDialog.java index f72aef70a4..0928fa1cdf 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/LabelOffsetDialog.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/LabelOffsetDialog.java @@ -33,7 +33,7 @@ import org.eclipse.swt.widgets.Spinner; import com.raytheon.uf.viz.core.rsc.capabilities.LabelableCapability; /** - * TODO Add Description + * Dialog change the location of labels. * *
  * 
@@ -42,6 +42,7 @@ import com.raytheon.uf.viz.core.rsc.capabilities.LabelableCapability;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Feb 3, 2011            randerso     Initial creation
+ * Oct 17, 2012 1229       rferrel     Set origyOffset to the proper value.
  * 
  * 
* @@ -64,7 +65,6 @@ public class LabelOffsetDialog extends CaveJFACEDialog { */ public LabelOffsetDialog(Shell parentShell) { super(parentShell); - // TODO Auto-generated constructor stub } /** @@ -75,7 +75,7 @@ public class LabelOffsetDialog extends CaveJFACEDialog { super(parentShell); this.cap = cap; this.origxOffset = cap.getxOffset(); - this.origyOffset = cap.getxOffset(); + this.origyOffset = cap.getyOffset(); } /* diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/SWTMessageBox.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/SWTMessageBox.java index d8fa18a265..0f45b95b13 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/SWTMessageBox.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/SWTMessageBox.java @@ -41,6 +41,7 @@ import org.eclipse.swt.widgets.Shell; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 7, 2011 lvenable Initial creation + * Oct 18, 2012 1229 rferrel Made dialog non-blocking. * * * @@ -92,13 +93,15 @@ public class SWTMessageBox extends CaveSWTDialogBase { * @param swtMessageBoxStyle * Style for icon and buttons. */ - public SWTMessageBox(Shell parent, String title, String message, int swtMessageBoxStyle) { - this(parent, title, message, swtMessageBoxStyle, SWT.PRIMARY_MODAL, false); + public SWTMessageBox(Shell parent, String title, String message, + int swtMessageBoxStyle) { + this(parent, title, message, swtMessageBoxStyle, SWT.PRIMARY_MODAL, + false); } - public SWTMessageBox(Shell parent, String title, String message, int swtMessageBoxStyle, int modalSetting, - boolean centerMessage) { - super(parent, SWT.DIALOG_TRIM | modalSetting); + public SWTMessageBox(Shell parent, String title, String message, + int swtMessageBoxStyle, int modalSetting, boolean centerMessage) { + super(parent, SWT.DIALOG_TRIM | modalSetting, CAVE.DO_NOT_BLOCK); this.swtMessageBoxStyle = swtMessageBoxStyle; this.message = message; this.centerMessage = centerMessage; diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/SetTimeDialog.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/SetTimeDialog.java index e52fa2a056..b2855b2207 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/SetTimeDialog.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/SetTimeDialog.java @@ -53,6 +53,7 @@ import com.raytheon.viz.ui.VizWorkbenchManager; * Dec 03,2007 461 bphillip Added action functionality * May 21, 2008 1122 ebabin Updated to use new StatusBarDisplay. * 09JUL2008 1234 ebabin Updates for color, and display issues. + * Oct 17, 2012 1229 rferrel Made dialog non-blocking. * * * @@ -108,16 +109,18 @@ public class SetTimeDialog extends CaveSWTDialog { private static SetTimeDialog instance; - public static synchronized SetTimeDialog getInstance() { - if (instance == null) { + /** + * This allows only one instance of this dialog to be displayed. + */ + public static synchronized void openDialog() { + if (instance == null || instance.getShell() == null + || instance.isDisposed()) { instance = new SetTimeDialog(VizWorkbenchManager.getInstance() .getCurrentWindow().getShell()); + instance.open(); + } else { + instance.bringToTop(); } - return instance; - } - - public SetTimeDialog(Shell parent) { - this(parent, "Set Time"); } /** @@ -128,19 +131,39 @@ public class SetTimeDialog extends CaveSWTDialog { * @param title * Window title. */ - public SetTimeDialog(Shell parent, String title) { - super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT); - if (title == null) { - title = "Set Time"; - } - setText(title); + private SetTimeDialog(Shell parent) { + super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); + setText("Set Time"); } + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed() + */ + @Override + protected synchronized void disposed() { + instance = null; + } + + /* + * (non-Javadoc) + * + * @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout() + */ @Override protected Layout constructShellLayout() { return new GridLayout(1, true); } + /* + * (non-Javadoc) + * + * @see + * com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org + * .eclipse.swt.widgets.Shell) + */ @Override protected void initializeComponents(Shell shell) { createTopRadioButtons(); diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/colordialog/BackgroundColorDialog.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/colordialog/BackgroundColorDialog.java index ed10298aba..fc2b9850c6 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/colordialog/BackgroundColorDialog.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/colordialog/BackgroundColorDialog.java @@ -48,6 +48,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 1/8/2008 706 Dan Fitch Initial Creation. + * 10/16/2012 1229 rferrel Make dialog non-blocking. * * * @@ -108,7 +109,8 @@ public class BackgroundColorDialog extends CaveSWTDialog implements */ public BackgroundColorDialog(Shell parent, IDisplayPaneContainer container, BGColorMode mode) { - super(parent, SWT.DIALOG_TRIM | SWT.MIN, CAVE.PERSPECTIVE_INDEPENDENT); + super(parent, SWT.DIALOG_TRIM | SWT.MIN, CAVE.PERSPECTIVE_INDEPENDENT + | CAVE.DO_NOT_BLOCK); setText("Set Background Color"); this.container = container; this.mode = mode; diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/colordialog/ColorEditDialog.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/colordialog/ColorEditDialog.java index f6c1c026fe..4775079360 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/colordialog/ColorEditDialog.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/colordialog/ColorEditDialog.java @@ -63,6 +63,7 @@ import com.raytheon.viz.ui.EditorUtil; import com.raytheon.viz.ui.UiPlugin; import com.raytheon.viz.ui.VizWorkbenchManager; import com.raytheon.viz.ui.dialogs.CaveSWTDialog; +import com.raytheon.viz.ui.dialogs.ICloseCallback; import com.raytheon.viz.ui.editor.IMultiPaneEditor; import com.raytheon.viz.ui.editor.ISelectedPanesChangedListener; @@ -75,6 +76,7 @@ import com.raytheon.viz.ui.editor.ISelectedPanesChangedListener; * ------------ ---------- ----------- -------------------------- * lvenable Initial Creation. * Jul 24, 2007 njensen Hooked into backend. + * Oct 17, 2012 1229 rferrel Changes for non-blocking SaveColorMapDialog. * * * @@ -85,10 +87,10 @@ public class ColorEditDialog extends CaveSWTDialog implements IVizEditorChangedListener, IRenderableDisplayChangedListener, RemoveListener, AddListener, IResourceDataChanged, ISelectedPanesChangedListener, IColorEditCompCallback { - private static final transient IUFStatusHandler statusHandler = UFStatus + private final transient IUFStatusHandler statusHandler = UFStatus .getHandler(ColorEditDialog.class); - private static final String NO_COLOR_TABLE = "No color table is being edited"; + private final String NO_COLOR_TABLE = "No color table is being edited"; private String currentColormapName; @@ -144,6 +146,10 @@ public class ColorEditDialog extends CaveSWTDialog implements private static ColorEditDialog instance = null; + private SaveColorMapDialog officeSaveAsDialog; + + private SaveColorMapDialog saveAsDialog; + public static void openDialog(Shell parent, IDisplayPaneContainer container, AbstractVizResource singleRscToEdit, boolean rightImages, @@ -831,24 +837,44 @@ public class ColorEditDialog extends CaveSWTDialog implements } private void officeSaveAs() { - SaveColorMapDialog saveDialog = new SaveColorMapDialog(shell, - (ColorMap) cap.getColorMapParameters().getColorMap(), true, - currentColormapName); - String newName = (String) saveDialog.open(); - if (newName != null) { - currentColormapName = newName; - completeSave(); + if (mustCreate(officeSaveAsDialog)) { + officeSaveAsDialog = new SaveColorMapDialog(shell, (ColorMap) cap + .getColorMapParameters().getColorMap(), true, + currentColormapName); + officeSaveAsDialog.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof String) { + currentColormapName = (String) returnValue; + completeSave(); + } + } + }); + officeSaveAsDialog.open(); + } else { + officeSaveAsDialog.bringToTop(); } } private void saveAs() { - SaveColorMapDialog saveDialog = new SaveColorMapDialog(shell, - (ColorMap) cap.getColorMapParameters().getColorMap(), false, - currentColormapName); - String newName = (String) saveDialog.open(); - if (newName != null) { - currentColormapName = newName; - completeSave(); + if (mustCreate(saveAsDialog)) { + saveAsDialog = new SaveColorMapDialog(shell, (ColorMap) cap + .getColorMapParameters().getColorMap(), false, + currentColormapName); + saveAsDialog.setCloseCallback(new ICloseCallback() { + + @Override + public void dialogClosed(Object returnValue) { + if (returnValue instanceof String) { + currentColormapName = (String) returnValue; + completeSave(); + } + } + }); + saveAsDialog.open(); + } else { + saveAsDialog.bringToTop(); } } diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/colordialog/SaveColorMapDialog.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/colordialog/SaveColorMapDialog.java index 506c5dffed..d0cf62279d 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/colordialog/SaveColorMapDialog.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/dialogs/colordialog/SaveColorMapDialog.java @@ -55,6 +55,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jul 24, 2007 njensen Initial creation + * Oct 17, 2012 1229 rferrel Dialog is non-blocking. * * * @@ -85,7 +86,7 @@ public class SaveColorMapDialog extends CaveSWTDialog { */ public SaveColorMapDialog(Shell parent, ColorMap aColorMap, boolean aSiteContext, String aCurrentColormapName) { - super(parent); + super(parent, SWT.NONE, CAVE.DO_NOT_BLOCK); colorMapToSave = aColorMap; siteContext = aSiteContext; currentColormapName = new String(aCurrentColormapName == null ? "" diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/perspectives/AbstractWorkbenchPartContextActivator.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/perspectives/AbstractWorkbenchPartContextActivator.java index b3a8baaaf2..50e8cc7fca 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/perspectives/AbstractWorkbenchPartContextActivator.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/perspectives/AbstractWorkbenchPartContextActivator.java @@ -69,13 +69,13 @@ public abstract class AbstractWorkbenchPartContextActivator implements protected abstract boolean isPerspectivePart(IWorkbenchPartReference partRef); private void deactivate(IWorkbenchPartReference partRef) { - if (isPerspectivePart(partRef)) { + if ((partRef != null) && isPerspectivePart(partRef)) { contextManager.deactivateContexts(this); } } private void activate(IWorkbenchPartReference partRef) { - if (isPerspectivePart(partRef)) { + if ((partRef != null) && isPerspectivePart(partRef)) { contextManager.activateContexts(this); } else { contextManager.deactivateContexts(this); diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/statusline/StatBar.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/statusline/StatBar.java index 41a8d15075..7b832f008f 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/statusline/StatBar.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/statusline/StatBar.java @@ -53,6 +53,7 @@ import com.raytheon.viz.ui.statusline.StatusStore.IStatusListener; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Jul 14, 2008 #1223 randerso Initial creation + * Oct 22, 2012 #1229 rferrel Changes for non-blocking ViewMessageDialog. * * * @@ -276,6 +277,6 @@ public class StatBar extends ContributionItem implements IStatusListener { } private void viewMessages() { - statusStore.getViewMessagesDialog().open(); + statusStore.openViewMessagesDialog(); } } diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/statusline/StatusStore.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/statusline/StatusStore.java index 19c53fbf38..4edc7ac867 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/statusline/StatusStore.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/statusline/StatusStore.java @@ -39,6 +39,7 @@ import com.raytheon.viz.ui.statusline.StatusMessage.Importance; * ------------ ---------- ----------- -------------------------- * Jul 14, 2008 randerso Initial creation * Sep 12, 2008 wdougherty Added updateStatusTextI() method + * Oct 22, 2012 1229 rferrel Changes for non-blocking ViewMessagesDialog. * * * @@ -196,7 +197,8 @@ public class StatusStore { } // Update View Message display - if (viewDialog != null) { + if (viewDialog != null && viewDialog.getShell() != null + && !viewDialog.isDisposed()) { viewDialog.updateText(); } // Update Urgent Messages display @@ -243,13 +245,17 @@ public class StatusStore { }); } - public ViewMessagesDialog getViewMessagesDialog() { - if (viewDialog == null) { + public void openViewMessagesDialog() { + if (viewDialog == null || viewDialog.getShell() == null + || viewDialog.isDisposed()) { this.viewDialog = new ViewMessagesDialog(Display.getDefault() .getActiveShell(), this.messageBuffer, this.importanceDict, "View Messages"); + viewDialog.setBlockOnOpen(false); + viewDialog.open(); + } else { + viewDialog.bringToTop(); } - return viewDialog; } public StatBar getStatusBar() { diff --git a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/statusline/ViewMessagesDialog.java b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/statusline/ViewMessagesDialog.java index 0ae0da8d96..864497d828 100644 --- a/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/statusline/ViewMessagesDialog.java +++ b/cave/com.raytheon.viz.ui/src/com/raytheon/viz/ui/statusline/ViewMessagesDialog.java @@ -20,11 +20,11 @@ package com.raytheon.viz.ui.statusline; import java.text.SimpleDateFormat; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.TimeZone; -import org.eclipse.jface.dialogs.Dialog; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.StyleRange; import org.eclipse.swt.custom.StyledText; @@ -32,12 +32,14 @@ import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; import org.eclipse.swt.graphics.FontMetrics; import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; +import com.raytheon.viz.ui.dialogs.CaveJFACEDialog; import com.raytheon.viz.ui.statusline.StatusMessage.Importance; /** @@ -48,6 +50,7 @@ import com.raytheon.viz.ui.statusline.StatusMessage.Importance; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * May 19, 2008 Eric Babin Initial Creation + * Oct 22, 2012 1229 rferrel Converted to CaveJFACEDialog. * * * @@ -55,7 +58,7 @@ import com.raytheon.viz.ui.statusline.StatusMessage.Importance; * @version 1.0 */ -public class ViewMessagesDialog extends Dialog { +public class ViewMessagesDialog extends CaveJFACEDialog { private SimpleDateFormat sdf; @@ -71,6 +74,11 @@ public class ViewMessagesDialog extends Dialog { private Font font; + /** + * Track colors used so they can be reused and disposed. + */ + private final Map colorMap = new HashMap(); + /** * @param parent */ @@ -130,7 +138,9 @@ public class ViewMessagesDialog extends Dialog { /* * (non-Javadoc) * - * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) + * @see + * org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets + * .Shell) */ @Override protected void configureShell(Shell shell) { @@ -155,11 +165,21 @@ public class ViewMessagesDialog extends Dialog { String s = sdf.format(m.getMessageDate()) + " " + m.getMessageText() + "\n"; - // TODO: need to ensure colors are disposed + RGB rgb = importance.getForegroundColor(); + Color foregroundColor = colorMap.get(rgb); + if (foregroundColor == null) { + foregroundColor = new Color(top.getDisplay(), rgb); + colorMap.put(rgb, foregroundColor); + } + + rgb = importance.getBackgroundColor(); + Color backgroundColor = colorMap.get(rgb); + if (backgroundColor == null) { + backgroundColor = new Color(top.getDisplay(), rgb); + colorMap.put(rgb, backgroundColor); + } styleRanges[i++] = new StyleRange(startIndex, s.length(), - new Color(top.getDisplay(), importance - .getForegroundColor()), new Color(top - .getDisplay(), importance.getBackgroundColor())); + foregroundColor, backgroundColor); styledText.setText(styledText.getText() + s); @@ -168,4 +188,13 @@ public class ViewMessagesDialog extends Dialog { } } + @Override + public boolean close() { + for (Color color : colorMap.values()) { + color.dispose(); + } + colorMap.clear(); + return super.close(); + } + } diff --git a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/GridAlterBundleContributor.java b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/GridAlterBundleContributor.java index 67f0fe0ec9..cda728f0a8 100644 --- a/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/GridAlterBundleContributor.java +++ b/cave/com.raytheon.viz.volumebrowser/src/com/raytheon/viz/volumebrowser/GridAlterBundleContributor.java @@ -34,8 +34,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.viz.core.drawables.AbstractRenderableDisplay; import com.raytheon.uf.viz.core.drawables.ResourcePair; import com.raytheon.uf.viz.core.exception.VizException; +import com.raytheon.uf.viz.core.procedures.AlterBundleContributorAdapter; import com.raytheon.uf.viz.core.procedures.Bundle; -import com.raytheon.uf.viz.core.procedures.IAlterBundleContributor; import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData; import com.raytheon.uf.viz.core.rsc.AbstractResourceData; import com.raytheon.uf.viz.core.rsc.ResourceList; @@ -49,7 +49,7 @@ import com.raytheon.viz.volumebrowser.xml.VbSource; import com.raytheon.viz.volumebrowser.xml.VbSourceList; /** - * TODO Add Description + * Class to handle alter bundles for grids. * *
  * 
@@ -57,6 +57,7 @@ import com.raytheon.viz.volumebrowser.xml.VbSourceList;
  * Date         Ticket#    Engineer    Description
  * ------------ ---------- ----------- --------------------------
  * Jan 4, 2010            mschenke     Initial creation
+ * Oct 3, 2012  #1248      rferrel     Change to use adapter.
  * 
  * 
* @@ -64,7 +65,7 @@ import com.raytheon.viz.volumebrowser.xml.VbSourceList; * @version 1.0 */ -public class GridAlterBundleContributor implements IAlterBundleContributor { +public class GridAlterBundleContributor extends AlterBundleContributorAdapter { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(GridAlterBundleContributor.class); diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java index 2cb0d2285c..b1a4f10b66 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenDialog.java @@ -125,6 +125,8 @@ import com.vividsolutions.jts.geom.Polygon; * Sep 27, 2012 #1196 rferrel Refactored to use non-blocking dialogs * Oct 03, 2012 DR 15426 Qinglu Lin Unlock WarnGen GUI for COR, implemented in corSelected(); * but lock immediate cause, implemented in individual template. + * Nov 02, 2012 DR 15455 Qinglu Lin Added warngenLayer.setWarningAction() in resetPressed() + * and in updateListSelected(). * * * @@ -1169,6 +1171,7 @@ public class WarngenDialog extends CaveSWTDialog implements warngenLayer.getStormTrackState().trackVisible = false; } warngenLayer.resetInitialFrame(); + warngenLayer.setWarningAction(null); instructionsLabel.setText("Instructions:"); warngenLayer.issueRefresh(); } @@ -1566,6 +1569,7 @@ public class WarngenDialog extends CaveSWTDialog implements totalSegments = 0; warngenLayer.getStormTrackState().endTime = null; WarningAction action = WarningAction.valueOf(data.getAct()); + warngenLayer.setWarningAction(action); if (action == WarningAction.CON) { oldWarning = conSelected(data); } else if (action == WarningAction.COR) { diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java index db7b2e3352..2dd146da63 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenLayer.java @@ -52,6 +52,7 @@ import org.opengis.referencing.operation.MathTransform; import com.raytheon.uf.common.activetable.ActiveTableRecord; import com.raytheon.uf.common.dataplugin.warning.AbstractWarningRecord; +import com.raytheon.uf.common.dataplugin.warning.WarningRecord.WarningAction; import com.raytheon.uf.common.dataplugin.warning.config.BulletActionGroup; import com.raytheon.uf.common.dataplugin.warning.config.DialogConfiguration; import com.raytheon.uf.common.dataplugin.warning.config.GridSpacing; @@ -137,6 +138,11 @@ import com.vividsolutions.jts.io.WKTReader; * 03/19/2012 DR 14690 Qinglu Lin While newHatchedArea==null, handle the polygon differently * for initial warning and followup (CON); and * convert ratio to percentage while doing comparison. + * 10/29/2012 DR 15479 Qinglu Lin Added code to call removeDuplicateCoordinate() + * in redrawBoxFromHatched(). + * 11/02/2012 DR 15455 Qinglu Lin Added setWarningAction(), called redrawBoxFromTrack() while + * warningAction is neither null nor WarningAction.NEW, removed + * some code from redrawBoxFromHatched(). * * * @@ -222,6 +228,8 @@ public class WarngenLayer extends AbstractStormTrackResource { private GeospatialDataList geoData = null; + private WarningAction warningAction = null; + static { for (int i = 0; i < 128; i++) { if (i % 32 == 0) { @@ -474,14 +482,18 @@ public class WarngenLayer extends AbstractStormTrackResource { if (frameCount == 1 && displayState.geomChanged) { displayState.geomChanged = false; } - // Initialize box - if (((configuration.isTrackEnabled() == false || configuration - .getPathcastConfig() == null) && this.displayState.displayType != DisplayType.POLY) - || frameCount == 1) { - createSquare(); - resetInitialFrame(); + if (warningAction == null || warningAction == WarningAction.NEW) { + // Initialize box + if (((configuration.isTrackEnabled() == false || configuration + .getPathcastConfig() == null) && this.displayState.displayType != DisplayType.POLY) + || frameCount == 1) { + createSquare(); + resetInitialFrame(); + } else { + redrawBoxFromTrack(); + } } else { - redrawBoxFromTrack(); + redrawBoxFromTrack(); } } @@ -1364,10 +1376,6 @@ public class WarngenLayer extends AbstractStormTrackResource { if (displayState.mode == Mode.DRAG_ME) { return; - } else if (displayState.trackVisible == false - && displayState.displayType != DisplayType.POLY) { - createSquare(); - return; } DestinationGeodeticCalculator gc = new DestinationGeodeticCalculator(); GeometryFactory gf = new GeometryFactory(); @@ -1585,6 +1593,7 @@ public class WarngenLayer extends AbstractStormTrackResource { try { long t0 = System.currentTimeMillis(); + state.removeDuplicateCoordinate(); Polygon hatched = new PolygonUtil(this, geoData.nx, geoData.ny, 20, geoData.localExtent, geoData.localToLatLon) .hatchWarningArea(state.getWarningPolygon(), @@ -2322,4 +2331,8 @@ public class WarngenLayer extends AbstractStormTrackResource { + e.getLocalizedMessage(), e); } } + + public void setWarningAction(WarningAction warningAction) { + this.warningAction = warningAction; + } } diff --git a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenUIState.java b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenUIState.java index 73a88b9a2f..bb3090c986 100644 --- a/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenUIState.java +++ b/cave/com.raytheon.viz.warngen/src/com/raytheon/viz/warngen/gui/WarngenUIState.java @@ -19,11 +19,15 @@ **/ package com.raytheon.viz.warngen.gui; +import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; +import com.vividsolutions.jts.geom.GeometryFactory; import com.vividsolutions.jts.geom.Polygon; /** @@ -36,6 +40,7 @@ import com.vividsolutions.jts.geom.Polygon; * ------------ ---------- ----------- -------------------------- * May 7, 2010 mschenke Initial creation * 03/14/2012 DR 14690 Qinglu Lin Add clear2(). + * 10/26/2012 DR 15479 Qinglu Lin Added removeDuplicateCoordinate(). * * * @@ -115,6 +120,31 @@ public class WarngenUIState { return oldWarningArea; } + /** + * removeDuplicateCoordinate + * remove duplicate intermediate coordinates in warningPolygon. + * History + * 10-26-2012 Qinglu Lin DR15479 Created. + */ + public void removeDuplicateCoordinate() { + Coordinate[] verts = warningPolygon.getCoordinates(); + Set coords = new LinkedHashSet(); + for (Coordinate c: verts) + coords.add(c); + if ((verts.length-coords.size()) < 2) + return; + Coordinate[] vertices = new Coordinate[coords.size()+1]; + Iterator iter = coords.iterator(); + int i = 0; + while (iter.hasNext()) { + vertices[i] = new Coordinate(iter.next()); + i += 1; + } + vertices[i] = new Coordinate(vertices[0]); + GeometryFactory gf = new GeometryFactory(); + warningPolygon = gf.createPolygon(gf.createLinearRing(vertices), null); + } + /** * Set the old warning area in lat/lon projection. Will be converted to * local diff --git a/edexOsgi/build.edex/esb/conf/spring/edex.xml b/edexOsgi/build.edex/esb/conf/spring/edex.xml index ceac377b29..20a61c50e9 100644 --- a/edexOsgi/build.edex/esb/conf/spring/edex.xml +++ b/edexOsgi/build.edex/esb/conf/spring/edex.xml @@ -83,11 +83,16 @@ --> - - - + + - + + + + + + + diff --git a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/gfe/MetLib.py b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/gfe/MetLib.py index 963c908baf..e32e800321 100644 --- a/edexOsgi/build.edex/esb/data/utility/common_static/base/python/gfe/MetLib.py +++ b/edexOsgi/build.edex/esb/data/utility/common_static/base/python/gfe/MetLib.py @@ -159,7 +159,7 @@ def d_dx(grid): # Returns the derivative along the second innermost axis. By convention # this is the y-axis. def d_dy(grid): - return centeredDifference(grid, -2) + return -centeredDifference(grid, -2) # Returns the derivative along the third innermost axis. By convention # this is the z-axis. If a 2-dimensional grid is specified, an error diff --git a/edexOsgi/build.edex/esb/data/utility/edex_static/base/protectedFiles.txt b/edexOsgi/build.edex/esb/data/utility/edex_static/base/protectedFiles.txt index 4c5422020d..13d6dd90e9 100644 --- a/edexOsgi/build.edex/esb/data/utility/edex_static/base/protectedFiles.txt +++ b/edexOsgi/build.edex/esb/data/utility/edex_static/base/protectedFiles.txt @@ -5,6 +5,9 @@ # A simple example would be # BASE:common_static/textdb/textCategoryClass.txt +#SCAN_COMMON files +SITE:common_static/scan/SCANRunSiteConfig.xml + #AvnFPS files SITE:cave_static/aviation/avnwatch/aviationForecasterConfig.xml diff --git a/edexOsgi/build.edex/esb/data/utility/edex_static/base/smartinit/Init.py b/edexOsgi/build.edex/esb/data/utility/edex_static/base/smartinit/Init.py index 24d5231981..bf83a957b9 100644 --- a/edexOsgi/build.edex/esb/data/utility/edex_static/base/smartinit/Init.py +++ b/edexOsgi/build.edex/esb/data/utility/edex_static/base/smartinit/Init.py @@ -32,6 +32,10 @@ import SmartInitParams from numpy import * pytime = time +import RollBackImporter +rollbackImporter = RollBackImporter.RollBackImporter() + + #-------------------------------------------------------------------------- # Main program that calls model-specific algorithms to generate ifp grids. #-------------------------------------------------------------------------- @@ -1289,9 +1293,6 @@ def runFromJava(dbName, model, validTime): SmartInitParams.params['dbName'] = dbName SmartInitParams.params['validTime'] = validTime - if sys.modules.has_key(model): - sys.modules.__delitem__(model) - mod = __import__(model) mod.main() - + rollbackImporter.rollback() diff --git a/edexOsgi/build.edex/esb/data/utility/edex_static/base/smartinit/RollBackImporter.py b/edexOsgi/build.edex/esb/data/utility/edex_static/base/smartinit/RollBackImporter.py new file mode 100644 index 0000000000..064013e694 --- /dev/null +++ b/edexOsgi/build.edex/esb/data/utility/edex_static/base/smartinit/RollBackImporter.py @@ -0,0 +1,40 @@ +import sys, __builtin__, LogStream, re + +class RollBackImporter: + def __init__(self): + "Creates an instance and installs as the global importer" + self.previousModules = sys.modules.copy() + self.realImport = __builtin__.__import__ + __builtin__.__import__ = self._import + self.newModules = {} + self.pattern = re.compile("/.*?/edex/data/utility/.*?/(.*?)/") + + def _import(self, name, globals=None, locals=None, fromlist=[], level=-1): + result = self.realImport(name, globals, locals, fromlist, level) + + if hasattr(result, '__file__'): + match = re.match(self.pattern, result.__file__) + if match is not None: + level = match.group(1) + if level != 'base': + LogStream.logEvent("IMPORTING:", name, result) + self.newModules[result.__name__] = 1 + else: + LogStream.logDebug("IGNORING BASE:", name, result) + else: + LogStream.logDebug("IGNORING NON-LOCALIZED:", name, result) + else: + LogStream.logDebug("IGNORING BUILTIN:", name, result) + return result + + def rollback(self): + for modname in self.newModules.keys(): + if not self.previousModules.has_key(modname): + # Force reload when modname next imported + LogStream.logEvent("UNLOADING:", modname, sys.modules[modname]) + del(sys.modules[modname]) + else: + LogStream.logDebug("SKIPPING PRELOADED:", modname) + + self.newModules = {} + diff --git a/edexOsgi/com.raytheon.edex.ingestsrv/src/com/raytheon/edex/services/PersistSrv.java b/edexOsgi/com.raytheon.edex.ingestsrv/src/com/raytheon/edex/services/PersistSrv.java index 2bcbebd228..48d4218703 100644 --- a/edexOsgi/com.raytheon.edex.ingestsrv/src/com/raytheon/edex/services/PersistSrv.java +++ b/edexOsgi/com.raytheon.edex.ingestsrv/src/com/raytheon/edex/services/PersistSrv.java @@ -102,40 +102,38 @@ public class PersistSrv { // All we know is something bad happened. logger.error("Persistence error occurred: ", s); } - - // Produce error messages for each pdo that failed - int errCnt = 0; - boolean suppressed = false; - for (Map.Entry e : pdosThatFailed - .entrySet()) { - if (errCnt > 50) { - logger.warn("More than 50 errors occurred in this batch. The remaining errors will be suppressed."); - suppressed = true; - continue; - } - - if (!suppressed) { - if (e.getValue() instanceof DuplicateRecordStorageException) { - logger.warn("Duplicate record encountered (duplicate ignored): " - + e.getKey().getDataURI()); - } else { - logger.error( - "Error persisting record " + e.getKey() - + " to database: ", - e.getValue()); - } - } - - // Remove from the pdoList so the pdo is not propagated - // to the next service - pdoList.remove(e.getKey()); - errCnt++; - - } } - } + // Produce error messages for each pdo that failed + int errCnt = 0; + boolean suppressed = false; + for (Map.Entry e : pdosThatFailed + .entrySet()) { + if (errCnt > 50) { + logger.warn("More than 50 errors occurred in this batch. The remaining errors will be suppressed."); + suppressed = true; + continue; + } + if (!suppressed) { + if (e.getValue() instanceof DuplicateRecordStorageException) { + logger.warn("Duplicate record encountered (duplicate ignored): " + + e.getKey().getDataURI()); + + } else { + logger.error( + "Error persisting record " + e.getKey() + + " to database: ", e.getValue()); + } + } + + // Remove from the pdoList so the pdo is not propagated + // to the next service + pdoList.remove(e.getKey()); + errCnt++; + + } + } } catch (Throwable e1) { logger.error( "Critical persistence error occurred. Individual records that failed will be logged separately.", diff --git a/edexOsgi/com.raytheon.edex.plugin.airep/utility/common_static/base/purge/airepPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.airep/utility/common_static/base/purge/airepPurgeRules.xml index f9a761aa5e..1182b36c71 100644 --- a/edexOsgi/com.raytheon.edex.plugin.airep/utility/common_static/base/purge/airepPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.airep/utility/common_static/base/purge/airepPurgeRules.xml @@ -1,12 +1,8 @@ - - - - airep - default - + + 24 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.binlightning/utility/common_static/base/purge/binlightningPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.binlightning/utility/common_static/base/purge/binlightningPurgeRules.xml index 86b5416917..40446eac37 100644 --- a/edexOsgi/com.raytheon.edex.plugin.binlightning/utility/common_static/base/purge/binlightningPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.binlightning/utility/common_static/base/purge/binlightningPurgeRules.xml @@ -1,12 +1,8 @@ - - - - binlightning - default - + + 36 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosAVNPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosAVNPurgeRules.xml new file mode 100644 index 0000000000..f9e3c7487d --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosAVNPurgeRules.xml @@ -0,0 +1,8 @@ + + + + 8 + =00-01:00:00 + 00-01:00:00 + + diff --git a/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosETAPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosETAPurgeRules.xml new file mode 100644 index 0000000000..dd42ccee49 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosETAPurgeRules.xml @@ -0,0 +1,9 @@ + + + + + 5 + =00-01:00:00 + 00-01:00:00 + + diff --git a/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosGFSPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosGFSPurgeRules.xml new file mode 100644 index 0000000000..4ff68ba1a3 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosGFSPurgeRules.xml @@ -0,0 +1,8 @@ + + + + 5 + =00-01:00:00 + 00-01:00:00 + + diff --git a/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosHPCPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosHPCPurgeRules.xml new file mode 100644 index 0000000000..4ff68ba1a3 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosHPCPurgeRules.xml @@ -0,0 +1,8 @@ + + + + 5 + =00-01:00:00 + 00-01:00:00 + + diff --git a/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosLAMPPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosLAMPPurgeRules.xml new file mode 100644 index 0000000000..4ff68ba1a3 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosLAMPPurgeRules.xml @@ -0,0 +1,8 @@ + + + + 5 + =00-01:00:00 + 00-01:00:00 + + diff --git a/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosMRFPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosMRFPurgeRules.xml new file mode 100644 index 0000000000..143d0d65d2 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosMRFPurgeRules.xml @@ -0,0 +1,8 @@ + + + + 4 + =00-01:00:00 + 00-01:00:00 + + diff --git a/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosNGMPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosNGMPurgeRules.xml new file mode 100644 index 0000000000..4ff68ba1a3 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.bufrmos/utility/common_static/base/purge/bufrmosNGMPurgeRules.xml @@ -0,0 +1,8 @@ + + + + 5 + =00-01:00:00 + 00-01:00:00 + + diff --git a/edexOsgi/com.raytheon.edex.plugin.bufrua/utility/common_static/base/purge/bufruaPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.bufrua/utility/common_static/base/purge/bufruaPurgeRules.xml index c4f54abdd4..8691a0bdf5 100644 --- a/edexOsgi/com.raytheon.edex.plugin.bufrua/utility/common_static/base/purge/bufruaPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.bufrua/utility/common_static/base/purge/bufruaPurgeRules.xml @@ -1,12 +1,8 @@ - - - - bufrua - default - + + 21 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.ccfp/utility/common_static/base/purge/ccfpPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.ccfp/utility/common_static/base/purge/ccfpPurgeRules.xml index 67e5eafe0b..1182b36c71 100644 --- a/edexOsgi/com.raytheon.edex.plugin.ccfp/utility/common_static/base/purge/ccfpPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.ccfp/utility/common_static/base/purge/ccfpPurgeRules.xml @@ -1,12 +1,8 @@ - - - - ccfp - default - + + 24 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/database/NetCDFUtils.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/database/NetCDFUtils.java index 31bf23dcdb..0c9d07917a 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/database/NetCDFUtils.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/server/database/NetCDFUtils.java @@ -353,10 +353,12 @@ public class NetCDFUtils { yindex.add(igc.y); } - int xmin = Collections.min(xindex) - 1; - int xmax = Collections.max(xindex) + 1; - int ymin = Collections.min(yindex) - 1; - int ymax = Collections.max(yindex) + 1; + // find min/max plus a little extra for so interpolation doesn't have + // edge effects + int xmin = Collections.min(xindex) - 2; + int xmax = Collections.max(xindex) + 2; + int ymin = Collections.min(yindex) - 2; + int ymax = Collections.max(yindex) + 2; xmin = Math.max(0, xmin); ymin = Math.max(0, ymin); diff --git a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/SmartInitScript.java b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/SmartInitScript.java index 588526e538..ff8970c5fe 100644 --- a/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/SmartInitScript.java +++ b/edexOsgi/com.raytheon.edex.plugin.gfe/src/com/raytheon/edex/plugin/gfe/smartinit/SmartInitScript.java @@ -23,7 +23,7 @@ import java.util.Map; import jep.JepException; -import com.raytheon.uf.common.python.PythonScript; +import com.raytheon.uf.common.python.PythonEval; /** * A wrapper for running smart init python @@ -33,6 +33,10 @@ import com.raytheon.uf.common.python.PythonScript; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Apr 28, 2008 njensen Initial creation + * Oct 23, 2012 #1291 randerso Changed to extend PythonEval instead + * of PythonScript so it doesn't get run + * causing it to load as module __main__ + * instead of Init. * * * @@ -40,7 +44,7 @@ import com.raytheon.uf.common.python.PythonScript; * @version 1.0 */ -public class SmartInitScript extends PythonScript { +public class SmartInitScript extends PythonEval { private static final String METHOD_NAME = "runFromJava"; @@ -57,8 +61,8 @@ public class SmartInitScript extends PythonScript { */ public SmartInitScript(String aFilePath, String anIncludePath, ClassLoader aClassLoader) throws JepException { - super(aFilePath, anIncludePath, aClassLoader); - jep.eval("import sys"); + super(anIncludePath, aClassLoader); + jep.eval("from Init import *"); } /** diff --git a/edexOsgi/com.raytheon.edex.plugin.goessounding/utility/common_static/base/purge/goessoundingPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.goessounding/utility/common_static/base/purge/goessoundingPurgeRules.xml index 3d845dd1ac..ef0c05b8b0 100644 --- a/edexOsgi/com.raytheon.edex.plugin.goessounding/utility/common_static/base/purge/goessoundingPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.goessounding/utility/common_static/base/purge/goessoundingPurgeRules.xml @@ -1,12 +1,8 @@ - - - - goessounding - default - + + 33 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/res/spring/grib-request.xml b/edexOsgi/com.raytheon.edex.plugin.grib/res/spring/grib-request.xml index 4bbbb1e9cc..566c947ccd 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/res/spring/grib-request.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/res/spring/grib-request.xml @@ -23,5 +23,9 @@ - + + + + + \ No newline at end of file diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/dao/GribDao.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/dao/GribDao.java index 78a6813581..a828854996 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/dao/GribDao.java +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/dao/GribDao.java @@ -57,11 +57,15 @@ import com.raytheon.uf.common.datastorage.records.ByteDataRecord; import com.raytheon.uf.common.datastorage.records.FloatDataRecord; import com.raytheon.uf.common.datastorage.records.IDataRecord; import com.raytheon.uf.common.datastorage.records.IntegerDataRecord; +import com.raytheon.uf.common.status.IUFStatusHandler; +import com.raytheon.uf.common.status.UFStatus; +import com.raytheon.uf.common.status.UFStatus.Priority; import com.raytheon.uf.edex.core.EDEXUtil; import com.raytheon.uf.edex.core.EdexException; import com.raytheon.uf.edex.core.dataplugin.PluginRegistry; import com.raytheon.uf.edex.database.DataAccessLayerException; import com.raytheon.uf.edex.database.plugin.PluginDao; +import com.raytheon.uf.edex.database.query.DatabaseQuery; /** * Data access object for accessing Grib records from the database @@ -73,6 +77,8 @@ import com.raytheon.uf.edex.database.plugin.PluginDao; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * 4/7/09 1994 bphillip Initial Creation + * 5/31/12 #674 dgilling Re-factor so all purge methods + * call updateCaches(). * * * @@ -81,6 +87,9 @@ import com.raytheon.uf.edex.database.plugin.PluginDao; */ public class GribDao extends PluginDao { + private static final transient IUFStatusHandler statusHandler = UFStatus + .getHandler(GribDao.class); + private static final String LOCAL_SECTION = "localSection"; private static final String HYBRID_LEVELS = "hybridLevels"; @@ -91,8 +100,6 @@ public class GribDao extends PluginDao { private static final String PURGE_MODEL_CACHE_TOPIC = "jms-generic:topic:purgeGribModelCache"; - private static final String ORPHAN_MODEL_QUERY = "select id from awips.grib_models where id not in(select distinct(modelinfo_id) from awips.grib)"; - /** * Creates a new GribPyDao object * @@ -109,62 +116,64 @@ public class GribDao extends PluginDao { this("grib"); } + @Override public void purgeExpiredData() throws PluginException { super.purgeExpiredData(); - try { - List orphanedIds = purgeGribModelOrphans(); - EDEXUtil.getMessageProducer().sendAsyncUri(PURGE_MODEL_CACHE_TOPIC, - orphanedIds); - } catch (DataAccessLayerException e1) { - statusHandler - .error("Error purging orphaned grib model entries", e1); - } catch (EdexException e) { - statusHandler.error( - "Error sending message to purge grib model topic", e); - } - try { - EDEXUtil.getMessageProducer().sendAsyncUri(REBUILD_CACHE_TOPIC, - null); - } catch (EdexException e) { - statusHandler.error( - "Error sending message to rebuild D2D Cache topic", e); - } + updateCaches(); } private List purgeGribModelOrphans() throws DataAccessLayerException { - QueryResult result = (QueryResult) this - .executeNativeSql(ORPHAN_MODEL_QUERY); + QueryResult result = (QueryResult) executeNativeSql("select id from awips.grib_models where id not in(select distinct(modelinfo_id) from awips.grib)"); List orphanedIds = new ArrayList(); for (int i = 0; i < result.getResultCount(); i++) { - orphanedIds.add((Integer) result.getRowColumnValue(0, 0)); + orphanedIds.add((Integer) result.getRowColumnValue(i, 0)); } + if (!orphanedIds.isEmpty()) { - this.executeNativeSql(ORPHAN_MODEL_QUERY.replace("select id", - "delete")); + DatabaseQuery deleteQuery = new DatabaseQuery(GribModel.class); + deleteQuery.addQueryParam("id", orphanedIds, "in"); + deleteByCriteria(deleteQuery); } return orphanedIds; } + @Override public void purgeAllData() throws PluginException { super.purgeAllData(); + updateCaches(); + } + + /** + * @throws PluginException + */ + private void updateCaches() throws PluginException { + Exception rethrow = null; + try { List orphanedIds = purgeGribModelOrphans(); EDEXUtil.getMessageProducer().sendAsyncUri(PURGE_MODEL_CACHE_TOPIC, orphanedIds); - } catch (DataAccessLayerException e1) { - statusHandler - .error("Error purging orphaned grib model entries", e1); - } catch (EdexException e) { + } catch (DataAccessLayerException e) { + statusHandler.error("Error purging orphaned grib model entries", e); + rethrow = e; + } catch (EdexException e1) { statusHandler.error( - "Error sending message to purge grib model topic", e); + "Error sending message to purge grib model topic", e1); + rethrow = e1; } try { EDEXUtil.getMessageProducer().sendAsyncUri(REBUILD_CACHE_TOPIC, null); } catch (EdexException e) { - throw new PluginException( + statusHandler.error( "Error sending message to rebuild D2D Cache topic", e); + rethrow = e; + } + + if (rethrow != null) { + throw new PluginException( + "Error updating GribModelCache or D2DParmIDCache", rethrow); } } @@ -192,12 +201,13 @@ public class GribDao extends PluginDao { storageRecord = new FloatDataRecord("Data", gribRec.getDataURI(), (float[]) gribRec.getMessageData(), 2, sizes); - } else + } else { throw new Exception( "Cannot create data record, spatialData = " + gribRec.getSpatialObject() + " and messageData = " + gribRec.getMessageData()); + } } else if (gribRec.getMessageData() instanceof byte[]) { storageRecord = new ByteDataRecord("Data", gribRec.getDataURI(), (byte[]) gribRec.getMessageData()); @@ -411,16 +421,13 @@ public class GribDao extends PluginDao { public List replaceRecord(GribRecord pdo) throws PluginException { List exceptions = new ArrayList(); - IPersistable persistable = (IPersistable) pdo; + IPersistable persistable = pdo; persistable.setHdfFileId(EDEXUtil.getServerId()); // get the directory - String directory = HDF5_DIR + String directory = HDF5_DIR + File.separator + pdo.getPluginName() + File.separator - + pdo.getPluginName() - + File.separator - + pathProvider.getHDFPath(pdo.getPluginName(), - (IPersistable) pdo); + + pathProvider.getHDFPath(pdo.getPluginName(), pdo); File dataStoreFile = new File(directory + File.separator + pathProvider.getHDFFileName(pdo.getPluginName(), persistable)); @@ -445,26 +452,38 @@ public class GribDao extends PluginDao { } public int purgeModelData(final String modelName) { - return (Integer) txTemplate.execute(new TransactionCallback() { - @Override - public Object doInTransaction(TransactionStatus status) { - int rval = 0; - HibernateTemplate ht = getHibernateTemplate(); - Session sess = ht.getSessionFactory().getCurrentSession(); - Query modelIdQuery = sess - .createQuery("SELECT distinct id from GribModel where modelName = :modelName"); - modelIdQuery.setString("modelName", modelName); - List mIds = (List) modelIdQuery.list(); - for (Integer mId : mIds) { - Query query = sess - .createQuery("DELETE from GribRecord where modelInfo.id = :mId"); - query.setInteger("mId", mId); - rval += query.executeUpdate(); - } + Integer recordsDeleted = (Integer) txTemplate + .execute(new TransactionCallback() { + @SuppressWarnings("unchecked") + @Override + public Object doInTransaction(TransactionStatus status) { + int rval = 0; + HibernateTemplate ht = getHibernateTemplate(); + Session sess = ht.getSessionFactory() + .getCurrentSession(); + Query modelIdQuery = sess + .createQuery("SELECT distinct id from GribModel where modelName = :modelName"); + modelIdQuery.setString("modelName", modelName); + List mIds = modelIdQuery.list(); + for (Integer mId : mIds) { + Query query = sess + .createQuery("DELETE from GribRecord where modelInfo.id = :mId"); + query.setInteger("mId", mId); + rval += query.executeUpdate(); + } - return rval; - } - }); + return rval; + } + }); + + try { + updateCaches(); + } catch (PluginException e) { + statusHandler.handle(Priority.PROBLEM, + "Could not update grib cache.", e); + } + + return recordsDeleted; } public void purgeHdf5ModelData(final String modelName) diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/handler/DeleteAllModelDataHandler.java b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/handler/DeleteAllModelDataHandler.java new file mode 100644 index 0000000000..46af8ca494 --- /dev/null +++ b/edexOsgi/com.raytheon.edex.plugin.grib/src/com/raytheon/edex/plugin/grib/handler/DeleteAllModelDataHandler.java @@ -0,0 +1,59 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.edex.plugin.grib.handler; + +import com.raytheon.edex.plugin.grib.dao.GribModelDao; +import com.raytheon.uf.common.dataplugin.grib.request.DeleteAllModelDataRequest; +import com.raytheon.uf.common.serialization.comm.IRequestHandler; + +/** + * Request handler for DeleteAllModelDataRequest. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 25, 2012            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +public class DeleteAllModelDataHandler implements + IRequestHandler { + + /* + * (non-Javadoc) + * + * @see + * com.raytheon.uf.common.serialization.comm.IRequestHandler#handleRequest + * (com.raytheon.uf.common.serialization.comm.IServerRequest) + */ + @Override + public Integer handleRequest(DeleteAllModelDataRequest request) + throws Exception { + return new GribModelDao().deleteModelAndAssociatedData(request + .getModelName()); + } +} diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/common_static/base/purge/gribPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/common_static/base/purge/gribPurgeRules.xml index e84ad8cba4..665a5faeeb 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/common_static/base/purge/gribPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/common_static/base/purge/gribPurgeRules.xml @@ -1,1245 +1,722 @@ - - + + modelInfo.modelName - - - grib - default - + 2 - - - + - - grib - modelInfo.modelName=ETA - + ETA 2 - - - grib - modelInfo.modelName=RUC - + RUC 8 - - - grib - modelInfo.modelName=AVN - + AVN 2 - - - grib - modelInfo.modelName=LAPS - + LAPS 30 - - - grib - modelInfo.modelName=NGM - + NGM 2 - - - grib - modelInfo.modelName=MRF - + MRF 2 - - - grib - modelInfo.modelName=MSAS - + MSAS 24 - - - grib - modelInfo.modelName=GFS201 - + GFS201 2 - - - grib - modelInfo.modelName=mrfNH - + mrfNH 2 - - - grib - modelInfo.modelName=GFS213 - + GFS213 2 - - - grib - modelInfo.modelName=NGM213 - + NGM213 1 00-00:15:00 - - - grib - modelInfo.modelName=NGM202 - + NGM202 2 - - - grib - modelInfo.modelName=AVN211 - + AVN211 2 - - - grib - modelInfo.modelName=mesoEta212 - + mesoEta212 2 00-00:15:00 - - - grib - modelInfo.modelName=mesoEta215 - + mesoEta215 2 00-00:15:00 - - - grib - modelInfo.modelName=ENSEMBLE - + ENSEMBLE 2 - - grib - modelInfo.modelName=ENSEMBLE37 - + ENSEMBLE37 2 - - grib - modelInfo.modelName=ENSEMBLE38 - + ENSEMBLE38 2 - - grib - modelInfo.modelName=ENSEMBLE39 - + ENSEMBLE39 2 - - grib - modelInfo.modelName=ENSEMBLE40 - + ENSEMBLE40 2 - - grib - modelInfo.modelName=ENSEMBLE41 - + ENSEMBLE41 2 - - grib - modelInfo.modelName=ENSEMBLE42 - + ENSEMBLE42 2 - - grib - modelInfo.modelName=ENSEMBLE43 - + ENSEMBLE43 2 - - grib - modelInfo.modelName=ENSEMBLE44 - + ENSEMBLE44 2 - - - grib - modelInfo.modelName=ETA212 - + ETA212 1 00-00:15:00 - - - grib - modelInfo.modelName=MRF203 - + MRF203 3 - - - grib - modelInfo.modelName=AVN203 - + AVN203 3 - - - grib - modelInfo.modelName=MRF204 - + MRF204 3 - - - grib - modelInfo.modelName=MRF205 - + MRF205 3 - - - grib - modelInfo.modelName=NGM207 - + NGM207 3 - - - grib - modelInfo.modelName=NAM207 - + NAM207 3 - - - grib - modelInfo.modelName=ECMF-NorthernHemisphere - + ECMF-NorthernHemisphere 2 - - grib - modelInfo.modelName=ECMF1 - + ECMF1 2 - - grib - modelInfo.modelName=ECMF2 - + ECMF2 2 - - grib - modelInfo.modelName=ECMF3 - + ECMF3 2 - - grib - modelInfo.modelName=ECMF4 - + ECMF4 2 - - grib - modelInfo.modelName=ECMF5 - + ECMF5 2 - - grib - modelInfo.modelName=ECMF6 - + ECMF6 2 - - grib - modelInfo.modelName=ECMF7 - + ECMF7 2 - - grib - modelInfo.modelName=ECMF8 - + ECMF8 2 - - grib - modelInfo.modelName=ECMF9 - + ECMF9 2 - - grib - modelInfo.modelName=ECMF10 - + ECMF10 2 - - grib - modelInfo.modelName=ECMF11 - + ECMF11 2 - - grib - modelInfo.modelName=ECMF12 - + ECMF12 2 - - - grib - modelInfo.modelName=UKMET-NorthernHemisphere - + UKMET-NorthernHemisphere 2 - - grib - modelInfo.modelName=UKMET37 - + UKMET37 2 - - grib - modelInfo.modelName=UKMET38 - + UKMET38 2 - - grib - modelInfo.modelName=UKMET39 - + UKMET39 2 - - grib - modelInfo.modelName=UKMET40 - + UKMET40 2 - - grib - modelInfo.modelName=UKMET41 - + UKMET41 2 - - grib - modelInfo.modelName=UKMET42 - + UKMET42 2 - - grib - modelInfo.modelName=UKMET43 - + UKMET43 2 - - grib - modelInfo.modelName=UKMET44 - + UKMET44 2 - - - grib - modelInfo.modelName=AVN-NorthernHemisphere - + AVN-NorthernHemisphere 2 - - grib - modelInfo.modelName=AVN37 - + AVN37 2 - - grib - modelInfo.modelName=AVN38 - + AVN38 2 - - grib - modelInfo.modelName=AVN39 - + AVN39 2 - - grib - modelInfo.modelName=AVN40 - + AVN40 2 - - grib - modelInfo.modelName=AVN41 - + AVN41 2 - - grib - modelInfo.modelName=AVN42 - + AVN42 2 - - grib - modelInfo.modelName=AVN43 - + AVN43 2 - - grib - modelInfo.modelName=AVN44 - + AVN44 2 - - - grib - modelInfo.modelName=GWW233 - + GWW233 1 00-00:15:00 - - - grib - modelInfo.modelName=RFCqpf - + RFCqpf 5 - - - grib - modelInfo.modelName=RUC236 - + RUC236 8 - - - grib - modelInfo.modelName=AVN225 - + AVN225 3 - - - grib - modelInfo.modelName=WNAWAVE238 - + WNAWAVE238 1 00-00:15:00 - - - grib - modelInfo.modelName=mesoEta216 - + mesoEta216 1 00-00:15:00 - - - grib - modelInfo.modelName=mesoEta217 - + mesoEta217 1 00-00:15:00 - - - grib - modelInfo.modelName=ETA218 - + ETA218 1 00-00:15:00 - - - grib - modelInfo.modelName=ETA242 - + ETA242 1 00-00:15:00 - - - grib - modelInfo.modelName=HPCqpf - + HPCqpf 5 - - - grib - modelInfo.modelName=ENPWAVE253 - + ENPWAVE253 1 00-00:15:00 - - - grib - modelInfo.modelName=HPCdelta - + HPCdelta 4 - - - grib - modelInfo.modelName=HurWind226 - + HurWind226 4 - - - grib - modelInfo.modelName=CPCoutlook211 - + CPCoutlook211 14 - - - grib - modelInfo.modelName=RTGSSTHR - + RTGSSTHR 2 - - - grib - modelInfo.modelName=NICICE - + NICICE 2 - - - grib - modelInfo.modelName=DGEX185 - + DGEX185 2 00-00:15:00 - - - grib - modelInfo.modelName=HPCGuide - + HPCGuide 2 00-00:15:00 - - - grib - modelInfo.modelName=GFSGuide - + GFSGuide 8 00-00:15:00 - - - grib - modelInfo.modelName=GFS212 - + GFS212 1 00-00:15:00 - - - grib - modelInfo.modelName=GFS160 - + GFS160 1 00-00:15:00 - - - grib - modelInfo.modelName=GFS254 - + GFS254 1 00-00:15:00 - - - grib - modelInfo.modelName=GFS161 - + GFS161 1 00-00:15:00 - - - grib - modelInfo.modelName=MPE-Local - + MPE-Local 72 - - - grib - modelInfo.modelName=TPCWindProb - + TPCWindProb 8 00-00:15:00 - - - grib - modelInfo.modelName=MOSGuide - + MOSGuide 2 00-00:15:00 - - - grib - modelInfo.modelName=QPE - + QPE 72 - - grib - modelInfo.modelName=QPE-TUA - + QPE-TUA 72 - - grib - modelInfo.modelName=QPE-ACR - + QPE-ACR 72 - - grib - modelInfo.modelName=QPE-STR - + QPE-STR 72 - - grib - modelInfo.modelName=QPE-RSA - + QPE-RSA 72 - - grib - modelInfo.modelName=QPE-ORN - + QPE-ORN 72 - - grib - modelInfo.modelName=QPE-RHA - + QPE-RHA 72 - - grib - modelInfo.modelName=QPE-KRF - + QPE-KRF 72 - - grib - modelInfo.modelName=QPE-MSR - + QPE-MSR 72 - - grib - modelInfo.modelName=QPE-TAR - + QPE-TAR 72 - - grib - modelInfo.modelName=QPE-PTR - + QPE-PTR 72 - - grib - modelInfo.modelName=QPE-TIR - + QPE-TIR 72 - - grib - modelInfo.modelName=QPE-ALR - + QPE-ALR 72 - - grib - modelInfo.modelName=QPE-FWR - + QPE-FWR 72 - - - - grib - modelInfo.modelName=OPCWave180 - + OPCWave180 8 00-00:15:00 - - - grib - modelInfo.modelName=OPCWave181 - + OPCWave181 8 00-00:15:00 - - - grib - modelInfo.modelName=OPCWave182 - + OPCWave182 8 00-00:15:00 - - - grib - modelInfo.modelName=RTMA - + RTMA 24 00-00:15:00 - - - grib - modelInfo.modelName=SREF212 - + SREF212 2 00-00:15:00 - - - grib - modelInfo.modelName=RTGSST - + RTGSST 2 00-00:15:00 - - - grib - modelInfo.modelName=GFSLAMPTstorm - + GFSLAMPTstorm 24 00-00:15:00 - - - grib - modelInfo.modelName=ECMWF-HiRes - + ECMWF-HiRes 2 00-00:15:00 - - - grib - modelInfo.modelName=HPCqpfNDFD - + HPCqpfNDFD 42 00-00:15:00 - - - grib - modelInfo.modelName=NamDNG5 - + NamDNG5 2 00-00:15:00 - - - grib - modelInfo.modelName=TPCSurgeProb - + TPCSurgeProb 3 00-00:15:00 - - - grib - modelInfo.modelName=HPE - + HPE 00-12:00:00 00-00:15:00 - - - grib - modelInfo.modelName=BHPE - + BHPE 00-12:00:00 00-00:15:00 - - - grib - modelInfo.modelName=GlobalWave - + GlobalWave 1 00-00:15:00 - - - grib - modelInfo.modelName=AKWave10 - + AKWave10 1 00-00:15:00 - - - grib - modelInfo.modelName=AKWave4 - + AKWave4 1 00-00:15:00 - - - grib - modelInfo.modelName=EPWave10 - + EPWave10 1 00-00:15:00 - - - grib - modelInfo.modelName=WCWave10 - + WCWave10 1 00-00:15:00 - - - grib - modelInfo.modelName=WCWave4 - + WCWave4 1 00-00:15:00 - - - grib - modelInfo.modelName=WNAWave10 - + WNAWave10 1 00-00:15:00 - - - grib - modelInfo.modelName=WNAWave4 - + WNAWave4 1 00-00:15:00 - - - grib - modelInfo.modelName=MOSGuide-AK - + MOSGuide-AK 2 00-00:15:00 - - - grib - modelInfo.modelName=HI_RTMA - + HI_RTMA 24 - - - grib - modelInfo.modelName=HiRes-ARW-East - + HiRes-ARW-East 2 00-00:15:00 - - - grib - modelInfo.modelName=HiRes-ARW-West - + HiRes-ARW-West 1 00-00:15:00 - - - grib - modelInfo.modelName=HiRes-ARW-AK - + HiRes-ARW-AK 1 00-00:15:00 - - - grib - modelInfo.modelName=HiRes-ARW-HI - + HiRes-ARW-HI 2 00-00:15:00 - - - grib - modelInfo.modelName=HiRes-ARW-SJU - + HiRes-ARW-SJU 1 00-00:15:00 - - - - - grib - modelInfo.modelName=HiRes-NMM-East - + HiRes-NMM-East 2 00-00:15:00 - - - grib - modelInfo.modelName=HiRes-NMM-West - + HiRes-NMM-West 1 00-00:15:00 - - - grib - modelInfo.modelName=HiRes-NMM-AK - + HiRes-NMM-AK 1 00-00:15:00 - - - grib - modelInfo.modelName=HiRes-NMM-HI - + HiRes-NMM-HI 2 00-00:15:00 - - - grib - modelInfo.modelName=HiRes-NMM-SJU - + HiRes-NMM-SJU 1 00-00:15:00 - - - grib - modelInfo.modelName=GRLKwave - + GRLKwave 1 00-00:15:00 - - - grib - modelInfo.modelName=CPCoutlook-Short - + CPCoutlook-Short 5 00-00:15:00 - - - grib - modelInfo.modelName=CPCoutlook-Medium - + CPCoutlook-Medium 7 00-00:15:00 - - - grib - modelInfo.modelName=CPCoutlook-Short-AK - + CPCoutlook-Short-AK 5 00-00:15:00 - - - grib - modelInfo.modelName=CPCoutlook-Medium-AK - + CPCoutlook-Medium-AK 7 00-00:15:00 - - - grib - modelInfo.modelName=SPCGuide - + SPCGuide 5 00-00:15:00 diff --git a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/parameterInfo/gfs212.xml b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/parameterInfo/gfs212.xml index c5e92fbc7e..3b35a6b7ea 100644 --- a/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/parameterInfo/gfs212.xml +++ b/edexOsgi/com.raytheon.edex.plugin.grib/utility/edex_static/base/grib/parameterInfo/gfs212.xml @@ -447,7 +447,7 @@ 0 MB 0>500 - MB0500 + SFC diff --git a/edexOsgi/com.raytheon.edex.plugin.ldadhydro/utility/common_static/base/purge/ldadhydroPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.ldadhydro/utility/common_static/base/purge/ldadhydroPurgeRules.xml index 3070b5ecc9..1182b36c71 100644 --- a/edexOsgi/com.raytheon.edex.plugin.ldadhydro/utility/common_static/base/purge/ldadhydroPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.ldadhydro/utility/common_static/base/purge/ldadhydroPurgeRules.xml @@ -1,12 +1,8 @@ - - - - ldadhydro - default - + + 24 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.ldadmanual/utility/common_static/base/purge/ldadmanualPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.ldadmanual/utility/common_static/base/purge/ldadmanualPurgeRules.xml index 8b591402fc..1182b36c71 100644 --- a/edexOsgi/com.raytheon.edex.plugin.ldadmanual/utility/common_static/base/purge/ldadmanualPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.ldadmanual/utility/common_static/base/purge/ldadmanualPurgeRules.xml @@ -1,12 +1,8 @@ - - - - ldadmanual - default - + + 24 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.ldadprofiler/utility/common_static/base/purge/ldadprofilerPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.ldadprofiler/utility/common_static/base/purge/ldadprofilerPurgeRules.xml index 5171ef591e..1182b36c71 100644 --- a/edexOsgi/com.raytheon.edex.plugin.ldadprofiler/utility/common_static/base/purge/ldadprofilerPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.ldadprofiler/utility/common_static/base/purge/ldadprofilerPurgeRules.xml @@ -1,12 +1,8 @@ - - - - ldadprofiler - default - + + 24 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.obs/utility/common_static/base/purge/obsPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.obs/utility/common_static/base/purge/obsPurgeRules.xml index 5c5f4bd096..6bab5e0bbf 100644 --- a/edexOsgi/com.raytheon.edex.plugin.obs/utility/common_static/base/purge/obsPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.obs/utility/common_static/base/purge/obsPurgeRules.xml @@ -1,40 +1,23 @@ - - - - obs - - + + 34 =00-01:00:00 00-01:00:00 - - - - - obs - - + + 38 =00-03:00:00 00-01:00:00 - - - - obs - - + + 42 =00-06:00:00 00-01:00:00 - - - - obs - - + + 50 =01-00:00:00 +00-12:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.pirep/utility/common_static/base/purge/pirepPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.pirep/utility/common_static/base/purge/pirepPurgeRules.xml index cc25728ef9..d8401ec954 100644 --- a/edexOsgi/com.raytheon.edex.plugin.pirep/utility/common_static/base/purge/pirepPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.pirep/utility/common_static/base/purge/pirepPurgeRules.xml @@ -1,10 +1,6 @@ - - - - pirep - default - + + 01-00:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.poessounding/utility/common_static/base/purge/poessoundingPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.poessounding/utility/common_static/base/purge/poessoundingPurgeRules.xml index c8a9d9c22e..c2cb1258f6 100644 --- a/edexOsgi/com.raytheon.edex.plugin.poessounding/utility/common_static/base/purge/poessoundingPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.poessounding/utility/common_static/base/purge/poessoundingPurgeRules.xml @@ -1,12 +1,8 @@ - - - - poessounding - default - + + 12 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.profiler/utility/common_static/base/purge/profilerPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.profiler/utility/common_static/base/purge/profilerPurgeRules.xml index 8947ab80c0..ef0c05b8b0 100644 --- a/edexOsgi/com.raytheon.edex.plugin.profiler/utility/common_static/base/purge/profilerPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.profiler/utility/common_static/base/purge/profilerPurgeRules.xml @@ -1,12 +1,8 @@ - - - - profiler - default - + + 33 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/RadarDecoder.java b/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/RadarDecoder.java index 047e27df30..55dcefe7b6 100644 --- a/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/RadarDecoder.java +++ b/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/RadarDecoder.java @@ -510,7 +510,11 @@ public class RadarDecoder extends AbstractDecoder { record.setPluginName("radar"); record.constructDataURI(); record.setInsertTime(TimeTools.getSystemCalendar()); - record.setOverwriteAllowed(true); + if (record.getProductCode() == 2) { + record.setOverwriteAllowed(true); + } else { + record.setOverwriteAllowed(false); + } } /** diff --git a/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/dao/RadarDao.java b/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/dao/RadarDao.java index 682fa4701b..3a0e30529d 100644 --- a/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/dao/RadarDao.java +++ b/edexOsgi/com.raytheon.edex.plugin.radar/src/com/raytheon/edex/plugin/radar/dao/RadarDao.java @@ -64,238 +64,249 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery; public class RadarDao extends PluginDao { - /** - * Creates a new radar dao - * - * @param pluginName - * "radar" - * @throws PluginException - * If the dao cannot be initialized - */ - public RadarDao(String pluginName) throws PluginException { - super(pluginName); - } + /** + * Creates a new radar dao + * + * @param pluginName + * "radar" + * @throws PluginException + * If the dao cannot be initialized + */ + public RadarDao(String pluginName) throws PluginException { + super(pluginName); + } - @Override - protected IDataStore populateDataStore(IDataStore dataStore, - IPersistable obj) throws Exception { - RadarRecord radarRec = (RadarRecord) obj; - StorageProperties sp = null; - String compression = PluginRegistry.getInstance() - .getRegisteredObject(pluginName).getCompression(); - if (compression != null) { - sp = new StorageProperties(); - sp.setCompression(StorageProperties.Compression - .valueOf(compression)); - } - if (radarRec.getRawData() != null) { - IDataRecord rec = new ByteDataRecord(RadarStoredData.RAW_DATA_ID, - radarRec.getDataURI(), radarRec.getRawData(), 2, - new long[] { radarRec.getNumRadials(), - radarRec.getNumBins() }); - rec.setCorrelationObject(radarRec); - dataStore.addDataRecord(rec, sp); - } + @Override + protected IDataStore populateDataStore(IDataStore dataStore, + IPersistable obj) throws Exception { + RadarRecord radarRec = (RadarRecord) obj; + StorageProperties sp = null; + String compression = PluginRegistry.getInstance() + .getRegisteredObject(pluginName).getCompression(); + if (compression != null) { + sp = new StorageProperties(); + sp.setCompression(StorageProperties.Compression + .valueOf(compression)); + } + if (radarRec.getRawData() != null) { + IDataRecord rec = new ByteDataRecord(RadarStoredData.RAW_DATA_ID, + radarRec.getDataURI(), radarRec.getRawData(), 2, + new long[] { radarRec.getNumRadials(), + radarRec.getNumBins() }); + rec.setCorrelationObject(radarRec); + dataStore.addDataRecord(rec, sp); + } - if (radarRec.getRawShortData() != null) { - IDataRecord rec = new ShortDataRecord( - RadarStoredData.SHORT_DATA_ID, radarRec.getDataURI(), - radarRec.getRawShortData(), 2, new long[] { - radarRec.getNumRadials(), radarRec.getNumBins() }); - rec.setCorrelationObject(radarRec); - dataStore.addDataRecord(rec, sp); - } + if (radarRec.getRawShortData() != null) { + IDataRecord rec = new ShortDataRecord( + RadarStoredData.SHORT_DATA_ID, radarRec.getDataURI(), + radarRec.getRawShortData(), 2, new long[] { + radarRec.getNumRadials(), radarRec.getNumBins() }); + rec.setCorrelationObject(radarRec); + dataStore.addDataRecord(rec, sp); + } - if (radarRec.getAngleData() != null) { - IDataRecord rec = new FloatDataRecord( - RadarStoredData.ANGLE_DATA_ID, radarRec.getDataURI(), - radarRec.getAngleData(), 1, - new long[] { radarRec.getNumRadials() }); - rec.setCorrelationObject(radarRec); - dataStore.addDataRecord(rec, sp); - } + if (radarRec.getAngleData() != null) { + IDataRecord rec = new FloatDataRecord( + RadarStoredData.ANGLE_DATA_ID, radarRec.getDataURI(), + radarRec.getAngleData(), 1, + new long[] { radarRec.getNumRadials() }); + rec.setCorrelationObject(radarRec); + dataStore.addDataRecord(rec, sp); + } - if (radarRec.getThresholds() != null && radarRec.getProductCode() != 2) { - IDataRecord rec = new ShortDataRecord( - RadarStoredData.THRESHOLDS_ID, radarRec.getDataURI(), - radarRec.getThresholds(), 1, new long[] { 16 }); - rec.setCorrelationObject(radarRec); - dataStore.addDataRecord(rec, sp); - } + if (radarRec.getThresholds() != null && radarRec.getProductCode() != 2) { + IDataRecord rec = new ShortDataRecord( + RadarStoredData.THRESHOLDS_ID, radarRec.getDataURI(), + radarRec.getThresholds(), 1, new long[] { 16 }); + rec.setCorrelationObject(radarRec); + dataStore.addDataRecord(rec, sp); + } - if (radarRec.getSymbologyBlock() != null) { - byte[] data = DynamicSerializationManager.getManager( - SerializationType.Thrift).serialize( - radarRec.getSymbologyBlock()); - ByteDataRecord bdr = new ByteDataRecord( - RadarStoredData.SYM_BLOCK_ID, radarRec.getDataURI(), data); - dataStore.addDataRecord(bdr, sp); - } + if (radarRec.getSymbologyBlock() != null) { + byte[] data = DynamicSerializationManager.getManager( + SerializationType.Thrift).serialize( + radarRec.getSymbologyBlock()); + ByteDataRecord bdr = new ByteDataRecord( + RadarStoredData.SYM_BLOCK_ID, radarRec.getDataURI(), data); + bdr.setCorrelationObject(radarRec); + dataStore.addDataRecord(bdr, sp); + } - if (radarRec.getSymbologyData() != null) { - byte[] data = DynamicSerializationManager.getManager( - SerializationType.Thrift).serialize( - radarRec.getSymbologyData()); - ByteDataRecord bdr = new ByteDataRecord( - RadarStoredData.SYM_DATA_ID, radarRec.getDataURI(), data); - dataStore.addDataRecord(bdr, sp); - } + if (radarRec.getSymbologyData() != null) { + byte[] data = DynamicSerializationManager.getManager( + SerializationType.Thrift).serialize( + radarRec.getSymbologyData()); + ByteDataRecord bdr = new ByteDataRecord( + RadarStoredData.SYM_DATA_ID, radarRec.getDataURI(), data); + bdr.setCorrelationObject(radarRec); + dataStore.addDataRecord(bdr, sp); + } - if (radarRec.getGraphicBlock() != null) { - byte[] data = DynamicSerializationManager.getManager( - SerializationType.Thrift).serialize( - radarRec.getGraphicBlock()); - ByteDataRecord bdr = new ByteDataRecord( - RadarStoredData.GRAPHIC_BLOCK_ID, radarRec.getDataURI(), - data); - dataStore.addDataRecord(bdr, sp); - } + if (radarRec.getGraphicBlock() != null) { + byte[] data = DynamicSerializationManager.getManager( + SerializationType.Thrift).serialize( + radarRec.getGraphicBlock()); + ByteDataRecord bdr = new ByteDataRecord( + RadarStoredData.GRAPHIC_BLOCK_ID, radarRec.getDataURI(), + data); + bdr.setCorrelationObject(radarRec); + dataStore.addDataRecord(bdr, sp); + } - if (radarRec.getMapProductVals() != null) { - byte[] data = DynamicSerializationManager.getManager( - SerializationType.Thrift).serialize( - radarRec.getMapProductVals()); - ByteDataRecord bdr = new ByteDataRecord( - RadarStoredData.PRODUCT_VALS_ID, radarRec.getDataURI(), - data); - dataStore.addDataRecord(bdr, sp); - } + if (radarRec.getMapProductVals() != null) { + byte[] data = DynamicSerializationManager.getManager( + SerializationType.Thrift).serialize( + radarRec.getMapProductVals()); + ByteDataRecord bdr = new ByteDataRecord( + RadarStoredData.PRODUCT_VALS_ID, radarRec.getDataURI(), + data); + bdr.setCorrelationObject(radarRec); + dataStore.addDataRecord(bdr, sp); + } - if (radarRec.getAlphanumericValues() != null) { - byte[] data = DynamicSerializationManager.getManager( - SerializationType.Thrift).serialize( - radarRec.getAlphanumericValues()); - ByteDataRecord bdr = new ByteDataRecord( - RadarStoredData.ALPHANUMERIC_ID, radarRec.getDataURI(), - data); - dataStore.addDataRecord(bdr, sp); - } + if (radarRec.getAlphanumericValues() != null) { + byte[] data = DynamicSerializationManager.getManager( + SerializationType.Thrift).serialize( + radarRec.getAlphanumericValues()); + ByteDataRecord bdr = new ByteDataRecord( + RadarStoredData.ALPHANUMERIC_ID, radarRec.getDataURI(), + data); + bdr.setCorrelationObject(radarRec); + dataStore.addDataRecord(bdr, sp); + } - if (radarRec.getTabularBlock() != null) { - byte[] data = DynamicSerializationManager.getManager( - SerializationType.Thrift).serialize( - radarRec.getTabularBlock()); - ByteDataRecord bdr = new ByteDataRecord(RadarStoredData.TABULAR_ID, - radarRec.getDataURI(), data); - dataStore.addDataRecord(bdr, sp); - } + if (radarRec.getTabularBlock() != null) { + byte[] data = DynamicSerializationManager.getManager( + SerializationType.Thrift).serialize( + radarRec.getTabularBlock()); + ByteDataRecord bdr = new ByteDataRecord(RadarStoredData.TABULAR_ID, + radarRec.getDataURI(), data); + bdr.setCorrelationObject(radarRec); + dataStore.addDataRecord(bdr, sp); + } - if (radarRec.getProductDependentValues() != null) { - IDataRecord rec = new ShortDataRecord( - RadarStoredData.DEPENDENT_VALS_ID, radarRec.getDataURI(), - radarRec.getProductDependentValues(), 1, - new long[] { radarRec.getProductDependentValues().length }); - rec.setCorrelationObject(radarRec); - dataStore.addDataRecord(rec, sp); - } + if (radarRec.getProductDependentValues() != null) { + IDataRecord rec = new ShortDataRecord( + RadarStoredData.DEPENDENT_VALS_ID, radarRec.getDataURI(), + radarRec.getProductDependentValues(), 1, + new long[] { radarRec.getProductDependentValues().length }); + rec.setCorrelationObject(radarRec); + dataStore.addDataRecord(rec, sp); + } - if (radarRec.getMapRecordVals() != null) { - byte[] data = DynamicSerializationManager.getManager( - SerializationType.Thrift).serialize( - radarRec.getMapRecordVals()); - ByteDataRecord bdr = new ByteDataRecord( - RadarStoredData.RECORD_VALS_ID, radarRec.getDataURI(), data); - dataStore.addDataRecord(bdr, sp); - } + if (radarRec.getMapRecordVals() != null) { + byte[] data = DynamicSerializationManager.getManager( + SerializationType.Thrift).serialize( + radarRec.getMapRecordVals()); + ByteDataRecord bdr = new ByteDataRecord( + RadarStoredData.RECORD_VALS_ID, radarRec.getDataURI(), data); + bdr.setCorrelationObject(radarRec); + dataStore.addDataRecord(bdr, sp); + } - if (radarRec.getStormIDs() != null) { - byte[] data = DynamicSerializationManager.getManager( - SerializationType.Thrift).serialize(radarRec.getStormIDs()); - ByteDataRecord bdr = new ByteDataRecord( - RadarStoredData.STORM_IDS_ID, radarRec.getDataURI(), data); - dataStore.addDataRecord(bdr, sp); - } + if (radarRec.getStormIDs() != null) { + byte[] data = DynamicSerializationManager.getManager( + SerializationType.Thrift).serialize(radarRec.getStormIDs()); + ByteDataRecord bdr = new ByteDataRecord( + RadarStoredData.STORM_IDS_ID, radarRec.getDataURI(), data); + bdr.setCorrelationObject(radarRec); + dataStore.addDataRecord(bdr, sp); + } - if (radarRec.getGsmMessage() != null) { - byte[] data = DynamicSerializationManager.getManager( - SerializationType.Thrift).serialize( - radarRec.getGsmMessage()); - ByteDataRecord bdr = new ByteDataRecord(RadarStoredData.GSM_ID, - radarRec.getDataURI(), data); - dataStore.addDataRecord(bdr, sp); - } - if (radarRec.getAlertMessage() != null) { - byte[] data = DynamicSerializationManager.getManager( - SerializationType.Thrift).serialize( - radarRec.getAlertMessage()); - ByteDataRecord bdr = new ByteDataRecord( - RadarStoredData.ALERT_MESSAGE_ID, radarRec.getDataURI(), - data); - dataStore.addDataRecord(bdr, sp); - } + if (radarRec.getGsmMessage() != null) { + byte[] data = DynamicSerializationManager.getManager( + SerializationType.Thrift).serialize( + radarRec.getGsmMessage()); + ByteDataRecord bdr = new ByteDataRecord(RadarStoredData.GSM_ID, + radarRec.getDataURI(), data); + bdr.setCorrelationObject(radarRec); + dataStore.addDataRecord(bdr, sp); + } + if (radarRec.getAlertMessage() != null) { + byte[] data = DynamicSerializationManager.getManager( + SerializationType.Thrift).serialize( + radarRec.getAlertMessage()); + ByteDataRecord bdr = new ByteDataRecord( + RadarStoredData.ALERT_MESSAGE_ID, radarRec.getDataURI(), + data); + bdr.setCorrelationObject(radarRec); + dataStore.addDataRecord(bdr, sp); + } - if (radarRec.getAapMessage() != null) { - byte[] data = DynamicSerializationManager.getManager( - SerializationType.Thrift).serialize( - radarRec.getAapMessage()); - ByteDataRecord bdr = new ByteDataRecord(RadarStoredData.AAP_ID, - radarRec.getDataURI(), data); - dataStore.addDataRecord(bdr, sp); - } + if (radarRec.getAapMessage() != null) { + byte[] data = DynamicSerializationManager.getManager( + SerializationType.Thrift).serialize( + radarRec.getAapMessage()); + ByteDataRecord bdr = new ByteDataRecord(RadarStoredData.AAP_ID, + radarRec.getDataURI(), data); + bdr.setCorrelationObject(radarRec); + dataStore.addDataRecord(bdr, sp); + } - return dataStore; - } + return dataStore; + } - @Override - public List getHDF5Data(List objects, - int tileSet) throws PluginException { - List retVal = new ArrayList(); + @Override + public List getHDF5Data(List objects, + int tileSet) throws PluginException { + List retVal = new ArrayList(); - for (PluginDataObject obj : objects) { - IDataRecord[] record = null; + for (PluginDataObject obj : objects) { + IDataRecord[] record = null; - if (obj instanceof IPersistable) { - /* connect to the data store and retrieve the data */ - try { - record = getDataStore((IPersistable) obj).retrieve( - obj.getDataURI()); - } catch (Exception e) { - throw new PluginException( - "Error retrieving radar HDF5 data", e); - } - retVal.add(record); - } - } + if (obj instanceof IPersistable) { + /* connect to the data store and retrieve the data */ + try { + record = getDataStore((IPersistable) obj).retrieve( + obj.getDataURI()); + } catch (Exception e) { + throw new PluginException( + "Error retrieving radar HDF5 data", e); + } + retVal.add(record); + } + } - return retVal; - } + return retVal; + } - @Override - public PluginDataObject[] getFullRecord(DatabaseQuery query, int tile) - throws PluginException { - PluginDataObject[] queryResults = getMetadata(query); - for (PluginDataObject obj : queryResults) { - RadarRecord record = (RadarRecord) obj; - record.setPluginName(pluginName); - IDataRecord[] hdf5Data = getHDF5Data(record, tile); - record.setMessageData(hdf5Data[0].getDataObject()); - record.setAngleData((float[]) hdf5Data[1].getDataObject()); - record.setThresholds((short[]) hdf5Data[2].getDataObject()); - record.setProductDependentValues((short[]) hdf5Data[8] - .getDataObject()); + @Override + public PluginDataObject[] getFullRecord(DatabaseQuery query, int tile) + throws PluginException { + PluginDataObject[] queryResults = getMetadata(query); + for (PluginDataObject obj : queryResults) { + RadarRecord record = (RadarRecord) obj; + record.setPluginName(pluginName); + IDataRecord[] hdf5Data = getHDF5Data(record, tile); + record.setMessageData(hdf5Data[0].getDataObject()); + record.setAngleData((float[]) hdf5Data[1].getDataObject()); + record.setThresholds((short[]) hdf5Data[2].getDataObject()); + record.setProductDependentValues((short[]) hdf5Data[8] + .getDataObject()); - record.setProductVals((HashMap>>) hdf5Data[5] - .getDataObject()); - record.setMapRecordVals((HashMap>) hdf5Data[6]); - record.setGsmMessage((GSMMessage) hdf5Data[7].getDataObject()); - try { - record.setSymbologyBlock((SymbologyBlock) SerializationUtil - .transformFromThrift((byte[]) hdf5Data[3] - .getDataObject())); - record.setGraphicBlock((GraphicBlock) SerializationUtil - .transformFromThrift((byte[]) hdf5Data[4] - .getDataObject())); + record.setProductVals((HashMap>>) hdf5Data[5] + .getDataObject()); + record.setMapRecordVals((HashMap>) hdf5Data[6]); + record.setGsmMessage((GSMMessage) hdf5Data[7].getDataObject()); + try { + record.setSymbologyBlock((SymbologyBlock) SerializationUtil + .transformFromThrift((byte[]) hdf5Data[3] + .getDataObject())); + record.setGraphicBlock((GraphicBlock) SerializationUtil + .transformFromThrift((byte[]) hdf5Data[4] + .getDataObject())); - } catch (SerializationException e) { - throw new PluginException( - "Error deserializing symbology block", e); - } - } - return queryResults; - } + } catch (SerializationException e) { + throw new PluginException( + "Error deserializing symbology block", e); + } + } + return queryResults; + } - public void populateData(RadarRecord record) throws Exception { - RadarDataRetriever.populateRadarRecord(getDataStore(record), record); - } + public void populateData(RadarRecord record) throws Exception { + RadarDataRetriever.populateRadarRecord(getDataStore(record), record); + } } diff --git a/edexOsgi/com.raytheon.edex.plugin.radar/utility/common_static/base/purge/radarPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.radar/utility/common_static/base/purge/radarPurgeRules.xml index d41fc244f9..d8401ec954 100644 --- a/edexOsgi/com.raytheon.edex.plugin.radar/utility/common_static/base/purge/radarPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.radar/utility/common_static/base/purge/radarPurgeRules.xml @@ -1,10 +1,6 @@ - - - - radar - default - + + 01-00:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.recco/utility/common_static/base/purge/reccoPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.recco/utility/common_static/base/purge/reccoPurgeRules.xml index 4e645b3a71..40446eac37 100644 --- a/edexOsgi/com.raytheon.edex.plugin.recco/utility/common_static/base/purge/reccoPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.recco/utility/common_static/base/purge/reccoPurgeRules.xml @@ -1,12 +1,8 @@ - - - - recco - default - + + 36 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.edex.plugin.redbook/utility/common_static/base/purge/redbookPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.redbook/utility/common_static/base/purge/redbookPurgeRules.xml index 5df0ce6846..269533dddc 100644 --- a/edexOsgi/com.raytheon.edex.plugin.redbook/utility/common_static/base/purge/redbookPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.redbook/utility/common_static/base/purge/redbookPurgeRules.xml @@ -1,1648 +1,943 @@ - - - - redbook - default - + + wmoTTAAii + 2 - + - - redbook - wmoTTAAii=PAWO82 - + PAWO82 48 - - redbook - wmoTTAAii=PAWO83 - + PAWO83 48 - - redbook - wmoTTAAii=PAW883 - + PAW883 2 - - redbook - wmoTTAAii=PDKI59 - + PDKI59 2 - - redbook - wmoTTAAii=PEI745 - + PEI745 4 - - redbook - wmoTTAAii=PEIC43 - + PEIC43 4 - - redbook - wmoTTAAii=PEIC61 - + PEIC61 2 - - redbook - wmoTTAAii=PEID44 - + PEID44 4 - - redbook - wmoTTAAii=PEIE41 - + PEIE41 2 - - redbook - wmoTTAAii=PEIE62 - + PEIE62 2 - - redbook - wmoTTAAii=PEIG63 - + PEIG63 2 - - redbook - wmoTTAAii=PEII42 - + PEII42 2 - - redbook - wmoTTAAii=PEII64 - + PEII64 2 - - redbook - wmoTTAAii=PEIO46 - + PEIO46 2 - - redbook - wmoTTAAii=PEWA31 - + PEWA31 14 - - redbook - wmoTTAAii=PEWA32 - + PEWA32 2 - - redbook - wmoTTAAii=PEWA33 - + PEWA33 2 - - redbook - wmoTTAAii=PEWA34 - + PEWA34 2 - - redbook - wmoTTAAii=PGIC42 - + PGIC42 4 - - redbook - wmoTTAAii=PGIE43 - + PGIE43 4 - - redbook - wmoTTAAii=PGWA31 - + PGWA31 24 - - redbook - wmoTTAAii=PGWA32 - + PGWA32 24 - - redbook - wmoTTAAii=PGWA39 - + PGWA39 24 - - redbook - wmoTTAAii=PJMB44 - + PJMB44 4 - - redbook - wmoTTAAii=PJMB45 - + PJMB45 4 - - redbook - wmoTTAAii=PGWE46 - + PGWE46 4 - - redbook - wmoTTAAii=PGWI47 - + PGWI47 4 - - redbook - wmoTTAAii=PHZO50 - + PHZO50 2 - - redbook - wmoTTAAii=PLQI51 - + PLQI51 2 - - redbook - wmoTTAAii=PNWA68 - + PNWA68 2 - - redbook - wmoTTAAii=POWA31 - + POWA31 2 - - redbook - wmoTTAAii=PPHK01 - + PPHK01 2 - - redbook - wmoTTAAii=PPHM01 - + PPHM01 2 - - redbook - wmoTTAAii=PPHO01 - + PPHO01 2 - - redbook - wmoTTAAii=PPIC01 - + PPIC01 4 - - redbook - wmoTTAAii=PPIE01 - + PPIE01 4 - - redbook - wmoTTAAii=PPIG01 - + PPIG01 4 - - redbook - wmoTTAAii=PPII01 - + PPII01 4 - - redbook - wmoTTAAii=PPAA89 - + PPAA89 8 - - redbook - wmoTTAAii=PPZO50 - + PPZO50 2 - - redbook - wmoTTAAii=PRWA51 - + PRWA51 2 - - redbook - wmoTTAAii=PTIC94 - + PTIC94 2 - - redbook - wmoTTAAii=PTIE94 - + PTIE94 2 - - redbook - wmoTTAAii=PTIO52 - + PTIO52 2 - - redbook - wmoTTAAii=PTIO53 - + PTIO53 2 - - redbook - wmoTTAAii=PTWA31 - + PTWA31 3 - - redbook - wmoTTAAii=PTWA32 - + PTWA32 3 - - redbook - wmoTTAAii=PTWA94 - + PTWA94 2 - - redbook - wmoTTAAii=PTWO33 - + PTWO33 3 - - redbook - wmoTTAAii=PTWO34 - + PTWO34 3 - - redbook - wmoTTAAii=PTWA93 - + PTWA93 2 - - redbook - wmoTTAAii=PXVA01 - + PXVA01 2 - - redbook - wmoTTAAii=PXWA50 - + PXWA50 2 - - redbook - wmoTTAAii=PYMA20 - + PYMA20 2 - - redbook - wmoTTAAii=PYMA25 - + PYMA25 2 - - redbook - wmoTTAAii=PYMA30 - + PYMA30 2 - - redbook - wmoTTAAii=PYMA50 - + PYMA50 2 - - redbook - wmoTTAAii=PYMA70 - + PYMA70 2 - - redbook - wmoTTAAii=PYMA85 - + PYMA85 2 - - redbook - wmoTTAAii=PYWA31 - + PYWA31 4 - - redbook - wmoTTAAii=PYWA32 - + PYWA32 4 - - redbook - wmoTTAAii=PYWK43 - + PYWK43 2 - - redbook - wmoTTAAii=PYWK62 - + PYWK62 2 - - redbook - wmoTTAAii=PYWM44 - + PYWM44 2 - - redbook - wmoTTAAii=PYWO45 - + PYWO45 2 - - redbook - wmoTTAAii=PZKY51 - + PZKY51 2 - - redbook - wmoTTAAii=PEIY47 - + PEIY47 2 - - redbook - wmoTTAAii=PTIY51 - + PTIY51 2 - - redbook - wmoTTAAii=PHBV50 - + PHBV50 2 - - redbook - wmoTTAAii=PEIB40 - + PEIB40 4 - - redbook - wmoTTAAii=PEIE40 - + PEIE40 4 - - redbook - wmoTTAAii=PEIF40 - + PEIF40 4 - - redbook - wmoTTAAii=PYAA98 - + PYAA98 8 - - redbook - wmoTTAAii=PHZM50 - + PHZM50 2 - - redbook - wmoTTAAii=PHZQ50 - + PHZQ50 2 - - redbook - wmoTTAAii=PPZM50 - + PPZM50 2 - - redbook - wmoTTAAii=PPKK01 - + PPKK01 2 - - redbook - wmoTTAAii=PPKM01 - + PPKM01 2 - - redbook - wmoTTAAii=PPKO01 - + PPKO01 2 - - redbook - wmoTTAAii=PPKQ01 - + PPKQ01 2 - - redbook - wmoTTAAii=PYBA98 - + PYBA98 4 - - redbook - wmoTTAAii=PPBA89 - + PPBA89 4 - - redbook - wmoTTAAii=PWIA98 - + PWIA98 8 - - redbook - wmoTTAAii=PWIE98 - + PWIE98 2 - - redbook - wmoTTAAii=PTNT98 - + PTNT98 2 - - redbook - wmoTTAAii=PWIA97 - + PWIA97 8 - - redbook - wmoTTAAii=PWIE97 - + PWIE97 2 - - redbook - wmoTTAAii=PMNV88 - + PMNV88 4 - - redbook - wmoTTAAii=PPZQ50 - + PPZQ50 2 - - redbook - wmoTTAAii=PEIY50 - + PEIY50 4 - - redbook - wmoTTAAii=PTIY98 - + PTIY98 4 - - redbook - wmoTTAAii=PYIY88 - + PYIY88 4 - - redbook - wmoTTAAii=PYIA88 - + PYIA88 2 - - redbook - wmoTTAAii=PEIK98 - + PEIK98 4 - - redbook - wmoTTAAii=PTAS90 - + PTAS90 2 - - redbook - wmoTTAAii=PTAS95 - + PTAS95 2 - - redbook - wmoTTAAii=PTAS00 - + PTAS00 2 - - redbook - wmoTTAAii=PEIY97 - + PEIY97 2 - - redbook - wmoTTAAii=PTIY97 - + PTIY97 2 - - redbook - wmoTTAAii=PYIY97 - + PYIY97 2 - - redbook - wmoTTAAii=PEIY96 - + PEIY96 2 - - redbook - wmoTTAAii=PTIY96 - + PTIY96 2 - - redbook - wmoTTAAii=PYIY96 - + PYIY96 2 - - redbook - wmoTTAAii=PTAT90 - + PTAT90 2 - - redbook - wmoTTAAii=PTAT95 - + PTAT95 2 - - redbook - wmoTTAAii=PTAT00 - + PTAT00 2 - - redbook - wmoTTAAii=PEBF98 - + PEBF98 4 - - redbook - wmoTTAAii=PEBG98 - + PEBG98 4 - - redbook - wmoTTAAii=PEBH98 - + PEBH98 4 - - redbook - wmoTTAAii=PEBI88 - + PEBI88 4 - - redbook - wmoTTAAii=PEBI98 - + PEBI98 4 - - redbook - wmoTTAAii=PEBJ88 - + PEBJ88 4 - - redbook - wmoTTAAii=PEBJ98 - + PEBJ98 4 - - redbook - wmoTTAAii=PEBK98 - + PEBK98 4 - - redbook - wmoTTAAii=PYNA98 - + PYNA98 4 - - redbook - wmoTTAAii=PWAA85 - + PWAA85 2 - - redbook - wmoTTAAii=PWAA20 - + PWAA20 2 - - redbook - wmoTTAAii=PWAA00 - + PWAA00 2 - - redbook - wmoTTAAii=PWAA65 - + PWAA65 2 - - redbook - wmoTTAAii=PWBA88 - + PWBA88 2 - - redbook - wmoTTAAii=PWDA00 - + PWDA00 2 - - redbook - wmoTTAAii=PWDA65 - + PWDA65 2 - - redbook - wmoTTAAii=PWEA88 - + PWEA88 2 - - redbook - wmoTTAAii=PWEC88 - + PWEC88 2 - - redbook - wmoTTAAii=PWEE88 - + PWEE88 2 - - redbook - wmoTTAAii=PWEG88 - + PWEG88 2 - - redbook - wmoTTAAii=PYAA89 - + PYAA89 4 - - redbook - wmoTTAAii=PJAA88 - + PJAA88 2 - - redbook - wmoTTAAii=PJAI88 - + PJAI88 2 - - redbook - wmoTTAAii=PPAE89 - + PPAE89 2 - - redbook - wmoTTAAii=PPAI89 - + PPAI89 2 - - redbook - wmoTTAAii=PPAM89 - + PPAM89 2 - - redbook - wmoTTAAii=PYBA89 - + PYBA89 4 - - redbook - wmoTTAAii=PJBA88 - + PJBA88 2 - - redbook - wmoTTAAii=PJBI88 - + PJBI88 2 - - redbook - wmoTTAAii=PPBE89 - + PPBE89 2 - - redbook - wmoTTAAii=PPBI89 - + PPBI89 2 - - redbook - wmoTTAAii=PPBM89 - + PPBM89 2 - - redbook - wmoTTAAii=PGNE88 - + PGNE88 2 - - redbook - wmoTTAAii=PGNE98 - + PGNE98 2 - - redbook - wmoTTAAii=PPTG98 - + PPTG98 2 - - redbook - wmoTTAAii=PPTR98 - + PPTR98 2 - - redbook - wmoTTAAii=PYWQ46 - + PYWQ46 2 - - redbook - wmoTTAAii=PYWS98 - + PYWS98 2 - - redbook - wmoTTAAii=PEIV98 - + PEIV98 2 - - redbook - wmoTTAAii=PEIW01 - + PEIW01 1 - - redbook - wmoTTAAii=PEIW02 - + PEIW02 1 - - redbook - wmoTTAAii=PEIW03 - + PEIW03 1 - - redbook - wmoTTAAii=PEIW04 - + PEIW04 1 - - redbook - wmoTTAAii=PEIW05 - + PEIW05 1 - - redbook - wmoTTAAii=PEIW06 - + PEIW06 1 - - redbook - wmoTTAAii=PEIW07 - + PEIW07 1 - - redbook - wmoTTAAii=PEIW08 - + PEIW08 1 - - redbook - wmoTTAAii=PEIW09 - + PEIW09 1 - - redbook - wmoTTAAii=PEIW10 - + PEIW10 1 - - redbook - wmoTTAAii=PEIW11 - + PEIW11 1 - - redbook - wmoTTAAii=PEIW12 - + PEIW12 1 - - redbook - wmoTTAAii=PEIW13 - + PEIW13 1 - - redbook - wmoTTAAii=PTIV98 - + PTIV98 2 - - redbook - wmoTTAAii=PTIW01 - + PTIW01 1 - - redbook - wmoTTAAii=PTIW02 - + PTIW02 1 - - redbook - wmoTTAAii=PTIW03 - + PTIW03 1 - - redbook - wmoTTAAii=PTIW04 - + PTIW04 1 - - redbook - wmoTTAAii=PTIW05 - + PTIW05 1 - - redbook - wmoTTAAii=PTIW06 - + PTIW06 1 - - redbook - wmoTTAAii=PTIW07 - + PTIW07 1 - - redbook - wmoTTAAii=PTIW08 - + PTIW08 1 - - redbook - wmoTTAAii=PTIW09 - + PTIW09 1 - - redbook - wmoTTAAii=PTIW10 - + PTIW10 1 - - redbook - wmoTTAAii=PTIW11 - + PTIW11 1 - - redbook - wmoTTAAii=PTIW12 - + PTIW12 1 - - redbook - wmoTTAAii=PTIW13 - + PTIW13 1 - - redbook - wmoTTAAii=PMWE98 - + PMWE98 2 - - redbook - wmoTTAAii=PMWI98 - + PMWI98 2 - - redbook - wmoTTAAii=PETT00 - + PETT00 2 - - redbook - wmoTTAAii=PTTU98 - + PTTU98 2 - - redbook - wmoTTAAii=PHTT50 - + PHTT50 2 - - redbook - wmoTTAAii=PHTT51 - + PHTT51 2 - - redbook - wmoTTAAii=PENE00 - + PENE00 4 - - redbook - wmoTTAAii=PWNE00 - + PWNE00 4 - - redbook - wmoTTAAii=PGNE00 - + PGNE00 4 - - redbook - wmoTTAAii=PGNI00 - + PGNI00 4 - - redbook - wmoTTAAii=PHNT50 - + PHNT50 2 - - redbook - wmoTTAAii=PTNK98 - + PTNK98 9 - - redbook - wmoTTAAii=PTNQ98 - + PTNQ98 9 - - redbook - wmoTTAAii=PTNR98 - + PTNR98 2 - - redbook - wmoTTAAii=PZNK00 - + PZNK00 4 - - redbook - wmoTTAAii=PGWK48 - + PGWK48 4 - - redbook - wmoTTAAii=PTNM98 - + PTNM98 9 - - redbook - wmoTTAAii=PTNO98 - + PTNO98 9 - - redbook - wmoTTAAii=PTNS98 - + PTNS98 9 - - redbook - wmoTTAAii=PENJ88 - + PENJ88 4 - - redbook - wmoTTAAii=PGNA00 - + PGNA00 100 - - redbook - wmoTTAAii=PSBB04 - + PSBB04 4 - - redbook - wmoTTAAii=PSBB08 - + PSBB08 4 - - redbook - wmoTTAAii=PSBB12 - + PSBB12 4 - - redbook - wmoTTAAii=PSBB25 - + PSBB25 4 - - redbook - wmoTTAAii=PSBC04 - + PSBC04 6 - - redbook - wmoTTAAii=PSBC08 - + PSBC08 6 - - redbook - wmoTTAAii=PSBC12 - + PSBC12 6 - - redbook - wmoTTAAii=PSBC25 - + PSBC25 6 - - redbook - wmoTTAAii=PSBD04 - + PSBD04 6 - - redbook - wmoTTAAii=PSBD08 - + PSBD08 6 - - redbook - wmoTTAAii=PSBD12 - + PSBD12 6 - - redbook - wmoTTAAii=PSBD25 - + PSBD25 6 - - redbook - wmoTTAAii=PSAO72 - + PSAO72 6 - - redbook - wmoTTAAii=PENV01 - + PENV01 1 - - redbook - wmoTTAAii=PENV02 - + PENV02 1 - - redbook - wmoTTAAii=PENV03 - + PENV03 1 - - redbook - wmoTTAAii=PENV04 - + PENV04 1 - - redbook - wmoTTAAii=PENV05 - + PENV05 1 - - redbook - wmoTTAAii=PENV06 - + PENV06 1 - - redbook - wmoTTAAii=PENV07 - + PENV07 1 - - redbook - wmoTTAAii=PENV08 - + PENV08 1 - - redbook - wmoTTAAii=PENV09 - + PENV09 1 - - redbook - wmoTTAAii=PENV10 - + PENV10 1 - - redbook - wmoTTAAii=PENV11 - + PENV11 1 - - redbook - wmoTTAAii=PENV12 - + PENV12 1 - - redbook - wmoTTAAii=PENV13 - + PENV13 1 - - redbook - wmoTTAAii=PTNV01 - + PTNV01 1 - - redbook - wmoTTAAii=PTNV02 - + PTNV02 1 - - redbook - wmoTTAAii=PTNV03 - + PTNV03 1 - - redbook - wmoTTAAii=PTNV04 - + PTNV04 1 - - redbook - wmoTTAAii=PTNV05 - + PTNV05 1 - - redbook - wmoTTAAii=PTNV06 - + PTNV06 1 - - redbook - wmoTTAAii=PTNV07 - + PTNV07 1 - - redbook - wmoTTAAii=PTNV08 - + PTNV08 1 - - redbook - wmoTTAAii=PTNV09 - + PTNV09 1 - - redbook - wmoTTAAii=PTNV10 - + PTNV10 1 - - redbook - wmoTTAAii=PTNV11 - + PTNV11 1 - - redbook - wmoTTAAii=PTNV12 - + PTNV12 1 - - redbook - wmoTTAAii=PTNV13 - + PTNV13 1 - - redbook - wmoTTAAii=PGNM98 - + PGNM98 4 - - redbook - wmoTTAAii=PGNO98 - + PGNO98 2 - \ No newline at end of file + diff --git a/edexOsgi/com.raytheon.edex.plugin.satellite/src/com/raytheon/edex/util/satellite/SatelliteMenuUtil.java b/edexOsgi/com.raytheon.edex.plugin.satellite/src/com/raytheon/edex/util/satellite/SatelliteMenuUtil.java index d7ff45c47a..4e567c1c79 100644 --- a/edexOsgi/com.raytheon.edex.plugin.satellite/src/com/raytheon/edex/util/satellite/SatelliteMenuUtil.java +++ b/edexOsgi/com.raytheon.edex.plugin.satellite/src/com/raytheon/edex/util/satellite/SatelliteMenuUtil.java @@ -51,6 +51,8 @@ import com.vividsolutions.jts.geom.Coordinate; * May 18, 2011 mnash Initial creation * Sep 10, 2012 15337 kshresth Changed sector on OCONUS:Products under * Derived Products Imagery Display + * Nov 01, 2012 15346 kshresth Added Satellite Products for OCONUS + * * * * @author mnash @@ -144,17 +146,17 @@ public class SatelliteMenuUtil extends AbstractMenuUtil { // sector0 sub = new VariableSubstitution(); sub.key = "sector0"; - sub.value = "Northern Hemisphere Composite"; + sub.value = state + " Regional"; ((CommonIncludeMenuContribution) file.contributions[0]).substitutions[0] = sub; // sector1 sub = new VariableSubstitution(); sub.key = "sector1"; - sub.value = "Northern Hemisphere Composite"; + sub.value = state + " National"; ((CommonIncludeMenuContribution) file.contributions[0]).substitutions[1] = sub; // sector2 sub = new VariableSubstitution(); sub.key = "sector2"; - sub.value = "Northern Hemisphere Composite"; + sub.value = "Supernational"; ((CommonIncludeMenuContribution) file.contributions[0]).substitutions[2] = sub; // sector 3, for these sites copy sector2 sub = new VariableSubstitution(); diff --git a/edexOsgi/com.raytheon.edex.plugin.satellite/utility/common_static/base/purge/satellitePurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.satellite/utility/common_static/base/purge/satellitePurgeRules.xml index 41fe0bbb80..d17fe041fe 100644 --- a/edexOsgi/com.raytheon.edex.plugin.satellite/utility/common_static/base/purge/satellitePurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.satellite/utility/common_static/base/purge/satellitePurgeRules.xml @@ -1,796 +1,570 @@ - - - - satellite - default - + + sectorID + physicalElement + 24 - + - - satellite - sectorID=Alaska National;physicalElement=Imager 11 micron IR - + Alaska National + Imager 11 micron IR 48 - - satellite - sectorID=Alaska National;physicalElement=Imager 6.7-6.5 micron IR (WV) - + Alaska National + Imager 6.7-6.5 micron IR (WV) 48 - - satellite - sectorID=Alaska National;physicalElement=Imager Visible - + Alaska National + Imager Visible 36 - - satellite - sectorID=Alaska National;physicalElement=Percent of Normal TPW - + Alaska National + Percent of Normal TPW 48 - - satellite - sectorID=Alaska National;physicalElement=Rain fall rate - + Alaska National + Rain fall rate 48 - - satellite - sectorID=Alaska National;physicalElement=Sounder Based Derived Precipitable Water (PW) - + Alaska National + Sounder Based Derived Precipitable Water (PW) 48 - - satellite - sectorID=Alaska Regional;physicalElement=Imager 11 micron IR - + Alaska Regional + Imager 11 micron IR 96 - - satellite - sectorID=Alaska Regional;physicalElement=Imager 12 micron IR - + Alaska Regional + Imager 12 micron IR 96 - - satellite - sectorID=Alaska Regional;physicalElement=Imager 13 micron (IR) - + Alaska Regional + Imager 13 micron (IR) 96 - - satellite - sectorID=Alaska Regional;physicalElement=Imager 3.9 micron IR - + Alaska Regional + Imager 3.9 micron IR 96 - - satellite - sectorID=Alaska Regional;physicalElement=Imager 6.7-6.5 micron IR (WV) - + Alaska Regional + Imager 6.7-6.5 micron IR (WV) 96 - - satellite - sectorID=Alaska Regional;physicalElement=Imager Visible - + Alaska Regional + Imager Visible 72 - - satellite - sectorID=East CONUS;physicalElement=Imager 11 micron IR - + East CONUS + Imager 11 micron IR 96 - - satellite - sectorID=East CONUS;physicalElement=Imager 12 micron IR - + East CONUS + Imager 12 micron IR 96 - - satellite - sectorID=East CONUS;physicalElement=Imager 13 micron (IR) - + East CONUS + Imager 13 micron (IR) 96 - - satellite - sectorID=East CONUS;physicalElement=Imager 3.9 micron IR - + East CONUS + Imager 3.9 micron IR 96 - - satellite - sectorID=East CONUS;physicalElement=Imager 6.7-6.5 micron IR (WV) - + East CONUS + Imager 6.7-6.5 micron IR (WV) 96 - - satellite - sectorID=East CONUS;physicalElement=Imager Visible - + East CONUS + Imager Visible 56 - - satellite - sectorID=East CONUS;physicalElement=Low cloud base imagery - + East CONUS + Low cloud base imagery 62 - - satellite - sectorID=East CONUS;physicalElement=Sounder 11.03 micron imagery - + East CONUS + Sounder 11.03 micron imagery 4 - - satellite - sectorID=East CONUS;physicalElement=Sounder 14.06 micron imagery - + East CONUS + Sounder 14.06 micron imagery 4 - - satellite - sectorID=East CONUS;physicalElement=Sounder 3.98 micron imagery - + East CONUS + Sounder 3.98 micron imagery 4 - - satellite - sectorID=East CONUS;physicalElement=Sounder 4.45 micron imagery - + East CONUS + Sounder 4.45 micron imagery 4 - - satellite - sectorID=East CONUS;physicalElement=Sounder 6.51 micron imagery - + East CONUS + Sounder 6.51 micron imagery 4 - - satellite - sectorID=East CONUS;physicalElement=Sounder 7.02 micron imagery - + East CONUS + Sounder 7.02 micron imagery 4 - - satellite - sectorID=East CONUS;physicalElement=Sounder 7.43 micron imagery - + East CONUS + Sounder 7.43 micron imagery 4 - - satellite - sectorID=East CONUS;physicalElement=Sounder Visible imagery - + East CONUS + Sounder Visible imagery 4 - - satellite - sectorID=Hawaii National;physicalElement=Imager 11 micron IR - + Hawaii National + Imager 11 micron IR 48 - - satellite - sectorID=Hawaii National;physicalElement=Imager 6.7-6.5 micron IR (WV) - + Hawaii National + Imager 6.7-6.5 micron IR (WV) 48 - - satellite - sectorID=Hawaii National;physicalElement=Imager Visible - + Hawaii National + Imager Visible 36 - - satellite - sectorID=Hawaii National;physicalElement=Percent of Normal TPW - + Hawaii National + Percent of Normal TPW 48 - - satellite - sectorID=Hawaii National;physicalElement=Rain fall rate - + Hawaii National + Rain fall rate 48 - - satellite - sectorID=Hawaii National;physicalElement=Sounder 11.03 micron imagery - + Hawaii National + Sounder 11.03 micron imagery 4 - - satellite - sectorID=Hawaii National;physicalElement=Sounder 14.06 micron imagery - + Hawaii National + Sounder 14.06 micron imagery 4 - - satellite - sectorID=Hawaii National;physicalElement=Sounder 3.98 micron imagery - + Hawaii National + Sounder 3.98 micron imagery 4 - - satellite - sectorID=Hawaii National;physicalElement=Sounder 4.45 micron imagery - + Hawaii National + Sounder 4.45 micron imagery 4 - - satellite - sectorID=Hawaii National;physicalElement=Sounder 6.51 micron imagery - + Hawaii National + Sounder 6.51 micron imagery 4 - - satellite - sectorID=Hawaii National;physicalElement=Sounder 7.02 micron imagery - + Hawaii National + Sounder 7.02 micron imagery 4 - - satellite - sectorID=Hawaii National;physicalElement=Sounder 7.43 micron imagery - + Hawaii National + Sounder 7.43 micron imagery 4 - - satellite - sectorID=Hawaii National;physicalElement=Sounder Based Derived Precipitable Water (PW) - + Hawaii National + Sounder Based Derived Precipitable Water (PW) 4 - - satellite - sectorID=Hawaii National;physicalElement=Sounder Visible imagery - + Hawaii National + Sounder Visible imagery 4 - - satellite - sectorID=Hawaii Regional;physicalElement=Imager 11 micron IR - + Hawaii Regional + Imager 11 micron IR 96 - - satellite - sectorID=Hawaii Regional;physicalElement=Imager 12 micron IR - + Hawaii Regional + Imager 12 micron IR 96 - - satellite - sectorID=Hawaii Regional;physicalElement=Imager 3.9 micron IR - + Hawaii Regional + Imager 3.9 micron IR 96 - - satellite - sectorID=Hawaii Regional;physicalElement=Imager 6.7-6.5 micron IR (WV) - + Hawaii Regional + Imager 6.7-6.5 micron IR (WV) 96 - - satellite - sectorID=Hawaii Regional;physicalElement=Imager Visible - + Hawaii Regional + Imager Visible 72 - - satellite - sectorID=NH Composite - Meteosat-GOES E-GOES W-GMS;physicalElement=Imager 11 micron IR - + NH Composite - Meteosat-GOES E-GOES W-GMS + Imager 11 micron IR 48 - - satellite - sectorID=NH Composite - Meteosat-GOES E-GOES W-GMS;physicalElement=Imager 6.7-6.5 micron IR (WV) - + NH Composite - Meteosat-GOES E-GOES W-GMS + Imager 6.7-6.5 micron IR (WV) 48 - - satellite - sectorID=NH Composite - Meteosat-GOES E-GOES W-GMS;physicalElement=Imager Visible - + NH Composite - Meteosat-GOES E-GOES W-GMS + Imager Visible 48 - - satellite - sectorID=Northern Hemisphere Composite;physicalElement=Imager 11 micron IR - + Northern Hemisphere Composite + Imager 11 micron IR 48 - - satellite - sectorID=Northern Hemisphere Composite;physicalElement=Imager 6.7-6.5 micron IR (WV) - + Northern Hemisphere Composite + Imager 6.7-6.5 micron IR (WV) 48 - - satellite - sectorID=Northern Hemisphere Composite;physicalElement=Imager Visible - + Northern Hemisphere Composite + Imager Visible 36 - - satellite - sectorID=Puerto Rico National;physicalElement=Imager 11 micron IR - + Puerto Rico National + Imager 11 micron IR 48 - - satellite - sectorID=Puerto Rico National;physicalElement=Imager 6.7-6.5 micron IR (WV) - + Puerto Rico National + Imager 6.7-6.5 micron IR (WV) 48 - - satellite - sectorID=Puerto Rico National;physicalElement=Imager Visible - + Puerto Rico National + Imager Visible 36 - - satellite - sectorID=Puerto Rico National;physicalElement=Percent of Normal TPW - + Puerto Rico National + Percent of Normal TPW 48 - - satellite - sectorID=Puerto Rico National;physicalElement=Rain fall rate - + Puerto Rico National + Rain fall rate 48 - - satellite - sectorID=Puerto Rico National;physicalElement=Sounder 11.03 micron imagery - + Puerto Rico National + Sounder 11.03 micron imagery 4 - - satellite - sectorID=Puerto Rico National;physicalElement=Sounder 14.06 micron imagery - + Puerto Rico National + Sounder 14.06 micron imagery 4 - - satellite - sectorID=Puerto Rico National;physicalElement=Sounder 3.98 micron imagery - + Puerto Rico National + Sounder 3.98 micron imagery 4 - - satellite - sectorID=Puerto Rico National;physicalElement=Sounder 4.45 micron imagery - + Puerto Rico National + Sounder 4.45 micron imagery 4 - - satellite - sectorID=Puerto Rico National;physicalElement=Sounder 6.51 micron imagery - + Puerto Rico National + Sounder 6.51 micron imagery 4 - - satellite - sectorID=Puerto Rico National;physicalElement=Sounder 7.02 micron imagery - + Puerto Rico National + Sounder 7.02 micron imagery 4 - - satellite - sectorID=Puerto Rico National;physicalElement=Sounder 7.43 micron imagery - + Puerto Rico National + Sounder 7.43 micron imagery 4 - - satellite - sectorID=Puerto Rico National;physicalElement=Sounder Based Derived Precipitable Water (PW) - + Puerto Rico National + Sounder Based Derived Precipitable Water (PW) 4 - - satellite - sectorID=Puerto Rico National;physicalElement=Sounder Visible imagery - + Puerto Rico National + Sounder Visible imagery 36 - - satellite - sectorID=Puerto Rico Regional;physicalElement=Imager 11 micron IR - + Puerto Rico Regional + Imager 11 micron IR 96 - - satellite - sectorID=Puerto Rico Regional;physicalElement=Imager 12 micron IR - + Puerto Rico Regional + Imager 12 micron IR 96 - - satellite - sectorID=Puerto Rico Regional;physicalElement=Imager 13 micron (IR) - + Puerto Rico Regional + Imager 13 micron (IR) 96 - - satellite - sectorID=Puerto Rico Regional;physicalElement=Imager 3.9 micron IR - + Puerto Rico Regional + Imager 3.9 micron IR 96 - - satellite - sectorID=Puerto Rico Regional;physicalElement=Imager 6.7-6.5 micron IR (WV) - + Puerto Rico Regional + Imager 6.7-6.5 micron IR (WV) 96 - - satellite - sectorID=Puerto Rico Regional;physicalElement=Imager Visible - + Puerto Rico Regional + Imager Visible 72 - - satellite - sectorID=Supernational;physicalElement=Gridded Cloud Amount - + Supernational + Gridded Cloud Amount 48 - - satellite - sectorID=Supernational;physicalElement=Gridded Cloud Top Pressure or Height - + Supernational + Gridded Cloud Top Pressure or Height 48 - - satellite - sectorID=Supernational;physicalElement=Imager 11 micron IR - + Supernational + Imager 11 micron IR 32 - - satellite - sectorID=Supernational;physicalElement=Imager 6.7-6.5 micron IR (WV) - + Supernational + Imager 6.7-6.5 micron IR (WV) 32 - - satellite - sectorID=Supernational;physicalElement=Imager Visible - + Supernational + Imager Visible 32 - - satellite - sectorID=Supernational;physicalElement=Percent of Normal TPW - + Supernational + Percent of Normal TPW 48 - - satellite - sectorID=Supernational;physicalElement=Rain fall rate - + Supernational + Rain fall rate 48 - - satellite - sectorID=Supernational;physicalElement=Sounder Based Derived Lifted Index (LI) - + Supernational + Sounder Based Derived Lifted Index (LI) 48 - - satellite - sectorID=Supernational;physicalElement=Sounder Based Derived Precipitable Water (PW) - + Supernational + Sounder Based Derived Precipitable Water (PW) 48 - - satellite - sectorID=Supernational;physicalElement=Sounder Based Derived Surface Skin Temp (SFC Skin) - + Supernational + Sounder Based Derived Surface Skin Temp (SFC Skin) 48 - - satellite - sectorID=Supernational;physicalElement=Imager 11 micron IR - + Supernational + Imager 11 micron IR 24 - - satellite - sectorID=Supernational;physicalElement=Imager 12 micron IR - + Supernational + Imager 12 micron IR 32 - - satellite - sectorID=Supernational;physicalElement=Imager 13 micron (IR) - + Supernational + Imager 13 micron (IR) 32 - - satellite - sectorID=Supernational;physicalElement=Imager 3.9 micron IR - + Supernational + Imager 3.9 micron IR 32 - - satellite - sectorID=Supernational;physicalElement=Imager 6.7-6.5 micron IR (WV) - + Supernational + Imager 6.7-6.5 micron IR (WV) 32 - - satellite - sectorID=Supernational;physicalElement=Imager Visible - + Supernational + Imager Visible 20 - - satellite - sectorID=Supernational;physicalElement=Low cloud base imagery - + Supernational + Low cloud base imagery 36 - - satellite - sectorID=Supernational;physicalElement=Sounder 11.03 micron imagery - + Supernational + Sounder 11.03 micron imagery 4 - - satellite - sectorID=Supernational;physicalElement=Sounder 14.06 micron imagery - + Supernational + Sounder 14.06 micron imagery 4 - - satellite - sectorID=Supernational;physicalElement=Sounder 3.98 micron imagery - + Supernational + Sounder 3.98 micron imagery 4 - - satellite - sectorID=Supernational;physicalElement=Sounder 4.45 micron imagery - + Supernational + Sounder 4.45 micron imagery 4 - - satellite - sectorID=Supernational;physicalElement=Sounder 6.51 micron imagery - + Supernational + Sounder 6.51 micron imagery 4 - - satellite - sectorID=Supernational;physicalElement=Sounder 7.02 micron imagery - + Supernational + Sounder 7.02 micron imagery 4 - - satellite - sectorID=Supernational;physicalElement=Sounder 7.43 micron imagery - + Supernational + Sounder 7.43 micron imagery 4 - - satellite - sectorID=Supernational;physicalElement=Sounder Visible imagery - + Supernational + Sounder Visible imagery 4 - - satellite - sectorID=West CONUS;physicalElement=Imager 11 micron IR - + West CONUS + Imager 11 micron IR 96 - - satellite - sectorID=West CONUS;physicalElement=Imager 12 micron IR - + West CONUS + Imager 12 micron IR 96 - - satellite - sectorID=West CONUS;physicalElement=Imager 13 micron (IR) - + West CONUS + Imager 13 micron (IR) 96 - - satellite - sectorID=West CONUS;physicalElement=Imager 3.9 micron IR - + West CONUS + Imager 3.9 micron IR 96 - - satellite - sectorID=West CONUS;physicalElement=Imager 6.7-6.5 micron IR (WV) - + West CONUS + Imager 6.7-6.5 micron IR (WV) 96 - - satellite - sectorID=West CONUS;physicalElement=Imager Visible - + West CONUS + Imager Visible 56 - - satellite - sectorID=West CONUS;physicalElement=Low cloud base imagery - + West CONUS + Low cloud base imagery 62 - - satellite - sectorID=West CONUS;physicalElement=Sounder 11.03 micron imagery - + West CONUS + Sounder 11.03 micron imagery 4 - - satellite - sectorID=West CONUS;physicalElement=Sounder 14.06 micron imagery - + West CONUS + Sounder 14.06 micron imagery 4 - - satellite - sectorID=West CONUS;physicalElement=Sounder 3.98 micron imagery - + West CONUS + Sounder 3.98 micron imagery 4 - - satellite - sectorID=West CONUS;physicalElement=Sounder 4.45 micron imagery - + West CONUS + Sounder 4.45 micron imagery 4 - - satellite - sectorID=West CONUS;physicalElement=Sounder 6.51 micron imagery - + West CONUS + Sounder 6.51 micron imagery 4 - - satellite - sectorID=West CONUS;physicalElement=Sounder 7.02 micron imagery - + West CONUS + Sounder 7.02 micron imagery 4 - - satellite - sectorID=West CONUS;physicalElement=Sounder 7.43 micron imagery - + West CONUS + Sounder 7.43 micron imagery 4 - - satellite - sectorID=West CONUS;physicalElement=Sounder Visible imagery - + West CONUS + Sounder Visible imagery 4 diff --git a/edexOsgi/com.raytheon.edex.plugin.sfcobs/utility/common_static/base/purge/sfcobsPurgeRules.xml b/edexOsgi/com.raytheon.edex.plugin.sfcobs/utility/common_static/base/purge/sfcobsPurgeRules.xml index 3905e79a32..cde48034fc 100644 --- a/edexOsgi/com.raytheon.edex.plugin.sfcobs/utility/common_static/base/purge/sfcobsPurgeRules.xml +++ b/edexOsgi/com.raytheon.edex.plugin.sfcobs/utility/common_static/base/purge/sfcobsPurgeRules.xml @@ -1,21 +1,15 @@ - - + + reportType - - sfcobs - reportType=1001 - + 1001 13 =00-01:00:00 00-01:00:00 - - sfcobs - reportType=1001 - + 1001 50 =01-00:00:00 +00-12:00:00 @@ -24,217 +18,146 @@ - - sfcobs - reportType=1002 - + 1002 13 =00-01:00:00 00-01:00:00 - - sfcobs - reportType=1002 - + 1002 50 =01-00:00:00 +00-12:00:00 - - - sfcobs - reportType=1003 - + 1003 34 =00-01:00:00 00-01:00:00 - - sfcobs - reportType=1003 - + 1003 38 =00-03:00:00 00-01:00:00 - - sfcobs - reportType=1003 - + 1003 42 =00-06:00:00 00-01:00:00 - - sfcobs - reportType=1003 - + 1003 50 =01-00:00:00 +00-12:00:00 - - - sfcobs - reportType=1004 - + 1004 34 =00-01:00:00 00-01:00:00 - - sfcobs - reportType=1004 - + 1004 38 =00-03:00:00 00-01:00:00 - - sfcobs - reportType=1004 - + 1004 42 =00-06:00:00 00-01:00:00 - - sfcobs - reportType=1004 - + 1004 50 =01-00:00:00 +00-12:00:00 - - - sfcobs - reportType=1005 - + 1005 34 =00-01:00:00 00-01:00:00 - - sfcobs - reportType=1005 - + 1005 38 =00-03:00:00 00-01:00:00 - - sfcobs - reportType=1005 - + 1005 42 =00-06:00:00 00-01:00:00 - - sfcobs - reportType=1005 - + 1005 50 =01-00:00:00 +00-12:00:00 - - - sfcobs - reportType=1006 - + 1006 34 =00-01:00:00 00-01:00:00 - - sfcobs - reportType=1006 - + 1006 38 =00-03:00:00 00-01:00:00 - - sfcobs - reportType=1006 - + 1006 42 =00-06:00:00 00-01:00:00 - - sfcobs - reportType=1006 - + 1006 50 =01-00:00:00 +00-12:00:00 - - - sfcobs - reportType=1007 - + 1007 34 =00-01:00:00 00-01:00:00 - - sfcobs - reportType=1007 - + 1007 38 =00-03:00:00 00-01:00:00 - - sfcobs - reportType=1007 - + 1007 42 =00-06:00:00 00-01:00:00 - - sfcobs - reportType=1007 - + 1007 50 =01-00:00:00 +00-12:00:00 - \ No newline at end of file + diff --git a/edexOsgi/com.raytheon.edex.plugin.text/src/com/raytheon/edex/plugin/text/dao/TextDao.java b/edexOsgi/com.raytheon.edex.plugin.text/src/com/raytheon/edex/plugin/text/dao/TextDao.java index 65d058c5d4..d8c2373b80 100644 --- a/edexOsgi/com.raytheon.edex.plugin.text/src/com/raytheon/edex/plugin/text/dao/TextDao.java +++ b/edexOsgi/com.raytheon.edex.plugin.text/src/com/raytheon/edex/plugin/text/dao/TextDao.java @@ -22,6 +22,7 @@ package com.raytheon.edex.plugin.text.dao; import java.util.Calendar; import java.util.Date; import java.util.List; +import java.util.Map; import com.raytheon.edex.db.dao.DefaultPluginDao; import com.raytheon.edex.textdb.dao.StdTextProductDao; @@ -51,31 +52,31 @@ import com.raytheon.uf.edex.database.query.DatabaseQuery; */ public class TextDao extends DefaultPluginDao { - public TextDao(String pluginName) throws PluginException { - super(pluginName); - } - - @Override - public void purgeAllData() { - logger.warn("purgeAllPluginData not implemented for text. No data will be purged."); - } - - protected void loadScripts() throws PluginException { - // no op - } + public TextDao(String pluginName) throws PluginException { + super(pluginName); + } @Override - public void purgeExpiredData() throws PluginException { - int deletedRecords = 0; + public void purgeAllData() { + logger.warn("purgeAllPluginData not implemented for text. No data will be purged."); + } - // only do full purge every few hours since incremental purge runs every - // minute - if (Calendar.getInstance().get(Calendar.HOUR_OF_DAY) % 3 == 0) { - TextDB.purgeStdTextProducts(); - } + protected void loadScripts() throws PluginException { + // no op + } - PurgeLogger.logInfo("Purged " + deletedRecords + " items total.", - "text"); + @Override + public void purgeExpiredData() throws PluginException { + int deletedRecords = 0; + + // only do full purge every few hours since incremental purge runs every + // minute + if (Calendar.getInstance().get(Calendar.HOUR_OF_DAY) % 3 == 0) { + TextDB.purgeStdTextProducts(); + } + + PurgeLogger.logInfo("Purged " + deletedRecords + " items total.", + "text"); } @SuppressWarnings("unchecked") @@ -95,14 +96,17 @@ public class TextDao extends DefaultPluginDao { } @Override - public Date getMinInsertTime(String productKey) + public Date getMinInsertTime(Map productKeys) throws DataAccessLayerException { StdTextProductDao dao = new StdTextProductDao(true); DatabaseQuery query = new DatabaseQuery(dao.getDaoClass()); - List keys = this.getProductKeyParameters(productKey); - for (String[] key : keys) { - query.addQueryParam(key[0], key[1]); + + if ((productKeys != null) && (productKeys.size() > 0)) { + for (Map.Entry pair : productKeys.entrySet()) { + query.addQueryParam(pair.getKey(), pair.getValue()); + } } + query.addReturnedField("insertTime"); query.addOrder("insertTime", true); query.setMaxResults(1); @@ -113,5 +117,5 @@ public class TextDao extends DefaultPluginDao { } else { return result.get(0).getTime(); } - } + } } diff --git a/edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java b/edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java index 2382d54e98..12a718a8fb 100644 --- a/edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java +++ b/edexOsgi/com.raytheon.uf.common.comm/src/com/raytheon/uf/common/comm/HttpClient.java @@ -113,6 +113,8 @@ public class HttpClient { private boolean gzipRequests = false; + private boolean handlingGzipResponses = false; + /** number of requests currently in process by the application per host */ private final Map currentRequestsCount = new ConcurrentHashMap(); @@ -159,51 +161,37 @@ public class HttpClient { * Enables gzip capabilities by advertising gzip is an accepted response * encoding and decompressing responses if they arrived gzipped. This should * only ever be called once per runtime. + * + * @param acceptGzip + * whether or not to handle gzip responses */ - public void enableGzipResponseHandling() { - // Add gzip compression handlers + public void setGzipResponseHandling(boolean acceptGzip) { + if (acceptGzip && !handlingGzipResponses) { + // Add gzip compression handlers - // advertise we accept gzip - ((AbstractHttpClient) client) - .addRequestInterceptor(new HttpRequestInterceptor() { - - public void process(final HttpRequest request, - final HttpContext context) throws HttpException, - IOException { - if (!request.containsHeader("Accept-Encoding")) { - request.addHeader("Accept-Encoding", "gzip"); - } - } - - }); - - // handle gzip contents - ((AbstractHttpClient) client) - .addResponseInterceptor(new HttpResponseInterceptor() { - - public void process(final HttpResponse response, - final HttpContext context) throws HttpException, - IOException { - HttpEntity entity = response.getEntity(); - Header ceheader = entity.getContentEncoding(); - if (ceheader != null) { - HeaderElement[] codecs = ceheader.getElements(); - for (int i = 0; i < codecs.length; i++) { - if (codecs[i].getName() - .equalsIgnoreCase("gzip")) { - response.setEntity(new GzipDecompressingEntity( - response.getEntity())); - return; - } - } - } - } - - }); + // advertise we accept gzip + ((AbstractHttpClient) client) + .addRequestInterceptor(new GzipRequestInterceptor()); + // handle gzip contents + ((AbstractHttpClient) client) + .addResponseInterceptor(new GzipResponseInterceptor()); + } else if (!acceptGzip && handlingGzipResponses) { + ((AbstractHttpClient) client) + .removeRequestInterceptorByClass(GzipRequestInterceptor.class); + ((AbstractHttpClient) client) + .removeResponseInterceptorByClass(GzipResponseInterceptor.class); + } + handlingGzipResponses = acceptGzip; } - public void enableRequestCompression() { - gzipRequests = true; + /** + * Sets whether or not to compress the outgoing requests to reduce bandwidth + * sent by the client. + * + * @param compress + */ + public void setCompressRequests(boolean compress) { + gzipRequests = compress; } public static synchronized HttpClient getInstance() { @@ -656,4 +644,45 @@ public class HttpClient { } + /** + * Adds Accept-Encoding: gzip to every outgoing request + */ + private static class GzipRequestInterceptor implements + HttpRequestInterceptor { + + @Override + public void process(HttpRequest request, HttpContext context) + throws HttpException, IOException { + if (!request.containsHeader("Accept-Encoding")) { + request.addHeader("Accept-Encoding", "gzip"); + } + } + + } + + /** + * Decompresses any responses that arrive with Content-Encoding: gzip + */ + private static class GzipResponseInterceptor implements + HttpResponseInterceptor { + + @Override + public void process(HttpResponse response, HttpContext context) + throws HttpException, IOException { + HttpEntity entity = response.getEntity(); + Header ceheader = entity.getContentEncoding(); + if (ceheader != null) { + HeaderElement[] codecs = ceheader.getElements(); + for (HeaderElement codec : codecs) { + if (codec.getName().equalsIgnoreCase("gzip")) { + response.setEntity(new GzipDecompressingEntity(response + .getEntity())); + return; + } + } + } + } + + } + } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/FFMPDataContainer.java b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/FFMPDataContainer.java index 8d8219a85f..dc84912457 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/FFMPDataContainer.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.ffmp/src/com/raytheon/uf/common/dataplugin/ffmp/FFMPDataContainer.java @@ -25,6 +25,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Map.Entry; import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import com.raytheon.uf.common.monitor.config.FFMPSourceConfigurationManager.SOURCE_TYPE; import com.raytheon.uf.common.monitor.xml.SourceXML; @@ -54,10 +55,8 @@ public class FFMPDataContainer { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(FFMPDataContainer.class); - private java.util.concurrent.ConcurrentHashMap basinDataMap - = new java.util.concurrent.ConcurrentHashMap();//DR 15471 - //private HashMap basinDataMap = new HashMap(); - + private final ConcurrentHashMap basinDataMap = new ConcurrentHashMap();// DR + private String sourceName = null; private String filePath = null; @@ -80,56 +79,6 @@ public class FFMPDataContainer { } } - public Set getKeys() { - return basinDataMap.keySet(); - } - - /** - * Get the one you are looking for - * - * @return - */ - public FFMPBasinData getBasinData(String huc) { - if (basinDataMap.containsKey(huc)) { - return basinDataMap.get(huc); - } else { - return null; - } - } - - /** - * maybe this will work - * - * @param basins - * @param hucName - */ - public void setBasinBuddyData(FFMPBasinData basins, String hucName) { - for (Entry entry : basins.getBasins().entrySet()) { - FFMPBasin basin = getBasinData(hucName).get(entry.getKey()); - if (basin != null) { - if (basin instanceof FFMPGuidanceBasin) { - FFMPGuidanceBasin gbasin = (FFMPGuidanceBasin) basin; - gbasin.getGuidValues().putAll( - ((FFMPGuidanceBasin) entry.getValue()) - .getGuidValues()); - } else { - basin.getValues().putAll(entry.getValue().getValues()); - } - } else { - getBasinData(hucName).put(entry.getKey(), entry.getValue()); - } - } - } - - /** - * Add a brand new one for new source, or initialization - * - * @param basins - */ - public void setBasinData(String huc, FFMPBasinData fftiData) { - basinDataMap.put(huc, fftiData); - } - /** * Adds to the cache * @@ -147,234 +96,156 @@ public class FFMPDataContainer { FFMPBasinData currBasinData = getBasinData(huc); - if (currBasinData == null) { - setBasinData(huc, newBasinData); - } else { + synchronized (currBasinData) { - for (Long key : newBasinData.getBasins().keySet()) { + if (currBasinData == null) { + setBasinData(huc, newBasinData); + } else { - if (guid) { + for (Long key : newBasinData.getBasins().keySet()) { - FFMPGuidanceBasin basin = null; + if (guid) { - if (currBasinData.get(key) instanceof FFMPGuidanceBasin) { - basin = (FFMPGuidanceBasin) currBasinData.get(key); - } + FFMPGuidanceBasin basin = null; - if (basin == null) { - - FFMPBasin newbasin = newBasinData.get(key); - basin = new FFMPGuidanceBasin(key, - newbasin.getAggregated()); - - if (newbasin instanceof FFMPGuidanceBasin) { - - Float val = ((FFMPGuidanceBasin) newbasin).getValue(date, source.getSourceName()); - basin.setValue(source.getSourceName(), date, val); - } else { - Float val = newbasin.getValue(date); - basin.setValue(source.getSourceName(), date, val); + if (currBasinData.get(key) instanceof FFMPGuidanceBasin) { + basin = (FFMPGuidanceBasin) currBasinData.get(key); } - currBasinData.put(key, basin); + if (basin == null) { - } else { + FFMPBasin newbasin = newBasinData.get(key); + basin = new FFMPGuidanceBasin(key, + newbasin.getAggregated()); - FFMPBasin newbasin = newBasinData.get(key); + if (newbasin instanceof FFMPGuidanceBasin) { - if (newbasin instanceof FFMPGuidanceBasin) { - - FFMPGuidanceBasin newGbasin = (FFMPGuidanceBasin)newBasinData.get(key); - Float basinVal = basin.getValue(date, source.getSourceName()); - Float newBasinVal = newGbasin.getValue(date, source.getSourceName()); - - if (basinVal != null - && basinVal >= 0.0f - && !basinVal.isNaN() - && basinVal != FFMPUtils.MISSING) { - - if (newBasinVal != null - && newBasinVal >= 0.0f - && !newBasinVal.isNaN() - && newBasinVal != FFMPUtils.MISSING) { - - float val = (float) ((basinVal + newBasinVal) / 2.0); - basin.setValue(source.getSourceName(), - date, val); - } + Float val = ((FFMPGuidanceBasin) newbasin) + .getValue(date, source.getSourceName()); + basin.setValue(source.getSourceName(), date, + val); } else { - - if (newBasinVal.isNaN()) { - newBasinVal = FFMPUtils.MISSING; - } - - basin.setValue(source.getSourceName(), - date, newBasinVal); + Float val = newbasin.getValue(date); + basin.setValue(source.getSourceName(), date, + val); } + //currBasinData.put(key, basin); + syncPut(currBasinData, key, basin); } else { - Float basinVal = basin.getValue(date, source.getSourceName()); - Float newBasinVal = newbasin.getValue(); - - if (basinVal != null - && basinVal >= 0.0f - && !basinVal.isNaN() - && basinVal != FFMPUtils.MISSING) { - - if (newBasinVal != null - && newBasinVal >= 0.0f - && !newBasinVal.isNaN() - && newBasinVal != FFMPUtils.MISSING) { + FFMPBasin newbasin = newBasinData.get(key); + + if (newbasin instanceof FFMPGuidanceBasin) { + + FFMPGuidanceBasin newGbasin = (FFMPGuidanceBasin) newBasinData + .get(key); + Float basinVal = basin.getValue(date, + source.getSourceName()); + Float newBasinVal = newGbasin.getValue(date, + source.getSourceName()); + + if (basinVal != null && basinVal >= 0.0f + && !basinVal.isNaN() + && basinVal != FFMPUtils.MISSING) { + + if (newBasinVal != null + && newBasinVal >= 0.0f + && !newBasinVal.isNaN() + && newBasinVal != FFMPUtils.MISSING) { float val = (float) ((basinVal + newBasinVal) / 2.0); basin.setValue(source.getSourceName(), date, val); + } + } else { + + if (newBasinVal.isNaN()) { + newBasinVal = FFMPUtils.MISSING; + } + + basin.setValue(source.getSourceName(), + date, newBasinVal); } + } else { - - if (newBasinVal.isNaN()) { - newBasinVal = FFMPUtils.MISSING; + + Float basinVal = basin.getValue(date, + source.getSourceName()); + Float newBasinVal = newbasin.getValue(); + + if (basinVal != null && basinVal >= 0.0f + && !basinVal.isNaN() + && basinVal != FFMPUtils.MISSING) { + + if (newBasinVal != null + && newBasinVal >= 0.0f + && !newBasinVal.isNaN() + && newBasinVal != FFMPUtils.MISSING) { + + float val = (float) ((basinVal + newBasinVal) / 2.0); + basin.setValue(source.getSourceName(), + date, val); + } + } else { + + if (newBasinVal.isNaN()) { + newBasinVal = FFMPUtils.MISSING; + } + + basin.setValue(source.getSourceName(), + date, newBasinVal); } - - basin.setValue(source.getSourceName(), - date, newBasinVal); } } - } - - } else { - - FFMPBasin basin = currBasinData.get(key); - FFMPBasin newbasin = newBasinData.get(key); - Float val = 0.0f; - - if (basin == null) { - - basin = new FFMPBasin(key, newbasin.getAggregated()); - val = newbasin.getValue(date); - - if (val.isNaN()) { - val = 0.0f; - } - - basin.setValue(date, val); - currBasinData.put(key, basin); } else { - if (basin.getValue(date) != null - && !basin.getValue(date).isNaN() - && basin.getValue(date) != 0.0) { - if (newbasin.getValue(date) != null - && !newbasin.getValue(date).isNaN() - && newbasin.getValue(date) != 0.0) { + FFMPBasin basin = currBasinData.get(key); + FFMPBasin newbasin = newBasinData.get(key); + Float val = 0.0f; - val = (float) ((basin.getValue(date) + newbasin - .getValue(date)) / 2); - } + if (basin == null) { - } else { + basin = new FFMPBasin(key, newbasin.getAggregated()); val = newbasin.getValue(date); if (val.isNaN()) { val = 0.0f; } + + basin.setValue(date, val); + //currBasinData.put(key, basin); + syncPut(currBasinData, key, basin); + } else { + + if (basin.getValue(date) != null + && !basin.getValue(date).isNaN() + && basin.getValue(date) != 0.0) { + if (newbasin.getValue(date) != null + && !newbasin.getValue(date).isNaN() + && newbasin.getValue(date) != 0.0) { + + val = (float) ((basin.getValue(date) + newbasin + .getValue(date)) / 2); + } + + } else { + val = newbasin.getValue(date); + + if (val.isNaN()) { + val = 0.0f; + } + } + + basin.setValue(date, val); } - - basin.setValue(date, val); } } } } } - public void setSourceName(String sourceName) { - this.sourceName = sourceName; - } - - public String getSourceName() { - return sourceName; - } - - /** - * check for the oldest key - * - * @return - */ - public Date getOldest() { - try { - for (Entry entry : getBasinData("ALL").getBasins() - .entrySet()) { - FFMPBasin basin = entry.getValue(); - if (basin instanceof FFMPGuidanceBasin) { - ((FFMPGuidanceBasin) basin).getGuidValues().firstKey(); - } else { - return basin.getValues().firstKey(); - } - } - } catch (Exception e) { - statusHandler.debug("No old times available..." + getSourceName()); - return null; - } - return null; - } - - /** - * Gets the list of ordered time keys - * - * @param barrierTime - * @return - */ - public ArrayList getOrderedTimes(Date barrierTime) { - ArrayList orderedTimes = new ArrayList(); - try { - for (Entry entry : getBasinData("ALL").getBasins() - .entrySet()) { - FFMPBasin basin = entry.getValue(); - for (Date time : basin.getValues().descendingKeySet()) { - if (time.after(barrierTime)) { - orderedTimes.add(time); - } - } - - Collections.reverse(orderedTimes); - - return orderedTimes; - } - } catch (Exception e) { - statusHandler.debug("No ordered times available..." - + getSourceName()); - return null; - } - - return null; - } - - /** - * check for the newest key - * - * @return - */ - public Date getNewest() { - try { - for (Entry entry : getBasinData("ALL").getBasins() - .entrySet()) { - FFMPBasin basin = entry.getValue(); - if (basin instanceof FFMPGuidanceBasin) { - ((FFMPGuidanceBasin) basin).getGuidValues().lastKey(); - } else { - return basin.getValues().lastKey(); - } - } - } catch (Exception e) { - statusHandler.debug("No new times available..." + getSourceName()); - return null; - } - - return null; - } - /** * check for the key * @@ -383,13 +254,18 @@ public class FFMPDataContainer { */ public boolean containsKey(Date date) { boolean contains = false; + if (getBasinData("ALL") != null) { - for (Entry entry : getBasinData("ALL").getBasins() - .entrySet()) { - FFMPBasin basin = entry.getValue(); - contains = basin.getValues().containsKey(date); - if (contains == true) { - return true; + + HashMap basins = getBasinData("ALL").getBasins(); + + synchronized (basins) { + for (Entry entry : basins.entrySet()) { + FFMPBasin basin = entry.getValue(); + contains = basin.getValues().containsKey(date); + if (contains == true) { + return true; + } } } } @@ -404,38 +280,45 @@ public class FFMPDataContainer { */ public boolean containsKey(String sourceName) { boolean contains = false; - for (Entry entry : getBasinData("ALL").getBasins() - .entrySet()) { - FFMPBasin basin = entry.getValue(); - if (basin instanceof FFMPGuidanceBasin) { - contains = ((FFMPGuidanceBasin) basin).containsKey(sourceName); - if (contains == true) { - // System.out.println("Contains Key: " + sourceName); - return true; + HashMap basins = getBasinData("ALL").getBasins(); + + synchronized (basins) { + for (Entry entry : basins.entrySet()) { + FFMPBasin basin = entry.getValue(); + if (basin instanceof FFMPGuidanceBasin) { + contains = ((FFMPGuidanceBasin) basin) + .containsKey(sourceName); + if (contains == true) { + // System.out.println("Contains Key: " + sourceName); + return true; + } } } } + // System.out.println("No Key: " + sourceName); return false; } /** - * check for size + * Get the one you are looking for * - * @param date * @return */ - public int size() { - for (Entry entry : getBasinData("ALL").getBasins() - .entrySet()) { - FFMPBasin basin = entry.getValue(); - if (basin instanceof FFMPGuidanceBasin) { - return ((FFMPGuidanceBasin) basin).getGuidValues().size(); - } else { - return basin.getValues().size(); - } + public FFMPBasinData getBasinData(String huc) { + if (basinDataMap.containsKey(huc)) { + return basinDataMap.get(huc); + } else { + return null; } - return 0; + } + + public String getFilePath() { + return filePath; + } + + public Set getKeys() { + return basinDataMap.keySet(); } /** @@ -457,6 +340,98 @@ public class FFMPDataContainer { return val; } + /** + * check for the newest key + * + * @return + */ + public Date getNewest() { + try { + + HashMap basins = getBasinData("ALL").getBasins(); + + synchronized (basins) { + for (Entry entry : basins.entrySet()) { + FFMPBasin basin = entry.getValue(); + if (basin instanceof FFMPGuidanceBasin) { + ((FFMPGuidanceBasin) basin).getGuidValues().lastKey(); + } else { + return basin.getValues().lastKey(); + } + } + } + } catch (Exception e) { + statusHandler.debug("No new times available..." + getSourceName()); + return null; + } + + return null; + } + + /** + * check for the oldest key + * + * @return + */ + public Date getOldest() { + try { + HashMap basins = getBasinData("ALL").getBasins(); + + synchronized (basins) { + for (Entry entry : basins.entrySet()) { + FFMPBasin basin = entry.getValue(); + if (basin instanceof FFMPGuidanceBasin) { + ((FFMPGuidanceBasin) basin).getGuidValues().firstKey(); + } else { + return basin.getValues().firstKey(); + } + } + } + } catch (Exception e) { + statusHandler.debug("No old times available..." + getSourceName()); + return null; + } + return null; + } + + /** + * Gets the list of ordered time keys + * + * @param barrierTime + * @return + */ + public ArrayList getOrderedTimes(Date barrierTime) { + ArrayList orderedTimes = new ArrayList(); + try { + HashMap basins = getBasinData("ALL").getBasins(); + + synchronized (basins) { + for (Entry entry : basins.entrySet()) { + FFMPBasin basin = entry.getValue(); + for (Date time : basin.getValues().descendingKeySet()) { + if (time.after(barrierTime)) { + orderedTimes.add(time); + } + } + + Collections.reverse(orderedTimes); + + return orderedTimes; + } + } + } catch (Exception e) { + statusHandler.debug("No ordered times available..." + + getSourceName()); + return null; + } + + return null; + } + + public String getSourceName() { + return sourceName; + } + /* * clean up old junk */ @@ -466,12 +441,86 @@ public class FFMPDataContainer { } } + /** + * maybe this will work + * + * @param basins + * @param hucName + */ + public void setBasinBuddyData(FFMPBasinData basins, String hucName) { + + for (Entry entry : basins.getBasins().entrySet()) { + FFMPBasin basin = getBasinData(hucName).get(entry.getKey()); + if (basin != null) { + if (basin instanceof FFMPGuidanceBasin) { + FFMPGuidanceBasin gbasin = (FFMPGuidanceBasin) basin; + gbasin.getGuidValues().putAll( + ((FFMPGuidanceBasin) entry.getValue()) + .getGuidValues()); + } else { + basin.getValues().putAll(entry.getValue().getValues()); + } + } else { + syncPut(getBasinData(hucName), entry.getKey(), entry.getValue()); + //getBasinData(hucName).put(entry.getKey(), entry.getValue()); + } + } + } + + /** + * Add a brand new one for new source, or initialization + * + * @param basins + */ + public void setBasinData(String huc, FFMPBasinData fftiData) { + basinDataMap.put(huc, fftiData); + } + public void setFilePath(String filePath) { this.filePath = filePath; } - public String getFilePath() { - return filePath; + public void setSourceName(String sourceName) { + this.sourceName = sourceName; } + /** + * check for size + * + * @param date + * @return + */ + public int size() { + + HashMap basins = getBasinData("ALL").getBasins(); + + synchronized (basins) { + for (Entry entry : basins.entrySet()) { + FFMPBasin basin = entry.getValue(); + if (basin instanceof FFMPGuidanceBasin) { + return ((FFMPGuidanceBasin) basin).getGuidValues().size(); + } else { + return basin.getValues().size(); + } + } + } + return 0; + } + + /** + * DR 15471 lock put() to avoid ConcurrentModificationException + */ + + private void syncPut(FFMPBasinData fbd, Long key, FFMPBasin value){ + if(fbd==null || key==null) + return; + + HashMap basins = fbd.getBasins(); + if(basins == null) + return; + + synchronized (basins) { + basins.put(key, value); + } + } } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grib/src/com/raytheon/uf/common/dataplugin/grib/request/DeleteAllModelDataRequest.java b/edexOsgi/com.raytheon.uf.common.dataplugin.grib/src/com/raytheon/uf/common/dataplugin/grib/request/DeleteAllModelDataRequest.java new file mode 100644 index 0000000000..1054cab501 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grib/src/com/raytheon/uf/common/dataplugin/grib/request/DeleteAllModelDataRequest.java @@ -0,0 +1,78 @@ +/** + * This software was developed and / or modified by Raytheon Company, + * pursuant to Contract DG133W-05-CQ-1067 with the US Government. + * + * U.S. EXPORT CONTROLLED TECHNICAL DATA + * This software product contains export-restricted data whose + * export/transfer/disclosure is restricted by U.S. law. Dissemination + * to non-U.S. persons whether in the United States or abroad requires + * an export license or other authorization. + * + * Contractor Name: Raytheon Company + * Contractor Address: 6825 Pine Street, Suite 340 + * Mail Stop B8 + * Omaha, NE 68106 + * 402.291.0100 + * + * See the AWIPS II Master Rights File ("Master Rights File.pdf") for + * further licensing information. + **/ +package com.raytheon.uf.common.dataplugin.grib.request; + +import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; +import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; +import com.raytheon.uf.common.serialization.comm.IServerRequest; + +/** + * Request object used to delete all stored data for the specified model name. + * + *
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * May 25, 2012            dgilling     Initial creation
+ * 
+ * 
+ * + * @author dgilling + * @version 1.0 + */ + +@DynamicSerialize +public class DeleteAllModelDataRequest implements IServerRequest { + + @DynamicSerializeElement + private String modelName; + + public DeleteAllModelDataRequest() { + this(null); + } + + public DeleteAllModelDataRequest(String modelName) { + this.modelName = modelName; + } + + public String getModelName() { + return modelName; + } + + public void setModelName(String modelName) { + this.modelName = modelName; + } + + /* + * (non-Javadoc) + * + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("DeleteAllModelDataRequest [modelName="); + builder.append(modelName); + builder.append("]"); + return builder.toString(); + } +} diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grib/src/com/raytheon/uf/common/dataplugin/grib/spatial/projections/GridCoverage.java b/edexOsgi/com.raytheon.uf.common.dataplugin.grib/src/com/raytheon/uf/common/dataplugin/grib/spatial/projections/GridCoverage.java index dc17fb6cd2..e6fc0f1667 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.grib/src/com/raytheon/uf/common/dataplugin/grib/spatial/projections/GridCoverage.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grib/src/com/raytheon/uf/common/dataplugin/grib/spatial/projections/GridCoverage.java @@ -377,8 +377,8 @@ public abstract class GridCoverage extends PersistableDataObject implements if (gridGeometry == null) { gridGeometry = MapUtil.getGridGeometry(this); } - - return gridGeometry; + + return gridGeometry; } public void setGridGeometry(GridGeometry2D gridGeometry) { @@ -595,6 +595,20 @@ public abstract class GridCoverage extends PersistableDataObject implements maxLon -= 1.0E-12; minLon += 1.0E-12; } + + // Normalize the range by shifting 360 degrees to bring the range + // within +/-360 degree as much as possible. For example the + // Canadian-NH model gets calculated as 179.7 to 540.3 but it + // works better to use -180.3 to 180.3. + while (minLon > 0 && maxLon > 360) { + minLon -= 360; + maxLon -= 360; + } + // Normalize the low end. + while (minLon < -360 && maxLon < 0) { + minLon += 360; + maxLon += 360; + } try { geometry = MapUtil.createGeometry(minLat, minLon, maxLat, maxLon); @@ -743,7 +757,8 @@ public abstract class GridCoverage extends PersistableDataObject implements if (isSubGridded()) { String subGridName = getName(); int index = subGridName.lastIndexOf(SUBGRID_TOKEN); - if (index >= 0 && index + SUBGRID_TOKEN.length() < subGridName.length()) { + if (index >= 0 + && index + SUBGRID_TOKEN.length() < subGridName.length()) { model = subGridName.substring(index + SUBGRID_TOKEN.length()); } } diff --git a/edexOsgi/com.raytheon.uf.common.dataplugin.grib/src/com/raytheon/uf/common/dataplugin/grib/spatial/projections/LatLonGridCoverage.java b/edexOsgi/com.raytheon.uf.common.dataplugin.grib/src/com/raytheon/uf/common/dataplugin/grib/spatial/projections/LatLonGridCoverage.java index f384ad2476..9cc4dffd6b 100644 --- a/edexOsgi/com.raytheon.uf.common.dataplugin.grib/src/com/raytheon/uf/common/dataplugin/grib/spatial/projections/LatLonGridCoverage.java +++ b/edexOsgi/com.raytheon.uf.common.dataplugin.grib/src/com/raytheon/uf/common/dataplugin/grib/spatial/projections/LatLonGridCoverage.java @@ -97,7 +97,16 @@ public class LatLonGridCoverage extends GridCoverage { double maxLon = minLon + dx * nx; double centralMeridian = (minLon + maxLon) / 2.0; - centralMeridian = MapUtil.correctLon(centralMeridian); + if (dx * nx <= 360) { + centralMeridian = MapUtil.correctLon(centralMeridian); + } else { + // For almost all map projections geotools will clip all math + // transforms to be within +-180 of the central meridian. For grids + // that wrap around the world more than once this is a problem. When + // the central Meridian is 0.0 then geotools does not do this + // clipping, which works much better. + centralMeridian = 0.0; + } crs = MapUtil.constructEquidistantCylindrical( MapUtil.AWIPS_EARTH_RADIUS, MapUtil.AWIPS_EARTH_RADIUS, centralMeridian, 0); diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/MapUtil.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/MapUtil.java index 8bfba07b62..f71f344d93 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/MapUtil.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/MapUtil.java @@ -385,11 +385,28 @@ public class MapUtil { LATLON_PROJECTION, false); ReferencedEnvelope newTargetREnv = targetREnv.transform( LATLON_PROJECTION, false); - + com.vividsolutions.jts.geom.Envelope intersection = newTargetREnv + .intersection(newSourceEnv); + // Its possible to get two envelopes that don't intersect in a common + // space, for example one could have longitude from -200 to -160 and + // another could have longitude from 160 to 200. Even though these are + // the same range, they don't intersect. These two loops will shift the + // data 360 degrees in the x direction until all intersections are + // found. + while (newSourceEnv.getMaxX() > newTargetREnv.getMinX()) { + newSourceEnv.translate(-360, 0); + intersection.expandToInclude(newTargetREnv + .intersection(newSourceEnv)); + } + while (newSourceEnv.getMinX() < newTargetREnv.getMaxX()) { + newSourceEnv.translate(360, 0); + intersection.expandToInclude(newTargetREnv + .intersection(newSourceEnv)); + } // Get the newEnvelope ReferencedEnvelope newEnv = new ReferencedEnvelope(JTS.getEnvelope2D( - newTargetREnv.intersection(newSourceEnv), LATLON_PROJECTION), - LATLON_PROJECTION); + intersection, LATLON_PROJECTION), LATLON_PROJECTION); + newEnv = newEnv.transform(targetCRS, false, 500); // Calculate nx and ny, start with the number of original grid // points in the intersection and then adjust to the new aspect diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AbstractDataWrapper.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AbstractDataWrapper.java index a61e87f9fd..0718924553 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AbstractDataWrapper.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/interpolation/data/AbstractDataWrapper.java @@ -27,8 +27,6 @@ import org.opengis.referencing.crs.CoordinateReferenceSystem; import org.opengis.referencing.datum.PixelInCell; import org.opengis.referencing.operation.MathTransform; -import com.raytheon.uf.common.geospatial.MapUtil; - /** * * Abstract class for any data implementation that can act as both a source and @@ -132,18 +130,45 @@ public abstract class AbstractDataWrapper implements DataSource, .getGridToCRS(PixelInCell.CELL_CENTER); MathTransform crs2LatLon = CRS.findMathTransform(sourceCRS, DefaultGeographicCRS.WGS84); + // Although theoretically any two points would yield the same + // result, nx is chosen as the x coordinate because it overcomes + // some of the normalization performed in geotools math transforms. + // For most math transforms, geotools will normalize the LatLon + // values into into the range centralMeridian +/- 180. In these + // cases the 360 degree shift performed later is completely + // worthless since geotools will normalize the points into the + // same range regardless of how it is shifted. For a worldwide grid + // the nx coordinate is guaranteed to be just slightly over the + // normalized range, so that when the transform normalizes it will + // use a point that is -360 degrees away from the original point. + // This means that even though the -360 degree shift we apply is + // worthless, the normalization process actually applies an + // equivelant shift that yields the correct result. The end result + // is that whether the transform normalizes or not there is always a + // shift of -360 degrees for all worldwide grids. + + // Start with two points in grid space, one on each corner side of + // the y direction. DirectPosition2D corner1 = new DirectPosition2D(nx, 0); DirectPosition2D corner2 = new DirectPosition2D(nx, ny - 1); + // transform the points to crs space. grid2crs.transform(corner1, corner1); grid2crs.transform(corner2, corner2); + // and then to latLon space crs2LatLon.transform(corner1, corner1); crs2LatLon.transform(corner2, corner2); - corner1.x = MapUtil.correctLon(corner1.x); - corner2.x = MapUtil.correctLon(corner2.x); + // shift the points by 360 degrees because the goal is to know how + // many grid cells exist in one 360 roll of longitude. + corner1.x = corner1.x - 360; + corner2.x = corner2.x - 360; + // transform back to crs. crs2LatLon.inverse().transform(corner1, corner1); crs2LatLon.inverse().transform(corner2, corner2); + // and back to grid space grid2crs.inverse().transform(corner1, corner1); grid2crs.inverse().transform(corner2, corner2); + // the difference between the starting x value and the current x + // value is the number int sourceWrapX = (int) (nx - corner1.x); // In order to wrap then the transformed point x value should be // on the other side of the grid and the y value should not have diff --git a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/util/WorldWrapCorrector.java b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/util/WorldWrapCorrector.java index 866b9f10ef..e285c50fcb 100644 --- a/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/util/WorldWrapCorrector.java +++ b/edexOsgi/com.raytheon.uf.common.geospatial/src/com/raytheon/uf/common/geospatial/util/WorldWrapCorrector.java @@ -121,74 +121,85 @@ public class WorldWrapCorrector { gf.createLinearRing(extRing.getCoordinates()), null); // World wrap correct exterior ring and extract polygons double[] offsets = flattenGeometry(extPolygon); - List extRings = new ArrayList(); - correct(extRings, extPolygon, offsets); - List polygons = new ArrayList(); - for (Geometry geom : extRings) { - extractPolygons(polygons, geom); - } + if (offsets != null) { + // This polygon needs to be corrected, process + List extRings = new ArrayList(); + correct(extRings, extPolygon, offsets); + List polygons = new ArrayList(); + for (Geometry geom : extRings) { + extractPolygons(polygons, geom); + } - // World wrap correct each interior ring - List intRings = new ArrayList( - p.getNumInteriorRing()); - for (int n = 0; n < p.getNumInteriorRing(); ++n) { - Polygon intRing = gf.createPolygon(gf.createLinearRing(p - .getInteriorRingN(n).getCoordinates()), null); - offsets = flattenGeometry(intRing); - correct(intRings, intRing, offsets); - } + // World wrap correct each interior ring + List intRings = new ArrayList( + p.getNumInteriorRing()); + for (int n = 0; n < p.getNumInteriorRing(); ++n) { + Polygon intRing = gf.createPolygon(gf + .createLinearRing(p.getInteriorRingN(n) + .getCoordinates()), null); + offsets = flattenGeometry(intRing); + correct(intRings, intRing, offsets); + } - // Extract polygons and "preprare" them for intersections - List interiorPolygons = new LinkedList(); - for (Geometry geom : intRings) { - extractPolygons(interiorPolygons, geom); - } - List preparedInteriorPolygons = new LinkedList(); - for (Polygon intPoly : interiorPolygons) { - preparedInteriorPolygons.add(PreparedGeometryFactory - .prepare(intPoly)); - } + // Extract polygons and "preprare" them for intersections + List interiorPolygons = new LinkedList(); + for (Geometry geom : intRings) { + extractPolygons(interiorPolygons, geom); + } + List preparedInteriorPolygons = new LinkedList(); + for (Polygon intPoly : interiorPolygons) { + preparedInteriorPolygons.add(PreparedGeometryFactory + .prepare(intPoly)); + } - // Final polygon list (may create multipolygon out of) - List finalPolys = new ArrayList( - polygons.size()); - for (Polygon polygon : polygons) { - // For each polygon, check if it intersects any interior - // polygons. If so, add them to interior ring list so we - // can reconstruct with them in place - List interiorRings = new ArrayList(); - Iterator preparedIntPolys = preparedInteriorPolygons - .iterator(); - while (preparedIntPolys.hasNext()) { - PreparedGeometry prepIntPoly = preparedIntPolys.next(); - boolean intersects = prepIntPoly.intersects(polygon); - if (intersects) { - preparedIntPolys.remove(); - interiorRings.add(gf - .createLinearRing(((Polygon) prepIntPoly - .getGeometry()).getExteriorRing() - .getCoordinates())); + // Final polygon list (may create multipolygon out of) + List finalPolys = new ArrayList( + polygons.size()); + for (Polygon polygon : polygons) { + // For each polygon, check if it intersects any interior + // polygons. If so, add them to interior ring list so we + // can reconstruct with them in place + List interiorRings = new ArrayList(); + Iterator preparedIntPolys = preparedInteriorPolygons + .iterator(); + while (preparedIntPolys.hasNext()) { + PreparedGeometry prepIntPoly = preparedIntPolys + .next(); + boolean intersects = prepIntPoly + .intersects(polygon); + if (intersects) { + preparedIntPolys.remove(); + interiorRings + .add(gf.createLinearRing(((Polygon) prepIntPoly + .getGeometry()) + .getExteriorRing() + .getCoordinates())); + } + } + + if (interiorRings.size() > 0) { + // add holes to polygon + polygon = gf.createPolygon(gf + .createLinearRing(polygon.getExteriorRing() + .getCoordinates()), interiorRings + .toArray(new LinearRing[0])); + } + finalPolys.add(polygon); + } + + if (finalPolys.size() > 1) { + // More than one polygon resulting, create MultiPolygon + geoms.add(gf.createMultiPolygon(finalPolys + .toArray(new Polygon[0]))); + } else { + // 1 or 0 polygons, just add to list + for (Polygon polygon : finalPolys) { + geoms.add(polygon); } } - - if (interiorRings.size() > 0) { - // add holes to polygon - polygon = gf.createPolygon(gf.createLinearRing(polygon - .getExteriorRing().getCoordinates()), - interiorRings.toArray(new LinearRing[0])); - } - finalPolys.add(polygon); - } - - if (finalPolys.size() > 1) { - // More than one polygon resulting, create MultiPolygon - geoms.add(gf.createMultiPolygon(finalPolys - .toArray(new Polygon[0]))); } else { - // 1 or 0 polygons, just add to list - for (Polygon polygon : finalPolys) { - geoms.add(polygon); - } + // offsets were null, polygon can be added as is + geoms.add(g); } } else { double[] offsets = flattenGeometry(g); diff --git a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FFMPRetentionTimeManager.java b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FFMPRetentionTimeManager.java index 53732db9e1..36d425abfb 100644 --- a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FFMPRetentionTimeManager.java +++ b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FFMPRetentionTimeManager.java @@ -22,6 +22,7 @@ package com.raytheon.uf.common.monitor.config; import java.io.File; import java.util.ArrayList; +import java.util.List; import java.util.Map; import com.raytheon.uf.common.localization.FileUpdatedMessage; @@ -51,7 +52,7 @@ public class FFMPRetentionTimeManager implements ILocalizationFileObserver { */ protected PurgeRuleSet configXml; - private ArrayList listeners = new ArrayList(); + private final ArrayList listeners = new ArrayList(); /** Singleton instance of this class */ private static FFMPRetentionTimeManager instance = new FFMPRetentionTimeManager(); @@ -166,12 +167,12 @@ public class FFMPRetentionTimeManager implements ILocalizationFileObserver { * @return */ public long getRetentionTime() { + List rules = configXml.getDefaultRules(); - for (PurgeRule rule : configXml.getRules()) { - if (rule.getId().getPluginName().equals("ffmp")) { - return rule.getPeriodInMillis(); - } + if ((rules != null) && !rules.isEmpty()) { + return rules.get(0).getPeriodInMillis(); } + return 0l; } @@ -181,12 +182,18 @@ public class FFMPRetentionTimeManager implements ILocalizationFileObserver { * @param time */ public void setRetentionTime(String time) { - for (PurgeRule rule : configXml.getRules()) { - if (rule.getId().getPluginName().equals("ffmp")) { - rule.setPeriod(time); - } + List rules = configXml.getDefaultRules(); + PurgeRule rule = null; + + if ((rules == null) || rules.isEmpty()) { + rule = new PurgeRule(); + configXml.setDefaultRule(rule); + } else { + rule = rules.get(0); } + rule.setPeriod(time); + saveConfigXml(); } } diff --git a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FFMPTemplateConfigurationManager.java b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FFMPTemplateConfigurationManager.java index badbfc539f..2ed467a8f8 100644 --- a/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FFMPTemplateConfigurationManager.java +++ b/edexOsgi/com.raytheon.uf.common.monitor/src/com/raytheon/uf/common/monitor/config/FFMPTemplateConfigurationManager.java @@ -45,7 +45,7 @@ import com.raytheon.uf.common.serialization.SerializationUtil; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Feb 12, 2009 lvenable Initial creation - * + * Oct 25, 2012 DR 15514 gzhang Adding getHucLevelsInArray() * * * @author dhladky @@ -259,4 +259,43 @@ public class FFMPTemplateConfigurationManager implements } } + /** + * DR 15514: based on getHucLevels() + */ + public String[] getHucLevelsInArray() { + + Integer hucNum = 4; + Boolean isVirtual = true; + String[] result = null; + java.util.concurrent.locks.ReentrantLock lock = new java.util.concurrent.locks.ReentrantLock(); + + synchronized(configXml){ + hucNum = getNumberOfHuc(); + isVirtual = getVirtual(); + } + + lock.lock(); + try{ + java.util.List list = new ArrayList(); + list.add("ALL"); + list.add("COUNTY"); + + if(isVirtual){ + list.add("VIRTUAL"); + } + + for (int i = hucNum - 1; i >= 0; i--){ + list.add("HUC"+i); + } + + result = list.toArray(new String[]{}); + + }finally{ + if(result==null) result = new String[]{};// guaranteed not null + lock.unlock(); + } + + return result; + } + } diff --git a/edexOsgi/com.raytheon.uf.common.pypies/src/com/raytheon/uf/common/pypies/PyPiesDataStore.java b/edexOsgi/com.raytheon.uf.common.pypies/src/com/raytheon/uf/common/pypies/PyPiesDataStore.java index 64c6a7a498..5f5e864c21 100644 --- a/edexOsgi/com.raytheon.uf.common.pypies/src/com/raytheon/uf/common/pypies/PyPiesDataStore.java +++ b/edexOsgi/com.raytheon.uf.common.pypies/src/com/raytheon/uf/common/pypies/PyPiesDataStore.java @@ -3,10 +3,12 @@ package com.raytheon.uf.common.pypies; import java.io.File; import java.io.FileNotFoundException; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import java.util.Map; import com.raytheon.uf.common.comm.HttpClient; +import com.raytheon.uf.common.datastorage.DuplicateRecordStorageException; import com.raytheon.uf.common.datastorage.IDataStore; import com.raytheon.uf.common.datastorage.Request; import com.raytheon.uf.common.datastorage.StorageException; @@ -277,13 +279,37 @@ public class PyPiesDataStore implements IDataStore { StorageStatus ss = null; try { StoreResponse sr = (StoreResponse) sendRequest(req); - records.clear(); ss = sr.getStatus(); String[] exc = sr.getExceptions(); IDataRecord[] failed = sr.getFailedRecords(); + + // need to set the correlation object + if (failed != null) { + for (IDataRecord rec : failed) { + Iterator recordIter = records.iterator(); + while (recordIter.hasNext()) { + IDataRecord oldRec = recordIter.next(); + if (oldRec.getGroup().equals(rec.getGroup()) + && oldRec.getName().equals(rec.getName())) { + rec.setCorrelationObject(oldRec + .getCorrelationObject()); + recordIter.remove(); + break; + } + } + } + } + + records.clear(); StorageException[] jexc = new StorageException[exc.length]; for (int i = 0; i < exc.length; i++) { - jexc[i] = new StorageException(exc[i], failed[i]); + // checking for duplicates based on what is in the string... + if (exc[i].contains("already exists")) { + jexc[i] = new DuplicateRecordStorageException(exc[i], + failed[i]); + } else { + jexc[i] = new StorageException(exc[i], failed[i]); + } } ss.setExceptions(jexc); @@ -369,10 +395,6 @@ public class PyPiesDataStore implements IDataStore { protected void initializeProperties() { if (address == null) { address = props.getAddress(); - int maxConnections = props.getMaxConnections(); - HttpClient.getInstance().setMaxConnectionsPerHost(maxConnections); - int socketTimeout = props.getSocketTimeout(); - HttpClient.getInstance().setSocketTimeout(socketTimeout); } } diff --git a/edexOsgi/com.raytheon.uf.common.pypies/src/com/raytheon/uf/common/pypies/PypiesProperties.java b/edexOsgi/com.raytheon.uf.common.pypies/src/com/raytheon/uf/common/pypies/PypiesProperties.java index 92cba8ce73..56691b35af 100644 --- a/edexOsgi/com.raytheon.uf.common.pypies/src/com/raytheon/uf/common/pypies/PypiesProperties.java +++ b/edexOsgi/com.raytheon.uf.common.pypies/src/com/raytheon/uf/common/pypies/PypiesProperties.java @@ -41,10 +41,6 @@ public class PypiesProperties extends DataStoreProperties { private String address; - private int maxConnections; - - private int socketTimeout = 120000; - public String getAddress() { return address; } @@ -53,20 +49,4 @@ public class PypiesProperties extends DataStoreProperties { this.address = address; } - public int getMaxConnections() { - return maxConnections; - } - - public void setMaxConnections(int maxConnections) { - this.maxConnections = maxConnections; - } - - public int getSocketTimeout() { - return socketTimeout; - } - - public void setSocketTimeout(int socketTimeout) { - this.socketTimeout = socketTimeout; - } - } diff --git a/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/DynamicSerializationManager.java b/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/DynamicSerializationManager.java index 5ae07f3ebb..f2e5ddc33b 100644 --- a/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/DynamicSerializationManager.java +++ b/edexOsgi/com.raytheon.uf.common.serialization/src/com/raytheon/uf/common/serialization/DynamicSerializationManager.java @@ -80,6 +80,9 @@ import com.vividsolutions.jts.geom.Geometry; * Date Ticket# Engineer Description * ------------ ---------- ----------- -------------------------- * Aug 13, 2008 #1448 chammack Initial creation + * Oct 08, 2012 #1251 dgilling Ensure type registered with + * serialization adapter is encoded + * in serialization stream. * * * @@ -311,11 +314,10 @@ public class DynamicSerializationManager { if (attribs.serializationFactory == null) { Class superClazz = c.getSuperclass(); while (superClazz != null && attribs.serializationFactory == null) { - SerializationMetadata superMd = serializedAttributes - .get(superClazz.getName()); + SerializationMetadata superMd = inspect(superClazz); if (superMd != null && superMd.serializationFactory != null) { attribs.serializationFactory = superMd.serializationFactory; - attribs.adapterStructName = c.getName(); + attribs.adapterStructName = superMd.adapterStructName; } superClazz = superClazz.getSuperclass(); } diff --git a/edexOsgi/com.raytheon.uf.edex.database/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject b/edexOsgi/com.raytheon.uf.edex.database/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject index f0c95e8943..23c5a8e3df 100644 --- a/edexOsgi/com.raytheon.uf.edex.database/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject +++ b/edexOsgi/com.raytheon.uf.edex.database/META-INF/services/com.raytheon.uf.common.serialization.ISerializableObject @@ -2,5 +2,4 @@ com.raytheon.uf.edex.database.cluster.ClusterTask com.raytheon.uf.edex.database.cluster.ClusterTaskPK com.raytheon.uf.edex.database.plugin.PluginVersion com.raytheon.uf.edex.database.purge.PurgeRule -com.raytheon.uf.edex.database.purge.PurgeRulePK com.raytheon.uf.edex.database.purge.PurgeRuleSet \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/PluginDao.java b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/PluginDao.java index dffee34d7e..0ed4d3a658 100644 --- a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/PluginDao.java +++ b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/PluginDao.java @@ -30,6 +30,7 @@ import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; @@ -68,7 +69,6 @@ import com.raytheon.uf.edex.database.dao.CoreDao; import com.raytheon.uf.edex.database.dao.DaoConfig; import com.raytheon.uf.edex.database.purge.PurgeLogger; import com.raytheon.uf.edex.database.purge.PurgeRule; -import com.raytheon.uf.edex.database.purge.PurgeRulePK; import com.raytheon.uf.edex.database.purge.PurgeRuleSet; import com.raytheon.uf.edex.database.query.DatabaseQuery; @@ -444,13 +444,20 @@ public abstract class PluginDao extends CoreDao { public void purgeAllData() throws PluginException { try { List allRefTimes = getRefTimes(); - Set roundedRefTimes = new HashSet(); + Map> filesToDelete = new HashMap>(); for (Date d : allRefTimes) { - this.purgeDataByRefTime(d, ""); - roundedRefTimes.add(roundDateToHour(d)); + this.purgeDataByRefTime(d, null, true, false, filesToDelete); } - for (Date d : roundedRefTimes) { - this.purgeHDF5DataByRefTime(d, ""); + for (String file : filesToDelete.keySet()) { + try { + IDataStore ds = DataStoreFactory + .getDataStore(new File(file)); + ds.deleteFiles(null); + } catch (Exception e) { + PurgeLogger.logError( + "Error occurred purging file: " + file, + this.pluginName, e); + } } } catch (Exception e) { throw new PluginException("Error purging all data for " @@ -466,366 +473,31 @@ public abstract class PluginDao extends CoreDao { */ public void purgeExpiredData() throws PluginException { try { - PluginDao pluginDao = PluginFactory.getInstance().getPluginDao( - pluginName); - List ruleList = new ArrayList(); - ruleList.addAll(getPurgeRulesForPlugin(pluginName)); + PurgeRuleSet ruleSet = getPurgeRulesForPlugin(pluginName); - /* - * This section generates default rules for data not addressed by - * the rule set accompanying this plugin. This prevents orphaned - * data. - */ - Set keysWithoutRules = new HashSet(); + if (ruleSet == null) { + PurgeLogger.logInfo( + "No valid purge rules found. Skipping purge.", + pluginName); + return; + } // Query the database to get all possible product keys for this data - // and assume they have no rules associated with them - keysWithoutRules.addAll(getDistinctProductKeys()); - Set keysWithRules = new HashSet(); - PurgeRule pluginDefaultRule = null; - - // Get the default rule for this plugin if it specifies one. - for (PurgeRule rule : ruleList) { - if (rule.getId().getKey().equals("default")) { - pluginDefaultRule = rule; - continue; - } - keysWithRules.add(rule.getId().getKey()); - } - - // If this plugin does not specify a default rule, the system - // default will be used - if (pluginDefaultRule == null) { - pluginDefaultRule = loadDefaultPurgeRule(); - if (pluginDefaultRule == null) { - PurgeLogger.logError("Unable to purge plugin", pluginName); - } - } else { - ruleList.remove(pluginDefaultRule); - } - - // Remove the keys we have determined to have rules associated with - // them - keysWithoutRules.removeAll(keysWithRules); - - // If keys remain without rules, we iterate over them and assign the - // default rule - if (!keysWithoutRules.isEmpty()) { - PurgeLogger.logWarn("Data exists with no purge rule.", - pluginName); - for (String keyNeedingRule : keysWithoutRules) { - PurgeLogger.logWarn( - "Generated default purge rule for key: " - + keyNeedingRule, pluginName); - PurgeRule newRule = (PurgeRule) pluginDefaultRule.clone(); - newRule.getId().setPluginName(pluginName); - newRule.getId().setKey(keyNeedingRule); - ruleList.add(newRule); - } - } - - // If no purge rules are specified for this plugin, we assign the - // default rule so data for this plugin is still purged - if (ruleList.isEmpty()) { - PurgeLogger.logWarn("No purge rules specified. Using default", - pluginName); - pluginDefaultRule.getId().setPluginName(pluginName); - pluginDefaultRule.getId().setKey(""); - ruleList.add(pluginDefaultRule); - } - - // Map containing the times to retain for each rule - Map> timesToKeep = new HashMap>(); - - // Map containing the times to purge for each rule - Map> timesToPurge = new HashMap>(); - - // Iterate through the rules and determine the times to purge - for (PurgeRule rule : ruleList) { - - // If this rule is not valid, we cannot apply it - if (!isRuleValid(rule)) { - PurgeLogger.logWarn("Ignoring Invalid Rule: " + rule, - this.pluginName); - continue; - } - - // Holds the times kept by this rule - List timesKeptByRule = new ArrayList(); - - Set roundedTimes = new HashSet(); - - // Holds the times to be purged by this rule - List timesPurgedByRule = new ArrayList(); - - PurgeRulePK rulePK = rule.getId(); - if (!timesToKeep.containsKey(rulePK)) { - timesToKeep.put(rulePK, new HashSet()); - } - if (!timesToPurge.containsKey(rulePK)) { - timesToPurge.put(rulePK, new HashSet()); - } - - String key = rulePK.getKey(); - - /* - * This section applies the purge rule - */ - - List refTimesForKey = pluginDao - .getRefTimesForCriteria(key); - - if (rule.isModTimeToWaitSpecified()) { - Date maxInsertTime = pluginDao.getMaxInsertTime(key); - if (maxInsertTime != null) { - long lastInsertTime = maxInsertTime.getTime(); - long currentTime = System.currentTimeMillis(); - if ((currentTime - lastInsertTime) < rule - .getModTimeToWaitInMillis()) { - PurgeLogger - .logInfo( - "For key, " - + key - + ", the most recent version is less than " - + rule.getModTimeToWaitDescription() - + " old. Increasing versions to keep for this key.", - pluginName); - rule.setVersionsToKeep(rule.getVersionsToKeep() + 1); - } - } - } - - // Calculate the period cutoff time if necessary - Date periodCutoffTime = new Date(); - if (rule.isPeriodSpecified()) { - if (rule.isPeriodBasedOnLatestTime()) { - Date maxRefTime = pluginDao.getMaxRefTime(key); - if (maxRefTime == null) { - PurgeLogger.logInfo("No data available to purge", - pluginName); - continue; - } else { - periodCutoffTime = new Date(maxRefTime.getTime() - - rule.getPeriodInMillis()); - } - } else { - periodCutoffTime = new Date(System.currentTimeMillis() - - rule.getPeriodInMillis()); - } - } - - // Filter the keepers by the delta time specified - if (rule.isDeltaSpecified()) { - for (Date refTime : refTimesForKey) { - Date timeToCompare = rule.getRoundedDate(refTime)[1]; - long delta = rule.getDeltaTimeInMillis(); - long dateTimeAsLong = timeToCompare.getTime(); - - if (rule.isDeltaTimeMultiple()) { - if (dateTimeAsLong % delta == 0) { - // If the versions to keep is zero we keep it if - // it does not exceed the period specified, if - // any - if (rule.getVersionsToKeep() == 0) { - if (rule.isPeriodSpecified() - && refTime.before(periodCutoffTime)) { - timesPurgedByRule.add(refTime); - - } else { - timesKeptByRule.add(refTime); - } - } - - // If the versions to keep is not zero and - // adding this will not exceed the specified - // number of versions to keep and it does not - // exceed the period specified, the time is kept - else if (rule.getVersionsToKeep() > 0) { - if (rule.isRoundSpecified()) { - if (roundedTimes.size() < rule - .getVersionsToKeep()) { - roundedTimes.add(timeToCompare); - timesKeptByRule.add(refTime); - } else { - timesPurgedByRule.add(refTime); - } - } else { - if (timesKeptByRule.size() < rule - .getVersionsToKeep()) { - if (rule.isPeriodSpecified() - && refTime - .before(periodCutoffTime)) { - timesPurgedByRule.add(refTime); - } else { - timesKeptByRule.add(refTime); - } - } - } - - } - } else { - timesPurgedByRule.add(refTime); - } - } - } - } - - /* - * If a versions to keep is specified, determine the versions to - * keep. If a delta is specified for this rule, then the - * versions have already been calculated based on the delta - * time. This section is used only if a delta time is not used - */ - else if (!rule.isDeltaSpecified() - && rule.isVersionsToKeepSpecified()) { - Date currentRefTime = null; - for (int i = 0; i < refTimesForKey.size(); i++) { - currentRefTime = refTimesForKey.get(i); - if (i < rule.getVersionsToKeep()) { - if (rule.isPeriodSpecified() - && currentRefTime.before(periodCutoffTime)) { - timesPurgedByRule.add(currentRefTime); - } else { - timesKeptByRule.add(currentRefTime); - } - timesKeptByRule.add(currentRefTime); - } else { - timesPurgedByRule.add(currentRefTime); - } - - } - } - - /* - * This rule only specifies a time cutoff - */ - else if (!rule.isDeltaSpecified() - && !rule.isVersionsToKeepSpecified() - && rule.isPeriodSpecified()) { - for (Date currentRefTime : refTimesForKey) { - if (currentRefTime.before(periodCutoffTime)) { - timesPurgedByRule.add(currentRefTime); - } else { - timesKeptByRule.add(currentRefTime); - } - } - } - - /* - * This rule has been so poorly written that it does nothing - */ - else { - PurgeLogger - .logInfo( - "Purge rule does not specify a delta, period, or versions to keep.", - pluginName); - } - - /* - * If log only is specified, log the results but purge nothing - */ - if (rule.isLogOnly()) { - PurgeLogger.logInfo("Rule is configured to log only", - pluginName); - PurgeLogger.logInfo( - "These version would be removed by the rule:", - pluginName); - Collections.sort(timesPurgedByRule); - Collections.sort(timesKeptByRule); - for (Date d : timesPurgedByRule) { - PurgeLogger.logInfo(d.toString(), pluginName); - } - PurgeLogger - .logInfo( - "These versions would have been retained by the rule:", - pluginName); - for (Date d : timesKeptByRule) { - PurgeLogger.logInfo(d.toString(), pluginName); - } - - } else { - timesToKeep.get(rulePK).addAll(timesKeptByRule); - timesToPurge.get(rulePK).addAll(timesPurgedByRule); - } - - // We must remove the keep times from the purge list. This - // ensures that if the time passes at least one rule, then it - // will be retained - timesToPurge.get(rulePK).removeAll(timesToKeep.get(rulePK)); - } - - // Counter for recording the number of items purged for a given time - int itemsDeletedForTime = 0; - - // The total number of items purged + List ruleKeys = ruleSet.getKeys(); int totalItems = 0; - for (PurgeRulePK purgeKey : timesToPurge.keySet()) { - String key = purgeKey.getKey(); - - int itemsDeletedForKey = 0; - for (Date deleteDate : timesToPurge.get(purgeKey)) { - - // Delete the data in the database - itemsDeletedForTime = pluginDao.purgeDataByRefTime( - deleteDate, key); - - totalItems += itemsDeletedForTime; - itemsDeletedForKey += itemsDeletedForTime; + if ((ruleKeys != null) && !ruleKeys.isEmpty()) { + // Iterate through keys, fully purge each key set + String[][] distinctKeys = getDistinctProductKeyValues(ruleSet + .getKeys()); + for (String[] key : distinctKeys) { + totalItems += purgeExpiredKey(ruleSet, key); } - if (itemsDeletedForKey > 0) { - StringBuilder messageBuffer = new StringBuilder(); - messageBuffer.append("Purged ").append(itemsDeletedForKey) - .append(" item"); - if (itemsDeletedForKey != 1) { - messageBuffer.append("s"); - } - if (key.equals("default")) { - messageBuffer.append(" for default key"); - } else if (!key.isEmpty()) { - messageBuffer.append(" for key ").append(key); - } - PurgeLogger.logInfo(messageBuffer.toString(), pluginName); - } - boolean purgeHDF5Data = false; - try { - // Determine if this plugin uses HDF5 to store data - purgeHDF5Data = (PluginFactory.getInstance() - .getPluginRecordClass(pluginName).newInstance() instanceof IPersistable); - } catch (Exception e) { - throw new DataAccessLayerException( - "Error instantiating plugin record class!", e); - } - if (purgeHDF5Data) { - - /* - * If this plugin stores data in HDF5, we must round the - * times to hour granularity since the files are named to - * the hour. Rounding the time allows us to delete files - * instead of deleting individual records from the HDF5 - * file. - */ - Set roundedTimesToPurge = new HashSet(); - Set roundedTimesToKeep = new HashSet(); - - for (Date dateToRound : timesToKeep.get(purgeKey)) { - roundedTimesToKeep.add(roundDateToHour(dateToRound)); - } - for (Date dateToRound : timesToPurge.get(purgeKey)) { - roundedTimesToPurge.add(roundDateToHour(dateToRound)); - } - - // Make sure not files are erroneously purged - roundedTimesToPurge.removeAll(roundedTimesToKeep); - - // Delete the HDF5 files that are no longer referenced - for (Date deleteDate : roundedTimesToPurge) { - this.purgeHDF5DataByRefTime(deleteDate, - purgeKey.getKey()); - } - } - + } else { + // no rule keys defined, can only apply default rule + totalItems += purgeExpiredKey(ruleSet, null); } + StringBuilder messageBuffer = new StringBuilder(); messageBuffer.append("Purged ").append(totalItems).append(" item"); if (totalItems != 1) { @@ -834,35 +506,394 @@ public abstract class PluginDao extends CoreDao { messageBuffer.append(" total."); PurgeLogger.logInfo(messageBuffer.toString(), pluginName); + } catch (EdexException e) { + throw new PluginException("Error applying purge rule!!", e); + } + } - // Debug output to see which times were retained - if (PurgeLogger.isDebugEnabled()) { - for (PurgeRulePK purgeKey : timesToKeep.keySet()) { - List keepers = new ArrayList(); - keepers.addAll(timesToKeep.get(purgeKey)); - if (!keepers.isEmpty()) { - StringBuilder builder = new StringBuilder(); - Collections.sort(keepers); - builder.append("The following times were retained"); - if (purgeKey.getKey().isEmpty()) { - builder.append(":"); - } else { - builder.append(" for key ") - .append(purgeKey.getKey()).append(":"); - } + /** + * Takes the purgeKeys, looks up the associated purge rule, and applies it + * to the data matched by purgeKeys. + * + * @param ruleSet + * @param purgeKeys + * @return Number of records purged + * @throws DataAccessLayerException + */ + protected int purgeExpiredKey(PurgeRuleSet ruleSet, String[] purgeKeys) + throws DataAccessLayerException { + List rules = ruleSet.getRuleForKeys(purgeKeys); - for (Date keepDate : keepers) { - builder.append("[").append(keepDate).append("]") - .append(" "); - } - PurgeLogger.logDebug(builder.toString(), pluginName); + if (rules == null) { + PurgeLogger.logWarn( + "No rules found for purgeKeys: " + + Arrays.toString(purgeKeys), pluginName); + return 0; + } + + /* + * This section applies the purge rule + */ + Map productKeys = null; + if (purgeKeys != null) { + productKeys = new LinkedHashMap(purgeKeys.length); + Iterator iter = ruleSet.getKeys().iterator(); + for (String purgeKey : purgeKeys) { + productKeys.put(iter.next(), purgeKey); + } + } + + List refTimesForKey = getRefTimesForCriteria(productKeys); + String productKeyString = null; + if (productKeys != null) { + StringBuilder productKeyBuilder = new StringBuilder(); + for (Map.Entry pair : productKeys.entrySet()) { + productKeyBuilder.append('[').append(pair.getKey()).append('=') + .append(pair.getValue()).append(']'); + } + productKeyString = productKeyBuilder.toString(); + } + + Set timesKept = new HashSet(); + Set timesPurged = new HashSet(); + + for (PurgeRule rule : rules) { + // Holds the times kept by this rule + List timesKeptByRule = new ArrayList(); + + Set roundedTimes = new HashSet(); + + // Holds the times to be purged by this rule + List timesPurgedByRule = new ArrayList(); + + if (rule.isModTimeToWaitSpecified()) { + Date maxInsertTime = getMaxInsertTime(productKeys); + if (maxInsertTime != null) { + long lastInsertTime = maxInsertTime.getTime(); + long currentTime = System.currentTimeMillis(); + if ((currentTime - lastInsertTime) < rule + .getModTimeToWaitInMillis()) { + PurgeLogger + .logInfo( + "For procuct key, " + + productKeyString + + ", the most recent version is less than " + + rule.getModTimeToWaitDescription() + + " old. Increasing versions to keep for this key.", + pluginName); + rule.setVersionsToKeep(rule.getVersionsToKeep() + 1); } } } - } catch (EdexException e) { - throw new PluginException("Error applying purge rule!!", e); + // Calculate the period cutoff time if necessary + Date periodCutoffTime = new Date(); + if (rule.isPeriodSpecified()) { + if (rule.isPeriodBasedOnLatestTime()) { + Date maxRefTime = getMaxRefTime(productKeys); + if (maxRefTime == null) { + PurgeLogger.logInfo("No data available to purge", + pluginName); + return 0; + } else { + periodCutoffTime = new Date(maxRefTime.getTime() + - rule.getPeriodInMillis()); + } + } else { + periodCutoffTime = new Date(System.currentTimeMillis() + - rule.getPeriodInMillis()); + } + } + + // Filter the keepers by the delta time specified + if (rule.isDeltaSpecified()) { + for (Date refTime : refTimesForKey) { + Date timeToCompare = rule.getRoundedDate(refTime)[1]; + long delta = rule.getDeltaTimeInMillis(); + long dateTimeAsLong = timeToCompare.getTime(); + + if (rule.isDeltaTimeMultiple()) { + if (dateTimeAsLong % delta == 0) { + // If the versions to keep is zero we keep it if + // it does not exceed the period specified, if + // any + if (rule.getVersionsToKeep() == 0) { + if (rule.isPeriodSpecified() + && refTime.before(periodCutoffTime)) { + timesPurgedByRule.add(refTime); + + } else { + timesKeptByRule.add(refTime); + } + } + + // If the versions to keep is not zero and + // adding this will not exceed the specified + // number of versions to keep and it does not + // exceed the period specified, the time is kept + else if (rule.getVersionsToKeep() > 0) { + if (rule.isRoundSpecified()) { + if (roundedTimes.size() < rule + .getVersionsToKeep()) { + roundedTimes.add(timeToCompare); + timesKeptByRule.add(refTime); + } else { + timesPurgedByRule.add(refTime); + } + } else { + if (timesKeptByRule.size() < rule + .getVersionsToKeep()) { + if (rule.isPeriodSpecified() + && refTime + .before(periodCutoffTime)) { + timesPurgedByRule.add(refTime); + } else { + timesKeptByRule.add(refTime); + } + } + } + + } + } else { + timesPurgedByRule.add(refTime); + } + } + } + } + + /* + * If a versions to keep is specified, determine the versions to + * keep. If a delta is specified for this rule, then the versions + * have already been calculated based on the delta time. This + * section is used only if a delta time is not used + */ + else if (!rule.isDeltaSpecified() + && rule.isVersionsToKeepSpecified()) { + Date currentRefTime = null; + for (int i = 0; i < refTimesForKey.size(); i++) { + currentRefTime = refTimesForKey.get(i); + if (i < rule.getVersionsToKeep()) { + if (rule.isPeriodSpecified() + && currentRefTime.before(periodCutoffTime)) { + timesPurgedByRule.add(currentRefTime); + } else { + timesKeptByRule.add(currentRefTime); + } + timesKeptByRule.add(currentRefTime); + } else { + timesPurgedByRule.add(currentRefTime); + } + + } + /* + * This rule only specifies a time cutoff + */ + } else if (!rule.isDeltaSpecified() + && !rule.isVersionsToKeepSpecified() + && rule.isPeriodSpecified()) { + for (Date currentRefTime : refTimesForKey) { + if (currentRefTime.before(periodCutoffTime)) { + timesPurgedByRule.add(currentRefTime); + } else { + timesKeptByRule.add(currentRefTime); + } + } + /* + * This rule has been so poorly written that it does nothing + */ + } else { + PurgeLogger + .logInfo( + "Purge rule does not specify a delta, period, or versions to keep.", + pluginName); + } + + /* + * If log only is specified, log the results but purge nothing + */ + if (rule.isLogOnly()) { + PurgeLogger.logInfo("Rule is configured to log only", + pluginName); + PurgeLogger.logInfo( + "These version would be removed by the rule:", + pluginName); + Collections.sort(timesPurgedByRule); + Collections.sort(timesKeptByRule); + for (Date d : timesPurgedByRule) { + PurgeLogger.logInfo(d.toString(), pluginName); + } + PurgeLogger.logInfo( + "These versions would have been retained by the rule:", + pluginName); + for (Date d : timesKeptByRule) { + PurgeLogger.logInfo(d.toString(), pluginName); + } + } else { + timesKept.addAll(timesKeptByRule); + timesPurged.addAll(timesPurgedByRule); + } } + + // We must remove the keep times from the purge list. This + // ensures that if the time passes at least one time constraint, + // then it will be retained + timesPurged.removeAll(timesKept); + + int itemsDeletedForKey = 0; + List orderedTimesPurged = new ArrayList(timesPurged); + Collections.sort(orderedTimesPurged); + + // flags to control how hdf5 is purged and what needs to be returned + // from the database purge to properly purge hdf5. If purging and + // trackToUri is false, hdf5PurgeDates is used to determine if the + // underlying hdf5 data can be kept. This is optimized based on data + // being stored in hourly chunks. + // TODO: Update to allow files to not be in hourly granularity + boolean purgeHdf5Data = false; + boolean trackToUri = false; + Set hdf5PurgeDates = new HashSet(); + + try { + // Determine if this plugin uses HDF5 to store data + purgeHdf5Data = (PluginFactory.getInstance() + .getPluginRecordClass(pluginName).newInstance() instanceof IPersistable); + + // determine if hdf5 purge can be optimized + if (purgeHdf5Data) { + // check how the path keys line up to purge keys + List pathKeys = pathProvider + .getKeyNames(this.pluginName); + boolean pathKeysEmpty = (pathKeys == null) + || pathKeys.isEmpty(); + boolean productKeysEmpty = (productKeys == null) + || (productKeys.isEmpty()); + + // determine if hdf5 purge can be optimized + if (!pathKeysEmpty) { + if (productKeysEmpty) { + // Purging on higher magnitude that path, only need to + // track file + trackToUri = false; + } else if (pathKeys.size() < productKeys.size()) { + // there are more purge keys than path keys, cannot + // optimize hdf5 purge + trackToUri = true; + } else { + // need to compare each key to check for optimized + // purge, + // all productKeys must be a pathKey for optimized + // purge, + // both key lists should be small 3 or less, no need to + // optimize list look ups + trackToUri = false; + for (String productKey : productKeys.keySet()) { + boolean keyMatch = false; + for (String pathKey : pathKeys) { + if (pathKey.equals(productKey)) { + keyMatch = true; + break; + } + } + + if (!keyMatch) { + trackToUri = true; + break; + } + } + } + } else { + // if purge is same level as path, optimize + trackToUri = !productKeysEmpty; + } + + // we can optimize purge, sort dates by hour to determine files + // to drop + if (!trackToUri) { + Set roundedTimesKept = new HashSet(); + + for (Date dateToRound : timesKept) { + roundedTimesKept.add(roundDateToHour(dateToRound)); + } + for (Date dateToRound : timesPurged) { + Date roundedDate = roundDateToHour(dateToRound); + if (!roundedTimesKept.contains(roundedDate)) { + hdf5PurgeDates.add(dateToRound); + } + } + } + } + } catch (Exception e) { + PurgeLogger.logError( + "Unabled to determine if plugin has HDF5 data to purge", + this.pluginName, e); + } + + Map> hdf5FileToUriMap = new HashMap>(); + for (Date deleteDate : orderedTimesPurged) { + boolean purgeHdf5ForRefTime = purgeHdf5Data; + // if we aren't tracking by uri, check hdf5 date map + if (purgeHdf5ForRefTime && !trackToUri) { + purgeHdf5ForRefTime = hdf5PurgeDates.contains(deleteDate); + } + + // Delete the data in the database + int itemsDeletedForTime = purgeDataByRefTime(deleteDate, + productKeys, purgeHdf5ForRefTime, trackToUri, + hdf5FileToUriMap); + + itemsDeletedForKey += itemsDeletedForTime; + } + + if (purgeHdf5Data) { + for (Map.Entry> hdf5Entry : hdf5FileToUriMap + .entrySet()) { + try { + IDataStore ds = DataStoreFactory.getDataStore(new File( + hdf5Entry.getKey())); + List uris = hdf5Entry.getValue(); + if (uris == null) { + ds.deleteFiles(null); + } else { + ds.delete(uris.toArray(new String[uris.size()])); + } + } catch (Exception e) { + PurgeLogger.logError("Error occurred purging file: " + + hdf5Entry.getKey(), this.pluginName, e); + } + } + } + + if (itemsDeletedForKey > 0) { + StringBuilder messageBuffer = new StringBuilder(); + messageBuffer.append("Purged ").append(itemsDeletedForKey) + .append(" item"); + if (itemsDeletedForKey != 1) { + messageBuffer.append("s"); + } + messageBuffer.append(" for key ").append(productKeyString); + PurgeLogger.logInfo(messageBuffer.toString(), pluginName); + } + + // Debug output to see which times were retained + if (PurgeLogger.isDebugEnabled()) { + if (!timesPurged.isEmpty()) { + StringBuilder builder = new StringBuilder(); + List orderedTimesKept = new ArrayList(timesKept); + Collections.sort(orderedTimesPurged); + Collections.sort(orderedTimesKept); + builder.append("The following times were retained"); + builder.append(" for key ").append(productKeyString) + .append(":"); + + for (Date keepDate : orderedTimesKept) { + builder.append("[").append(keepDate).append("]") + .append(" "); + } + PurgeLogger.logDebug(builder.toString(), pluginName); + } + } + + return itemsDeletedForKey; } /** @@ -926,47 +957,55 @@ public abstract class PluginDao extends CoreDao { } /** - * Gets a list of the distinct product keys for this plugin + * Gets a list of the distinct product key values for this plugin. * - * @return The list of distinct product keys for this plugin + * @param the + * keys to look up values for. + * @return 2 dimensional array of distinct values for the given keys. First + * dimension is the row of data, second dimension actual values. * @throws DataAccessLayerException * If errors occur while querying for the data */ @SuppressWarnings("unchecked") - public Set getDistinctProductKeys() throws DataAccessLayerException { - Set distinctKeys = new HashSet(); - List keyFields = this.pathProvider.getKeyNames(pluginName); - if (!keyFields.isEmpty()) { + public String[][] getDistinctProductKeyValues(List keys) + throws DataAccessLayerException { + String[][] distinctValues = null; + if ((keys != null) && !keys.isEmpty()) { DatabaseQuery query = new DatabaseQuery(this.daoClass); - for (int i = 0; i < keyFields.size(); i++) { + for (int i = 0; i < keys.size(); i++) { if (i == 0) { - query.addDistinctParameter(keyFields.get(i)); + query.addDistinctParameter(keys.get(i)); } else { - query.addReturnedField(keyFields.get(i)); + query.addReturnedField(keys.get(i)); } } - if (keyFields.size() == 1) { + if (keys.size() == 1) { List results = this.queryByCriteria(query); - for (int i = 0; i < results.size(); i++) { - distinctKeys.add(keyFields.get(0) + "=" - + results.get(i).toString()); + distinctValues = new String[results.size()][]; + int index = 0; + for (Object obj : results) { + distinctValues[index] = new String[1]; + distinctValues[index++][0] = String.valueOf(obj); } } else { List results = (List) this .queryByCriteria(query); + distinctValues = new String[results.size()][]; + int rIndex = 0; + for (Object[] result : results) { - StringBuilder newKey = new StringBuilder(); - for (int i = 0; i < result.length; i++) { - newKey.append(keyFields.get(i) + "=" + result[i]); - if (i != result.length - 1) { - newKey.append(";"); - } + distinctValues[rIndex] = new String[result.length]; + int cIndex = 0; + + for (Object obj : result) { + distinctValues[rIndex][cIndex++] = String.valueOf(obj); } - distinctKeys.add(newKey.toString()); + + rIndex++; } } } - return distinctKeys; + return distinctValues; } /** @@ -989,19 +1028,23 @@ public abstract class PluginDao extends CoreDao { /** * Gets all distinct reference times for the given productKey * - * @param productKey - * The product key to get the list of reference times for + * @param productKeys + * The product key/values to get the list of reference times for. + * Should be in key value pairs. * @return A list of distinct reference times for the given productKey * @throws DataAccessLayerException */ @SuppressWarnings("unchecked") - public List getRefTimesForCriteria(String productKey) + public List getRefTimesForCriteria(Map productKeys) throws DataAccessLayerException { DatabaseQuery query = new DatabaseQuery(this.daoClass); - List keys = this.getProductKeyParameters(productKey); - for (String[] key : keys) { - query.addQueryParam(key[0], key[1]); + + if ((productKeys != null) && (productKeys.size() > 0)) { + for (Map.Entry pair : productKeys.entrySet()) { + query.addQueryParam(pair.getKey(), pair.getValue()); + } } + query.addDistinctParameter(PURGE_VERSION_FIELD); query.addOrder(PURGE_VERSION_FIELD, false); List times = (List) this.queryByCriteria(query); @@ -1010,25 +1053,48 @@ public abstract class PluginDao extends CoreDao { /** * Purges data from the database for this plugin with the given reference - * time matching the given productKy + * time matching the given productKeys. If refTime is null, will purge all + * data associated with the productKeys. * * @param refTime - * The reftime to delete data for - * @param productKey - * The key to use as a constraint for deletions - * @return + * The reftime to delete data for. A null will purge all data for + * the productKeys. + * @param productKeys + * The product key/values to use as a constraint for deletions. + * Should be in key value pairs. + * @param trackHdf5 + * If true will use trackToUri to populate hdf5FileToUriPurged + * map. + * @param trackToUri + * If true will track each URI that needs to be deleted from + * HDF5, if false will only track the hdf5 files that need to be + * deleted. + * @param hdf5FileToUriPurged + * Map to be populated by purgeDataByRefTime of all the hdf5 + * files that need to be updated. If trackToUri is true, each + * file will have the exact data URI's to be removed from each + * file. If trackToUri is false, the map will have a null entry + * for the list and only track the files. + * @return Number of rows deleted from database. * @throws DataAccessLayerException */ @SuppressWarnings("unchecked") - public int purgeDataByRefTime(Date refTime, String productKey) + public int purgeDataByRefTime(Date refTime, + Map productKeys, boolean trackHdf5, + boolean trackToUri, Map> hdf5FileToUriPurged) throws DataAccessLayerException { int results = 0; DatabaseQuery dataQuery = new DatabaseQuery(this.daoClass); - dataQuery.addQueryParam(PURGE_VERSION_FIELD, refTime); - List keys = this.getProductKeyParameters(productKey); - for (String[] key : keys) { - dataQuery.addQueryParam(key[0], key[1]); + + if (refTime != null) { + dataQuery.addQueryParam(PURGE_VERSION_FIELD, refTime); + } + + if ((productKeys != null) && (productKeys.size() > 0)) { + for (Map.Entry pair : productKeys.entrySet()) { + dataQuery.addQueryParam(pair.getKey(), pair.getValue()); + } } List idList = null; @@ -1036,6 +1102,11 @@ public abstract class PluginDao extends CoreDao { dataQuery.addReturnedField("id"); dataQuery.setMaxResults(500); + + // fields for hdf5 purge + String previousFile = null; + StringBuilder pathBuilder = new StringBuilder(); + do { idList = (List) this.queryByCriteria(dataQuery); if (!idList.isEmpty()) { @@ -1044,6 +1115,41 @@ public abstract class PluginDao extends CoreDao { List pdos = (List) this .queryByCriteria(idQuery); this.delete(pdos); + + if (trackHdf5 && (hdf5FileToUriPurged != null)) { + for (PluginDataObject pdo : pdos) { + pathBuilder.setLength(0); + IPersistable persist = (IPersistable) pdo; + pathBuilder + .append(PLUGIN_HDF5_DIR) + .append(pathProvider.getHDFPath( + this.pluginName, persist)) + .append(File.separatorChar) + .append(pathProvider.getHDFFileName( + this.pluginName, persist)); + String file = pathBuilder.toString(); + + if (trackToUri) { + List uriList = hdf5FileToUriPurged + .get(file); + if (uriList == null) { + // sizing to 50 as most data types have numerous + // entries in a file + uriList = new ArrayList(50); + hdf5FileToUriPurged.put(file, uriList); + } + uriList.add(file); + } else { + // only need to track file, tracking last file + // instead of constantly indexing hashMap + if (!file.equals(previousFile)) { + hdf5FileToUriPurged.put(file, null); + previousFile = file; + } + } + } + } + results += pdos.size(); } @@ -1060,7 +1166,7 @@ public abstract class PluginDao extends CoreDao { * @param productKey * The key to delete */ - public void purgeHDF5DataByRefTime(Date refTime, String productKey) + protected void purgeHDF5DataByRefTime(Date refTime, String productKey) throws DataAccessLayerException { IDataStore dataStore = DataStoreFactory.getDataStore(new File(this .getHDF5Path(productKey))); @@ -1077,21 +1183,25 @@ public abstract class PluginDao extends CoreDao { * Gets the maximum reference time contained in the database for the given * key. The key corresponds to the productKey field in the data object. * - * @param productKey - * The key for which to get the maximum reference time + * @param productKeys + * The product keys to get the maximum reference time for. Should + * be in key value pairs. * @return Null if this key was not found, else the maximum reference time * @throws DataAccessLayerException * If errors occur while querying the database */ @SuppressWarnings("unchecked") - public Date getMaxRefTime(String productKey) + public Date getMaxRefTime(Map productKeys) throws DataAccessLayerException { DatabaseQuery query = new DatabaseQuery(this.daoClass); query.addDistinctParameter(PURGE_VERSION_FIELD); - List keys = this.getProductKeyParameters(productKey); - for (String[] key : keys) { - query.addQueryParam(key[0], key[1]); + + if ((productKeys != null) && (productKeys.size() > 0)) { + for (Map.Entry pair : productKeys.entrySet()) { + query.addQueryParam(pair.getKey(), pair.getValue()); + } } + query.addOrder(PURGE_VERSION_FIELD, false); query.setMaxResults(1); List result = (List) this.queryByCriteria(query); @@ -1113,15 +1223,17 @@ public abstract class PluginDao extends CoreDao { * If errors occur while querying the database */ @SuppressWarnings("unchecked") - public Date getMaxInsertTime(String productKey) + public Date getMaxInsertTime(Map productKeys) throws DataAccessLayerException { DatabaseQuery query = new DatabaseQuery(this.daoClass); // doing distinct is wasted with a ordered max // query.addDistinctParameter("insertTime"); - List keys = this.getProductKeyParameters(productKey); - for (String[] key : keys) { - query.addQueryParam(key[0], key[1]); + if ((productKeys != null) && (productKeys.size() > 0)) { + for (Map.Entry pair : productKeys.entrySet()) { + query.addQueryParam(pair.getKey(), pair.getValue()); + } } + query.addReturnedField("insertTime"); query.addOrder("insertTime", false); query.setMaxResults(1); @@ -1134,25 +1246,29 @@ public abstract class PluginDao extends CoreDao { } /** - * Gets the minimum insert time contained in the database for the given key. - * The key corresponds to the productKey field in the data object. + * Gets the minimum insert time contained in the database for the given + * keys. The keys corresponds to the productKey fields in the data object. * - * @param productKey - * The key for which to get the minimum reference time - * @return Null if this key was not found, else the minimum reference time + * @param productKeys + * The product keys to get the minimum insert time for. Should be + * in key value pairs. + * @return Null if this key was not found, else the minimum insert time * @throws DataAccessLayerException * If errors occur while querying the database */ @SuppressWarnings("unchecked") - public Date getMinInsertTime(String productKey) + public Date getMinInsertTime(Map productKeys) throws DataAccessLayerException { DatabaseQuery query = new DatabaseQuery(this.daoClass); // doing distinct is wasted with a ordered max // query.addDistinctParameter("insertTime"); - List keys = this.getProductKeyParameters(productKey); - for (String[] key : keys) { - query.addQueryParam(key[0], key[1]); + + if ((productKeys != null) && (productKeys.size() > 0)) { + for (Map.Entry pair : productKeys.entrySet()) { + query.addQueryParam(pair.getKey(), pair.getValue()); + } } + query.addReturnedField("insertTime"); query.addOrder("insertTime", true); query.setMaxResults(1); @@ -1168,21 +1284,25 @@ public abstract class PluginDao extends CoreDao { * Gets the minimum reference time contained in the database for the given * key. The key corresponds to the productKey field in the data object. * - * @param productKey - * The key for which to get the minimum reference time + * @param productKeys + * The product keys to get the minimum reference times for. + * Should be in key value pairs. * @return Null if this key was not found, else the minimum reference time * @throws DataAccessLayerException * If errors occur while querying the database */ @SuppressWarnings("unchecked") - public Date getMinRefTime(String productKey) + public Date getMinRefTime(Map productKeys) throws DataAccessLayerException { DatabaseQuery query = new DatabaseQuery(this.daoClass); query.addDistinctParameter(PURGE_VERSION_FIELD); - List keys = this.getProductKeyParameters(productKey); - for (String[] key : keys) { - query.addQueryParam(key[0], key[1]); + + if ((productKeys != null) && (productKeys.size() > 0)) { + for (Map.Entry pair : productKeys.entrySet()) { + query.addQueryParam(pair.getKey(), pair.getValue()); + } } + query.addOrder(PURGE_VERSION_FIELD, true); query.setMaxResults(1); List result = (List) this.queryByCriteria(query); @@ -1234,27 +1354,6 @@ public abstract class PluginDao extends CoreDao { return pathBuilder.toString(); } - /** - * Checks to see if a rule is valid. A rule is valid if the keys used in - * this rule are listed in the pathKey.xml file for this plugin. - * - * @param rule - * The rule to check - * @return True if the rule is valid. False if the rule is invalid - */ - private boolean isRuleValid(PurgeRule rule) { - boolean retVal = true; - List keyParams = getProductKeyParameters(rule.getId() - .getKey()); - List keyNames = this.pathProvider.getKeyNames(pluginName); - for (String[] param : keyParams) { - if (!keyNames.contains(param[0])) { - retVal = false; - } - } - return retVal; - } - private Date roundDateToHour(Date dateToRound) { return new Date(dateToRound.getTime() - dateToRound.getTime() % 3600000); } @@ -1274,7 +1373,7 @@ public abstract class PluginDao extends CoreDao { }); } - public static List getPurgeRulesForPlugin(String pluginName) { + public static PurgeRuleSet getPurgeRulesForPlugin(String pluginName) { IPathManager pathMgr = PathManagerFactory.getPathManager(); Map tieredFile = pathMgr .getTieredLocalizationFile(LocalizationType.COMMON_STATIC, @@ -1291,33 +1390,45 @@ public abstract class PluginDao extends CoreDao { } if (rulesFile != null) { - try { - PurgeRuleSet purgeRules = (PurgeRuleSet) SerializationUtil - .jaxbUnmarshalFromXmlFile(rulesFile); - return purgeRules.getRules(); - } catch (SerializationException e) { - PurgeLogger - .logError( - "Error deserializing purge rules! Data will not be purged. Please define rules.", - pluginName); + // allow zero length file to disable purge for this plugin + if (rulesFile.length() > 0) { + try { + PurgeRuleSet purgeRules = (PurgeRuleSet) SerializationUtil + .jaxbUnmarshalFromXmlFile(rulesFile); + + // ensure there's a default rule + if (purgeRules.getDefaultRules() == null) { + purgeRules.setDefaultRules(loadDefaultPurgeRules()); + } + return purgeRules; + } catch (SerializationException e) { + PurgeLogger + .logError( + "Error deserializing purge rules! Data will not be purged. Please define rules.", + pluginName, e); + } } + } else if (!"default".equals(pluginName)) { + // no purge rule for this plugin, check base purge rule + return getPurgeRulesForPlugin("default"); } - return Collections.emptyList(); + return null; } - public static PurgeRule loadDefaultPurgeRule() { + public static List loadDefaultPurgeRules() { File defaultRule = PathManagerFactory.getPathManager().getStaticFile( "purge/defaultPurgeRules.xml"); if (defaultRule == null) { - PurgeLogger.logError("Default purge rule not defined!!", "EDEX"); - statusHandler - .error("Default purge rule not defined!! Data will not be purged for plugins which do not specify purge rules!"); + PurgeLogger + .logError( + "Default purge rule not defined!! Data will not be purged for plugins which do not specify purge rules!", + "EDEX"); return null; } try { PurgeRuleSet purgeRules = (PurgeRuleSet) SerializationUtil .jaxbUnmarshalFromXmlFile(defaultRule); - return purgeRules.getRules().get(0); + return purgeRules.getDefaultRules(); } catch (SerializationException e) { PurgeLogger.logError("Error deserializing default purge rule!", "DEFAULT"); @@ -1403,8 +1514,7 @@ public abstract class PluginDao extends CoreDao { byte[] data = SerializationUtil.transformToThrift(entry .getValue()); - // debug transform back for object inspection - Object obj = SerializationUtil.transformFromThrift(data); + SerializationUtil.transformFromThrift(data); // save list to disk (in gz format?) FileUtil.bytes2File(data, file, true); diff --git a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/PluginFactory.java b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/PluginFactory.java index 0cabde46ac..86ac81cb0c 100644 --- a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/PluginFactory.java +++ b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/plugin/PluginFactory.java @@ -54,7 +54,7 @@ import com.raytheon.uf.edex.core.dataplugin.PluginRegistry; public class PluginFactory { /** The instance of the PluginFactory class */ - private static PluginFactory instance; + private static final PluginFactory instance = new PluginFactory(); /** * Gets the singleton instance of the PluginFactory @@ -64,10 +64,7 @@ public class PluginFactory { * If errors occur during instantiation of the singleton * instance */ - public static synchronized PluginFactory getInstance() { - if (instance == null) { - instance = new PluginFactory(); - } + public static PluginFactory getInstance() { return instance; } diff --git a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/purge/PurgeRule.java b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/purge/PurgeRule.java index 2a76b3f2d8..d948294024 100644 --- a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/purge/PurgeRule.java +++ b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/purge/PurgeRule.java @@ -20,19 +20,17 @@ package com.raytheon.uf.edex.database.purge; -import java.io.Serializable; import java.util.Date; +import java.util.Iterator; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlElements; -import com.raytheon.uf.common.dataplugin.persist.IPersistableDataObject; -import com.raytheon.uf.common.serialization.ISerializableObject; -import com.raytheon.uf.common.serialization.annotations.DynamicSerialize; import com.raytheon.uf.common.serialization.annotations.DynamicSerializeElement; import com.raytheon.uf.common.status.IUFStatusHandler; import com.raytheon.uf.common.status.UFStatus; @@ -55,11 +53,8 @@ import com.raytheon.uf.common.status.UFStatus.Priority; * @author bphillip * @version 1 */ -@XmlRootElement @XmlAccessorType(XmlAccessType.NONE) -@DynamicSerialize -public class PurgeRule implements IPersistableDataObject, Serializable, - ISerializableObject, Cloneable, Comparable { +public class PurgeRule { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(PurgeRule.class); @@ -81,12 +76,12 @@ public class PurgeRule implements IPersistableDataObject, Serializable, .compile(TIME_PATTERN_STRING); /** - * The primary key for this rule. The primary key consists of the plugin - * name and a key used for purging + * The keys this rule is to match. Should be equal to a value based on the + * key fields of the record specified in the PurgeRuleSet. Special cases are + * made for keyMatch of value default. */ - @XmlElement - @DynamicSerializeElement - private PurgeRulePK id; + @XmlElements({ @XmlElement(name = "keyValue", type = String.class) }) + private List keyValues; /** The number of versions to keep */ @XmlElement @@ -154,25 +149,21 @@ public class PurgeRule implements IPersistableDataObject, Serializable, } /** - * Creates a new PurgeRule with the given key + * Gets the key values associated with the PurgeRuleSet keys. * - * @param pk - * The key + * @return */ - public PurgeRule(PurgeRulePK pk) { - this.id = pk; + public List getKeyValues() { + return keyValues; } /** - * Creates a new PurgeRule with the given key elements + * Sets the key values associated with the PurgeRuleSet keys. * - * @param pluginName - * The plugin name to be used in the PurgeKeyPK - * @param key - * The key to be used in the PurgeKeyPK + * @param keyValues */ - public PurgeRule(String pluginName, String key) { - this(new PurgeRulePK(pluginName, key)); + public void setKeyValues(List keyValues) { + this.keyValues = keyValues; } /** @@ -341,11 +332,15 @@ public class PurgeRule implements IPersistableDataObject, Serializable, return new Date[] { refTime, timeToCompare }; } + @Override public String toString() { StringBuilder builder = new StringBuilder(); builder.append("["); - builder.append("Plugin: ").append(id.getPluginName()).append(" "); - builder.append("Key: ").append(id.getKey()).append(" "); + + for (String kv : keyValues) { + builder.append("KeyValue: ").append(kv).append(" "); + } + builder.append("VersionToKeep: ").append(this.versionsToKeep) .append(" "); builder.append("Period: ").append(this.period).append(" "); @@ -361,48 +356,45 @@ public class PurgeRule implements IPersistableDataObject, Serializable, * * @return The human readable description of this rule */ - public String getRuleDescription() { + public String getRuleDescription(List keys) { if (this.ruleDescription == null) { StringBuilder builder = new StringBuilder(); - if (this.id.getKey().equals("custom")) { - builder.append("The ") - .append(this.id.getPluginName()) - .append(" plugin implements a customized purge routine."); + if ((keys == null) || keys.isEmpty() || (keyValues == null) + || keyValues.isEmpty()) { + builder.append("Default rule, "); } else { - if (id.getKey().isEmpty()) { - builder.append("For ").append(id.getPluginName()) - .append(" data, "); - } else { - builder.append("For ").append(id.getPluginName()) - .append(" data matching ").append(id.getKey()) - .append(", "); + builder.append("For data matching "); + Iterator keyIter = keys.iterator(); + Iterator valueIter = keyValues.iterator(); + while (keyIter.hasNext() && valueIter.hasNext()) { + builder.append(keyIter.next()).append("=") + .append(valueIter.next()).append(", "); } + } - if (isDeltaSpecified()) { - getVersionsClause(builder); - builder.append("at ") - .append(this.getTimeDescription(delta)) - .append("intervals "); - getRoundClause(builder); - getPeriodClause(builder); - } else if (!isDeltaSpecified() && isVersionsToKeepSpecified()) { - getVersionsClause(builder); - getPeriodClause(builder); - } else if (!isDeltaSpecified() && !isVersionsToKeepSpecified() - && isPeriodSpecified()) { - getVersionsClause(builder); - getPeriodClause(builder); - } else { - builder.append("keep all data."); - } - if (isModTimeToWaitSpecified()) { - builder.append( - " Do not purge if most recent version has been modified in the last ") - .append(this.getModTimeToWaitDescription()); - } + if (isDeltaSpecified()) { + getVersionsClause(builder); + builder.append("at ").append(this.getTimeDescription(delta)) + .append("intervals "); + getRoundClause(builder); + getPeriodClause(builder); + } else if (!isDeltaSpecified() && isVersionsToKeepSpecified()) { + getVersionsClause(builder); + getPeriodClause(builder); + } else if (!isDeltaSpecified() && !isVersionsToKeepSpecified() + && isPeriodSpecified()) { + getVersionsClause(builder); + getPeriodClause(builder); + } else { + builder.append("keep all data."); + } + if (isModTimeToWaitSpecified()) { + builder.append( + " Do not purge if most recent version has been modified in the last ") + .append(this.getModTimeToWaitDescription()); } ruleDescription = builder.toString(); } @@ -578,26 +570,6 @@ public class PurgeRule implements IPersistableDataObject, Serializable, return builder.toString(); } - @Override - public Object getIdentifier() { - return id; - } - - /** - * @return the id - */ - public PurgeRulePK getId() { - return id; - } - - /** - * @param id - * the id to set - */ - public void setId(PurgeRulePK id) { - this.id = id; - } - /** * @return the versionsToKeep */ @@ -687,40 +659,4 @@ public class PurgeRule implements IPersistableDataObject, Serializable, public void setLogOnly(boolean logOnly) { this.logOnly = logOnly; } - - public Object clone() { - PurgeRule rval = new PurgeRule(); - rval.id = (PurgeRulePK) id.clone(); - rval.delta = delta; - rval.logOnly = logOnly; - rval.period = period; - rval.round = round; - rval.versionsToKeep = versionsToKeep; - - return rval; - } - - public boolean equals(Object obj) { - - if (!(obj instanceof PurgeRule)) { - return false; - } - PurgeRule rhs = (PurgeRule) obj; - return this.id.equals(rhs.getId()) && this.delta.equals(rhs.getDelta()) - && this.logOnly == rhs.isLogOnly() - && this.period.equals(rhs.getPeriod()) - && this.round.equals(rhs.getRound()) - && this.versionsToKeep == rhs.getVersionsToKeep(); - } - - /* - * (non-Javadoc) - * - * @see java.lang.Comparable#compareTo(java.lang.Object) - */ - @Override - public int compareTo(PurgeRule o) { - return this.id.getPluginName().compareTo(o.getId().getPluginName()); - } - } diff --git a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/purge/PurgeRuleSet.java b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/purge/PurgeRuleSet.java index f2a72131a2..6a15bc50c4 100644 --- a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/purge/PurgeRuleSet.java +++ b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/purge/PurgeRuleSet.java @@ -21,7 +21,7 @@ package com.raytheon.uf.edex.database.purge; import java.util.ArrayList; -import java.util.Collection; +import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; @@ -33,8 +33,8 @@ import com.raytheon.uf.common.serialization.ISerializableObject; /** * A container class used for unmarshalling purge rules. The purge rules are - * stored in xml files in the edex_static/base/purge directory. The rules are - * unmarshalled into this object before being persisted to the database. + * stored in xml files in the common_static/base/purge directory. The rules are + * then organized into a tree for easy look up of closest matching rule. * *
  * 
@@ -52,14 +52,45 @@ import com.raytheon.uf.common.serialization.ISerializableObject;
 @XmlRootElement(name = "purgeRuleSet")
 @XmlAccessorType(XmlAccessType.NONE)
 public class PurgeRuleSet implements ISerializableObject {
+
+    @XmlElements({ @XmlElement(name = "key", type = String.class) })
+    private List keys;
+
+    @XmlElements({ @XmlElement(name = "defaultRule", type = PurgeRule.class) })
+    private List defaultRules;
+
     /**
      * List of purge rules for/from the XML.
      */
     @XmlElements({ @XmlElement(name = "rule", type = PurgeRule.class) })
     private ArrayList rules;
 
+    private PurgeRuleTree purgeTree = null;
+
     public PurgeRuleSet() {
-        rules = new ArrayList();
+    }
+
+    /**
+     * Returns the default rule.
+     * 
+     * @return
+     */
+    public List getDefaultRules() {
+        return defaultRules;
+    }
+
+    public void setDefaultRules(final List defaultRules) {
+        this.defaultRules = defaultRules;
+    }
+
+    /**
+     * Sets the default rule list to the passed rule.
+     * 
+     * @param defaultRule
+     */
+    public void setDefaultRule(final PurgeRule defaultRule) {
+        this.defaultRules = new ArrayList(1);
+        this.defaultRules.add(defaultRule);
     }
 
     /**
@@ -71,32 +102,36 @@ public class PurgeRuleSet implements ISerializableObject {
         return rules;
     }
 
-    /**
-     * Set the list of purge rules.
-     * 
-     * @param models
-     */
-    public void setModels(ArrayList rules) {
+    public void setRules(final ArrayList rules) {
         this.rules = rules;
     }
 
     /**
-     * Add a purge rule to this set
+     * Returns the list of purge keys.
      * 
-     * @param rule
-     *            The rule to add
+     * @return
      */
-    public void addRule(PurgeRule rule) {
-        this.rules.add(rule);
+    public List getKeys() {
+        return keys;
+    }
+
+    public void setKeys(final List keys) {
+        this.keys = keys;
     }
 
     /**
-     * Adds purge rules to this set
+     * Returns the purge rules associated with the passed key values.
      * 
-     * @param rules
-     *            The rules to add
+     * @param keyValues
+     *            The values associated with the plugin purge keys to check for
+     *            purge rules for.
+     * @return
      */
-    public void addRules(Collection rules) {
-        this.rules.addAll(rules);
+    public List getRuleForKeys(final String[] keyValues) {
+        if (purgeTree == null) {
+            purgeTree = new PurgeRuleTree(this);
+        }
+
+        return purgeTree.getRulesForKeys(keyValues);
     }
 }
diff --git a/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/purge/PurgeRuleTree.java b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/purge/PurgeRuleTree.java
new file mode 100644
index 0000000000..bd9454625c
--- /dev/null
+++ b/edexOsgi/com.raytheon.uf.edex.database/src/com/raytheon/uf/edex/database/purge/PurgeRuleTree.java
@@ -0,0 +1,141 @@
+/**
+ * This software was developed and / or modified by Raytheon Company,
+ * pursuant to Contract DG133W-05-CQ-1067 with the US Government.
+ * 
+ * U.S. EXPORT CONTROLLED TECHNICAL DATA
+ * This software product contains export-restricted data whose
+ * export/transfer/disclosure is restricted by U.S. law. Dissemination
+ * to non-U.S. persons whether in the United States or abroad requires
+ * an export license or other authorization.
+ * 
+ * Contractor Name:        Raytheon Company
+ * Contractor Address:     6825 Pine Street, Suite 340
+ *                         Mail Stop B8
+ *                         Omaha, NE 68106
+ *                         402.291.0100
+ * 
+ * See the AWIPS II Master Rights File ("Master Rights File.pdf") for
+ * further licensing information.
+ */
+package com.raytheon.uf.edex.database.purge;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Tree representation of the purge rules. Each Node can contain a PurgeRule as
+ * well as a collection of other Nodes. Each Node should be a specific purge key
+ * value based on the PurgeRuleSet keys. A given set of key/value pairs will
+ * return the most significant purge key that matches.
+ * 
+ * 
+ * 
+ * SOFTWARE HISTORY
+ * 
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * Oct 29, 2012            rjpeter     Initial creation
+ * 
+ * 
+ * + * @author rjpeter + * @version 1.0 + */ +public class PurgeRuleTree { + private final PurgeNode root; + + public PurgeRuleTree(PurgeRuleSet ruleSet) { + root = new PurgeNode(); + root.setRules(ruleSet.getDefaultRules()); + ArrayList rules = ruleSet.getRules(); + if (rules != null) { + for (PurgeRule rule : rules) { + PurgeNode curNode = root; + List values = rule.getKeyValues(); + if (values != null) { + // descend purge tree + for (String val : values) { + Map childNodes = curNode + .getChildNodes(); + curNode = childNodes.get(val); + if (curNode == null) { + curNode = new PurgeNode(); + childNodes.put(val, curNode); + } + } + + // set the rule on the leaf node defined by key values + curNode.addRule(rule); + } + } + } + } + + /** + * Returns the purge rules associated with the given key value list. + * + * @param keyValues + * @return + */ + public List getRulesForKeys(String[] keyValues) { + // default rule is initial closest rule + List closestRules = root.getRules(); + PurgeNode currentNode = root; + + if ((keyValues != null) && (keyValues.length > 0)) { + // iterate over key values, descending tree as far as possible, + // keeping track of closest matching rule. + for (String value : keyValues) { + currentNode = currentNode.getChildNode(value); + + // descend node + if (currentNode != null) { + // check node for rules + List rules = currentNode.getRules(); + + if ((rules != null) && !rules.isEmpty()) { + // current closest rules + closestRules = rules; + } + } else { + break; + } + } + } + + return closestRules; + } + + private class PurgeNode { + // most nodes only have 1 rule + private List rules = null; + + private final Map childNodes = new HashMap(); + + public void addRule(PurgeRule rule) { + if (rules == null) { + rules = new ArrayList(1); + } + + rules.add(rule); + } + + public void setRules(List rules) { + this.rules = rules; + } + + public List getRules() { + return rules; + } + + public Map getChildNodes() { + return childNodes; + } + + public PurgeNode getChildNode(String keyValue) { + return childNodes.get(keyValue); + } + } +} diff --git a/edexOsgi/com.raytheon.uf.edex.database/utility/common_static/base/purge/defaultPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.database/utility/common_static/base/purge/defaultPurgeRules.xml index de1d772210..d8401ec954 100644 --- a/edexOsgi/com.raytheon.uf.edex.database/utility/common_static/base/purge/defaultPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.database/utility/common_static/base/purge/defaultPurgeRules.xml @@ -1,10 +1,6 @@ - - - - default - default - + + 01-00:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/ProcessUtil.java b/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/ProcessUtil.java index c4f89d4b74..26b85ddfed 100644 --- a/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/ProcessUtil.java +++ b/edexOsgi/com.raytheon.uf.edex.esb.camel/src/com/raytheon/uf/edex/esb/camel/ProcessUtil.java @@ -53,22 +53,29 @@ public class ProcessUtil { protected static final IUFStatusHandler handler = UFStatus .getNamedHandler("Ingest"); - protected transient final static DecimalFormat FORMAT; - static { - FORMAT = new DecimalFormat(); - FORMAT.setMaximumFractionDigits(4); - FORMAT.setMinimumFractionDigits(4); - } + protected transient final static ThreadLocal FORMAT = new ThreadLocal() { + + @Override + protected DecimalFormat initialValue() { + DecimalFormat rval = new DecimalFormat(); + rval.setMaximumFractionDigits(4); + rval.setMinimumFractionDigits(4); + return rval; + } + + }; public void delete(@Header(value = "ingestFileName") String path) { File f = new File(path); - if (f.exists()) + if (f.exists()) { f.delete(); + } } public void deleteFile(File f) { - if (f.exists()) + if (f.exists()) { f.delete(); + } } /** @@ -93,12 +100,11 @@ public class ProcessUtil { } Long dequeueTime = getHeaderProperty(headers, "dequeueTime"); + DecimalFormat df = FORMAT.get(); if (dequeueTime != null) { double elapsed = (curTime - dequeueTime) / 1000.0; sb.append(" processed in: "); - synchronized (FORMAT) { - sb.append(FORMAT.format(elapsed)); - } + sb.append(df.format(elapsed)); sb.append(" (sec)"); } @@ -106,9 +112,7 @@ public class ProcessUtil { if (enqueueTime != null) { double latency = (curTime - enqueueTime) / 1000.0; sb.append(" Latency: "); - synchronized (FORMAT) { - sb.append(FORMAT.format(latency)); - } + sb.append(df.format(latency)); sb.append(" (sec)"); } // Make sure we have something to log. diff --git a/edexOsgi/com.raytheon.uf.edex.maintenance/src/com/raytheon/uf/edex/maintenance/archive/DatabaseArchiver.java b/edexOsgi/com.raytheon.uf.edex.maintenance/src/com/raytheon/uf/edex/maintenance/archive/DatabaseArchiver.java index 40ef7b79c6..eab3c16fff 100644 --- a/edexOsgi/com.raytheon.uf.edex.maintenance/src/com/raytheon/uf/edex/maintenance/archive/DatabaseArchiver.java +++ b/edexOsgi/com.raytheon.uf.edex.maintenance/src/com/raytheon/uf/edex/maintenance/archive/DatabaseArchiver.java @@ -111,8 +111,8 @@ public class DatabaseArchiver implements IPluginArchiver { DataArchiveConfig conf) { PluginProperties props = PluginRegistry.getInstance() .getRegisteredObject(pluginName); - if (props != null && props.getRecord() != null - && props.getDao() != null) { + if ((props != null) && (props.getRecord() != null) + && (props.getDao() != null)) { Class recordClass = props.getRecord(); if (recordClass != null) { try { @@ -174,19 +174,19 @@ public class DatabaseArchiver implements IPluginArchiver { archiveFormatter = pluginArchiveFormatters.get("default"); } - while (startTime != null && endTime != null) { + while ((startTime != null) && (endTime != null)) { Map> pdosToSave = archiveFormatter .getPdosByFile(pluginName, dao, pdoMap, startTime, endTime); - if (pdosToSave != null && !pdosToSave.isEmpty()) { + if ((pdosToSave != null) && !pdosToSave.isEmpty()) { recordCount += savePdoMap(pluginName, archivePath, pdosToSave, conf.getCompressionEnabled()); for (Map.Entry> entry : pdosToSave .entrySet()) { List pdoList = entry.getValue(); - if (pdoList != null && !pdoList.isEmpty() - && pdoList.get(0) instanceof IPersistable) { + if ((pdoList != null) && !pdoList.isEmpty() + && (pdoList.get(0) instanceof IPersistable)) { datastoreFilesToArchive.add(entry.getKey()); } } @@ -196,7 +196,7 @@ public class DatabaseArchiver implements IPluginArchiver { endTime = determineEndTime(startTime, runTime); } - if (pdoMap != null && !pdoMap.isEmpty()) { + if ((pdoMap != null) && !pdoMap.isEmpty()) { recordCount += savePdoMap(pluginName, archivePath, pdoMap, conf.getCompressionEnabled()); // don't forget to archive the HDF5 for the records that weren't @@ -204,8 +204,8 @@ public class DatabaseArchiver implements IPluginArchiver { for (Map.Entry> entry : pdoMap .entrySet()) { List pdoList = entry.getValue(); - if (pdoList != null && !pdoList.isEmpty() - && pdoList.get(0) instanceof IPersistable) { + if ((pdoList != null) && !pdoList.isEmpty() + && (pdoList.get(0) instanceof IPersistable)) { datastoreFilesToArchive.add(entry.getKey()); } } @@ -217,7 +217,7 @@ public class DatabaseArchiver implements IPluginArchiver { PluginProperties props = PluginRegistry.getInstance() .getRegisteredObject(pluginName); - if (props != null && props.getCompression() != null) { + if ((props != null) && (props.getCompression() != null)) { if (compRequired.equals(Compression.valueOf(props .getCompression()))) { // if plugin is already compressed to the correct level, @@ -378,7 +378,7 @@ public class DatabaseArchiver implements IPluginArchiver { Calendar startTime = null; // get previous run time - if (extraInfo != null && !extraInfo.isEmpty()) { + if ((extraInfo != null) && !extraInfo.isEmpty()) { try { Date prevDate = DATE_FORMAT.parse(extraInfo); @@ -404,7 +404,7 @@ public class DatabaseArchiver implements IPluginArchiver { } } else { // startTime has never been set lookup earliest start time - Date minInsert = dao.getMinInsertTime(""); + Date minInsert = dao.getMinInsertTime(null); if (minInsert != null) { startTime = Calendar.getInstance(TimeZone.getTimeZone("GMT")); startTime.setTimeInMillis(minInsert.getTime()); diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.acars/utility/common_static/base/purge/acarsPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.acars/utility/common_static/base/purge/acarsPurgeRules.xml index 563658ca3e..1182b36c71 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.acars/utility/common_static/base/purge/acarsPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.acars/utility/common_static/base/purge/acarsPurgeRules.xml @@ -1,12 +1,8 @@ - - - - acars - default - + + 24 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.acarssounding/utility/common_static/base/purge/acarssoundingPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.acarssounding/utility/common_static/base/purge/acarssoundingPurgeRules.xml index f8b4e104f8..1182b36c71 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.acarssounding/utility/common_static/base/purge/acarssoundingPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.acarssounding/utility/common_static/base/purge/acarssoundingPurgeRules.xml @@ -1,12 +1,8 @@ - - - - acarssounding - default - + + 24 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.bufrascat/utility/common_static/base/purge/bufrascatPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.bufrascat/utility/common_static/base/purge/bufrascatPurgeRules.xml index 0f7aece859..c2cb1258f6 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.bufrascat/utility/common_static/base/purge/bufrascatPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.bufrascat/utility/common_static/base/purge/bufrascatPurgeRules.xml @@ -1,12 +1,8 @@ - - - - bufrascat - default - + + 12 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.bufrhdw/utility/common_static/base/purge/bufrhdwPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.bufrhdw/utility/common_static/base/purge/bufrhdwPurgeRules.xml index d5023614d0..ef0c05b8b0 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.bufrhdw/utility/common_static/base/purge/bufrhdwPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.bufrhdw/utility/common_static/base/purge/bufrhdwPurgeRules.xml @@ -1,12 +1,8 @@ - - - - bufrhdw - default - + + 33 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.bufrmthdw/utility/common_static/base/purge/bufrmthdwPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.bufrmthdw/utility/common_static/base/purge/bufrmthdwPurgeRules.xml index 23c1b31e22..ef0c05b8b0 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.bufrmthdw/utility/common_static/base/purge/bufrmthdwPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.bufrmthdw/utility/common_static/base/purge/bufrmthdwPurgeRules.xml @@ -1,12 +1,8 @@ - - - - bufrmthdw - default - + + 33 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.bufrncwf/utility/common_static/base/purge/bufrncwfPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.bufrncwf/utility/common_static/base/purge/bufrncwfPurgeRules.xml index 85aea14b86..3ac68c13cc 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.bufrncwf/utility/common_static/base/purge/bufrncwfPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.bufrncwf/utility/common_static/base/purge/bufrncwfPurgeRules.xml @@ -1,10 +1,6 @@ - - - - bufrncwf - default - + + 288 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.bufrquikscat/utility/common_static/base/purge/bufrquikscatPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.bufrquikscat/utility/common_static/base/purge/bufrquikscatPurgeRules.xml index 20b982522d..c2cb1258f6 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.bufrquikscat/utility/common_static/base/purge/bufrquikscatPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.bufrquikscat/utility/common_static/base/purge/bufrquikscatPurgeRules.xml @@ -1,12 +1,8 @@ - - - - bufrquikscat - default - + + 12 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.bufrsigwx/utility/common_static/base/purge/bufrsigwxPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.bufrsigwx/utility/common_static/base/purge/bufrsigwxPurgeRules.xml index de777155d5..403be907bf 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.bufrsigwx/utility/common_static/base/purge/bufrsigwxPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.bufrsigwx/utility/common_static/base/purge/bufrsigwxPurgeRules.xml @@ -1,31 +1,21 @@ - + + wxLayer + + 12 + =00-01:00:00 + 00-01:00:00 + - - bufrsigwx - default - + SWM 12 =00-01:00:00 00-01:00:00 - - bufrsigwx - wxLayer=SWM - + SWH 12 =00-01:00:00 00-01:00:00 - - - bufrsigwx - wxLayer=SWH - - 12 - =00-01:00:00 - 00-01:00:00 - - - \ No newline at end of file + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.bufrssmi/utility/common_static/base/purge/bufrssmiPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.bufrssmi/utility/common_static/base/purge/bufrssmiPurgeRules.xml index 38f77f6389..ef0c05b8b0 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.bufrssmi/utility/common_static/base/purge/bufrssmiPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.bufrssmi/utility/common_static/base/purge/bufrssmiPurgeRules.xml @@ -1,12 +1,8 @@ - - - - bufrssmi - default - + + 33 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.cwa/utility/common_static/base/purge/cwaPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.cwa/utility/common_static/base/purge/cwaPurgeRules.xml index 6e5e60796b..d8401ec954 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.cwa/utility/common_static/base/purge/cwaPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.cwa/utility/common_static/base/purge/cwaPurgeRules.xml @@ -1,10 +1,6 @@ - - - - cwa - default - + + 01-00:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.cwat/utility/common_static/base/purge/cwatPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.cwat/utility/common_static/base/purge/cwatPurgeRules.xml index 242f40d34e..d8401ec954 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.cwat/utility/common_static/base/purge/cwatPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.cwat/utility/common_static/base/purge/cwatPurgeRules.xml @@ -1,10 +1,6 @@ - - - - cwat - default - + + 01-00:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java index 40cfaeaa4b..53a268b806 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.ffmp/src/com/raytheon/uf/edex/plugin/ffmp/common/FFMPProcessor.java @@ -92,7 +92,7 @@ import com.vividsolutions.jts.geom.Polygon; * ------------ ---------- ----------- -------------------------- * * 07/14/09 2152 D. Hladky Initial release - * + * 10/25/12 DR 15514 G. Zhang Fix ConcurrentModificationException *
* * @author dhladky @@ -213,11 +213,13 @@ public class FFMPProcessor { FFMPSourceConfigurationManager.SOURCE_TYPE.GAGE .getSourceType())) { - ArrayList hucs = template.getTemplateMgr().getHucLevels(); - + //ArrayList hucs = template.getTemplateMgr().getHucLevels();// DR 15514 + String[] hucs = template.getTemplateMgr().getHucLevelsInArray();// DR 15514 synchronized (hucs) { if (hucs != null) { - for (String huc : hucs) { + //for (String huc : hucs) { + for(int i=0; i - - - - ffmp - default - + + 01-00:00:00 - - \ No newline at end of file + +
diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.fog/src/com/raytheon/uf/edex/plugin/fog/FogURIFilter.java b/edexOsgi/com.raytheon.uf.edex.plugin.fog/src/com/raytheon/uf/edex/plugin/fog/FogURIFilter.java index ffeb76a42e..8c8db6763e 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.fog/src/com/raytheon/uf/edex/plugin/fog/FogURIFilter.java +++ b/edexOsgi/com.raytheon.uf.edex.plugin.fog/src/com/raytheon/uf/edex/plugin/fog/FogURIFilter.java @@ -29,6 +29,20 @@ import com.raytheon.uf.common.status.UFStatus; import com.vividsolutions.jts.geom.Coordinate; import com.vividsolutions.jts.geom.Geometry; +/** + * + *
+ * 
+ * SOFTWARE HISTORY
+ * Date         Ticket#    Engineer    Description
+ * ------------ ---------- ----------- --------------------------
+ * 
+ * Oct 31, 2012 15464      zhao        updated satellite URIfilters
+ * 
+ * 
+ * + */ + public class FogURIFilter extends URIFilter { private static final transient IUFStatusHandler statusHandler = UFStatus .getHandler(FogURIFilter.class); @@ -72,6 +86,12 @@ public class FogURIFilter extends URIFilter { public static String vis = "Imager_Visible"; public String satRegion = null; + + /* + * new field: satellite coverage ID + */ + public String satCoverageIdIR = null; + public String satCoverageIdVis = null; /** URI pattern for VIS */ public Pattern visURIpattern = null; @@ -164,7 +184,8 @@ public class FogURIFilter extends URIFilter { */ public void setVISPattern() { visURIpattern = Pattern.compile("/satellite/" + wildCard + uriSeperator - + NESDIS + uriSeperator + getSatRegion() + uriSeperator + vis); + + NESDIS + uriSeperator + getSatRegion() + uriSeperator + vis + + uriSeperator + satCoverageIdVis); } /** @@ -184,7 +205,7 @@ public class FogURIFilter extends URIFilter { public void setIR3_9Pattern() { ir3_9URIpattern = Pattern.compile("/satellite/" + wildCard + uriSeperator + NESDIS + uriSeperator + getSatRegion() - + uriSeperator + ir3_9); + + uriSeperator + ir3_9 + uriSeperator + satCoverageIdIR); } /** @@ -204,7 +225,7 @@ public class FogURIFilter extends URIFilter { public void setIR10_7Pattern() { ir10_7URIpattern = Pattern.compile("/satellite/" + wildCard + uriSeperator + NESDIS + uriSeperator + getSatRegion() - + uriSeperator + ir10_7); + + uriSeperator + ir10_7 + uriSeperator + satCoverageIdIR ); } /** @@ -227,18 +248,33 @@ public class FogURIFilter extends URIFilter { // -122.53428764092014, 47.662021408089124 for SEW if (cwaCenterCoor != null) { if (cwaCenterCoor.y > 30.0 && cwaCenterCoor.x < -130.0) { - satRegion = "GOES-12\\(M\\)/Alaska_Regional"; + //satRegion = "GOES-12\\(M\\)/Alaska_Regional"; + satRegion = "GOES-15\\(P\\)/Alaska_Regional"; + satCoverageIdIR = "328892060"; + satCoverageIdVis = "1160112258"; } else if (cwaCenterCoor.y < 30.0 && cwaCenterCoor.x < -130.0) { - satRegion = "GOES-12\\(M\\)/Hawaii_Regional"; + //satRegion = "GOES-12\\(M\\)/Hawaii_Regional"; + satRegion = "GOES-15\\(P\\)/Hawaii_Regional"; + satCoverageIdIR = "1162224264"; + satCoverageIdVis = "880359024"; } else if (cwaCenterCoor.x < -105.0) { - satRegion = "GOES-11\\(L\\)/West_CONUS"; + //satRegion = "GOES-11\\(L\\)/West_CONUS"; // satRegion = "GOES-12\\(M\\)/West_CONUS"; + satRegion = "GOES-15\\(P\\)/West_CONUS"; + satCoverageIdIR = "667897505"; + satCoverageIdVis = "371138769"; } else if (cwaCenterCoor.x > -105.0) { satRegion = "GOES-13\\(N\\)/East_CONUS"; + //satRegion = "GOES-14\\(O\\)/East_CONUS"; + satCoverageIdIR = "553646295"; + satCoverageIdVis = "-668648557"; } } else { satRegion = "GOES-13\\(N\\)/East_CONUS"; + //satRegion = "GOES-14\\(O\\)/East_CONUS"; + satCoverageIdIR = "553646295"; + satCoverageIdVis = "-668648557"; statusHandler .error("FogFilter " + name diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.ldadmesonet/utility/common_static/base/purge/ldadmesonetPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.ldadmesonet/utility/common_static/base/purge/ldadmesonetPurgeRules.xml index 6ac3acf853..1182b36c71 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.ldadmesonet/utility/common_static/base/purge/ldadmesonetPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.ldadmesonet/utility/common_static/base/purge/ldadmesonetPurgeRules.xml @@ -1,12 +1,8 @@ - - - - ldadmesonet - default - + + 24 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.plugin.lsr/utility/common_static/base/purge/lsrPurgeRules.xml b/edexOsgi/com.raytheon.uf.edex.plugin.lsr/utility/common_static/base/purge/lsrPurgeRules.xml index 8912fce977..4ca274e6cb 100644 --- a/edexOsgi/com.raytheon.uf.edex.plugin.lsr/utility/common_static/base/purge/lsrPurgeRules.xml +++ b/edexOsgi/com.raytheon.uf.edex.plugin.lsr/utility/common_static/base/purge/lsrPurgeRules.xml @@ -1,10 +1,6 @@ - - - - lsr - default - + + 14-00:00:00 - - \ No newline at end of file + + diff --git a/edexOsgi/com.raytheon.uf.edex.purgesrv/src/com/raytheon/uf/edex/purgesrv/PurgeRequest.java b/edexOsgi/com.raytheon.uf.edex.purgesrv/src/com/raytheon/uf/edex/purgesrv/PurgeRequest.java index ea73fda41b..4faf77e5c4 100644 --- a/edexOsgi/com.raytheon.uf.edex.purgesrv/src/com/raytheon/uf/edex/purgesrv/PurgeRequest.java +++ b/edexOsgi/com.raytheon.uf.edex.purgesrv/src/com/raytheon/uf/edex/purgesrv/PurgeRequest.java @@ -31,6 +31,7 @@ import com.raytheon.uf.edex.database.DataAccessLayerException; import com.raytheon.uf.edex.database.plugin.PluginDao; import com.raytheon.uf.edex.database.plugin.PluginVersionDao; import com.raytheon.uf.edex.database.purge.PurgeRule; +import com.raytheon.uf.edex.database.purge.PurgeRuleSet; /** * This class is used to route messages intended for the purge service to the @@ -70,20 +71,32 @@ public class PurgeRequest { List retVal = new ArrayList(); List plugins = getAvailablePlugins(); - for (int i = 0; i < plugins.size(); i++) { - List rules = PluginDao.getPurgeRulesForPlugin(plugins - .get(i)); - if (rules.isEmpty()) { - retVal.add(plugins.get(i)); + for (String plugin : plugins) { + PurgeRuleSet rules = PluginDao.getPurgeRulesForPlugin(plugin); + + List defRules = rules.getDefaultRules(); + List ruleList = rules.getRules(); + List purgeKeys = rules.getKeys(); + if ((defRules == null) + && ((ruleList == null) || ruleList.isEmpty())) { + retVal.add(plugin); retVal.add("No Rules Specified. Using default."); - }else{ - for (PurgeRule rule : rules) { - retVal.add(rule.getId().getPluginName()); - retVal.add(rule.getRuleDescription()); + } else { + if (defRules != null) { + for (PurgeRule rule : defRules) { + retVal.add(plugin); + retVal.add(rule.getRuleDescription(purgeKeys)); + } + } + if (ruleList != null) { + for (PurgeRule rule : ruleList) { + retVal.add(plugin); + retVal.add(rule.getRuleDescription(purgeKeys)); + } } } } - return retVal.toArray(new String[] {}); + return retVal.toArray(new String[retVal.size()]); } catch (Exception e) { throw new EdexException("Error getting plugin purge info", e); } diff --git a/edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/SiteAwareRegistry.java b/edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/SiteAwareRegistry.java index d4a94c0b57..70f2a9361b 100644 --- a/edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/SiteAwareRegistry.java +++ b/edexOsgi/com.raytheon.uf.edex.site/src/com/raytheon/uf/edex/site/SiteAwareRegistry.java @@ -60,6 +60,8 @@ import com.raytheon.uf.edex.site.SiteActivationMessage.Action; * Nov 30, 2010 rjpeter Initial creation * Jul 31, 2012 #965 dgilling Force ordering of sites in * getActiveSites(). + * Nov 1, 2012 15417 ryu Modified getActiveSites to include + * home site only if activated. * * * @@ -139,8 +141,13 @@ public class SiteAwareRegistry { public String[] getActiveSites() { // make a set of the strings for each listener site Set tmp = new LinkedHashSet(); - tmp.add(PropertiesFactory.getInstance().getEnvProperties() - .getEnvValue("SITENAME")); + String mySite = PropertiesFactory.getInstance().getEnvProperties() + .getEnvValue("SITENAME"); + for (ISiteActivationListener sa : activationListeners) { + if (sa.getActiveSites().contains(mySite)) { + tmp.add(mySite); + } + } for (ISiteActivationListener sa : activationListeners) { tmp.addAll(sa.getActiveSites()); } diff --git a/edexOsgi/com.raytheon.uf.tools.cli/impl/purgeAllModelData b/edexOsgi/com.raytheon.uf.tools.cli/impl/purgeAllModelData new file mode 100644 index 0000000000..3c62942dcb --- /dev/null +++ b/edexOsgi/com.raytheon.uf.tools.cli/impl/purgeAllModelData @@ -0,0 +1,51 @@ +#!/bin/bash +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## +############################################################################## +# This script allows you to purge all ingested data for a specified +# model. +# +# SOFTWARE HISTORY +# +# Date Ticket# Engineer Description +# ------------ ---------- ----------- -------------------------- +# 06/08/12 #674 dgilling Initial Creation. +############################################################################## + +# this allows you to run this script from outside of ./bin +path_to_script=`readlink -f $0` +RUN_FROM_DIR=`dirname $path_to_script` + +BASE_AWIPS_DIR=`dirname $RUN_FROM_DIR` + +# get the base environment +source ${RUN_FROM_DIR}/setup.env + +# setup the environment needed to run the the Python +export LD_LIBRARY_PATH=${BASE_AWIPS_DIR}/src/lib:${PYTHON_INSTALL}/lib +export PYTHONPATH=${RUN_FROM_DIR}/src:$PYTHONPATH + +# execute the ifpInit Python module +_PYTHON="${PYTHON_INSTALL}/bin/python" +_MODULE="${RUN_FROM_DIR}/src/purgeallmodeldata/purgeAllModelData.py" + +# quoting of '$@' is used to prevent command line interpretation +$_PYTHON $_MODULE -h ${DEFAULT_HOST} -p ${DEFAULT_PORT} "$@" + diff --git a/edexOsgi/com.raytheon.uf.tools.cli/impl/src/purgeallmodeldata/purgeAllModelData.py b/edexOsgi/com.raytheon.uf.tools.cli/impl/src/purgeallmodeldata/purgeAllModelData.py new file mode 100644 index 0000000000..5d89d35b26 --- /dev/null +++ b/edexOsgi/com.raytheon.uf.tools.cli/impl/src/purgeallmodeldata/purgeAllModelData.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python + +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## + +import logging + +from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.grib.request import DeleteAllModelDataRequest +from ufpy import ThriftClient +from ufpy import UsageArgumentParser + +logger = None +def __initLogger(): + global logger + logger = logging.getLogger("purgeAllModelData") + logger.setLevel(logging.DEBUG) + ch = logging.StreamHandler() + ch.setLevel(logging.INFO) + # Uncomment line below to enable debug-level logging + # ch.setLevel(logging.DEBUG) + formatter = logging.Formatter("%(asctime)s %(name)s %(levelname)s: %(message)s", "%H:%M:%S") + ch.setFormatter(formatter) + logger.addHandler(ch) + +def __parseCommandLine(): + parser = UsageArgumentParser.UsageArgumentParser(conflict_handler="resolve", prog='purgeAllModelData') + parser.add_argument("-h", action="store", dest="host", + help="Host upon which the EDEX server is running", + required=True, metavar="hostname") + parser.add_argument("-p", action="store", type=int, dest="port", + help="Port on which the EDEX server is listening", + required=True, metavar="portNumber") + parser.add_argument("-m", action="append", dest="models", + help="Name of the model to purge. Use multiple -m arguments to delete more than 1 model, but duplicate model names will be ignored.", + required=True, metavar="modelName") + options = parser.parse_args() + # Ensure no duplicates end up in the list of models + options.models = list(set(options.models)) + logger.debug("Command-line arguments: " + str(options)) + return options + +def main(): + __initLogger() + logger.info("Starting purgeAllModelData.") + options = __parseCommandLine() + + client = ThriftClient.ThriftClient(options.host, options.port) + for model in options.models: + try: + logger.info("Deleting all data for model [" + model + "]...") + req = DeleteAllModelDataRequest(model) + client.sendRequest(req) + logger.info("Model data for model [" + model + "] successfully deleted...") + except Exception: + logger.exception("Could not purge data for model [" + model + "]:") + logger.info("purgeAllModelData is complete.") + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/edexOsgi/com.raytheon.uf.tools.cli/impl/textdb b/edexOsgi/com.raytheon.uf.tools.cli/impl/textdb index 626a506bc2..3854cc0730 100755 --- a/edexOsgi/com.raytheon.uf.tools.cli/impl/textdb +++ b/edexOsgi/com.raytheon.uf.tools.cli/impl/textdb @@ -40,6 +40,8 @@ # updated path. # 09/28/10 6980 bkowal Updated LD_LIBRARY_PATH to # include path to python lib. +# 11/02/12 1236 dgilling Add --forcepractice flag to +# bypass test mode check. ############################################################################## # this allows you to run this script from outside of ./bin @@ -55,21 +57,35 @@ source ${RUN_FROM_DIR}/setup.env export LD_LIBRARY_PATH=${BASE_AWIPS_DIR}/src/lib:${PYTHON_INSTALL}/lib export PYTHONPATH=${RUN_FROM_DIR}/src:$PYTHONPATH -TESTCHECK="${TCMP_HOME}/bin/getTestMode" -if [ -x ${TESTCHECK} ]; then - ${TESTCHECK} - status=${?} - if [ $status -eq 11 ]; then - export OPERATIONAL_MODE="TRUE" - elif [ $status -eq 12 ]; then - export OPERATIONAL_MODE="FALSE" - elif [ $status -eq 15 ]; then - export OPERATIONAL_MODE="TRUE" +forcePractice="FALSE" +declare -a parsedArgs +for flag in $@; do + if [ $flag == "--forcepractice" ]; then + forcePractice="TRUE" + else + parsedArgs=("${parsedArgs[@]}" $flag) + fi +done + +if [ $forcePractice != "TRUE" ]; then + TESTCHECK="${TCMP_HOME}/bin/getTestMode" + if [ -x ${TESTCHECK} ]; then + ${TESTCHECK} + status=${?} + if [ $status -eq 11 ]; then + export OPERATIONAL_MODE="TRUE" + elif [ $status -eq 12 ]; then + export OPERATIONAL_MODE="FALSE" + elif [ $status -eq 15 ]; then + export OPERATIONAL_MODE="TRUE" + else + export OPERATIONAL_MODE="TRUE" + fi else export OPERATIONAL_MODE="TRUE" fi else - export OPERATIONAL_MODE="TRUE" + export OPERATIONAL_MODE="FALSE" fi # execute the textdb Python module @@ -77,5 +93,5 @@ _PYTHON="${PYTHON_INSTALL}/bin/python" _MODULE="${RUN_FROM_DIR}/src/textdb/TextDB.py" # quoting of '$@' is used to prevent command line interpretation -$_PYTHON $_MODULE "$@" +$_PYTHON $_MODULE "${parsedArgs[@]}" diff --git a/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/rsyncGridsToCWF.sh b/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/rsyncGridsToCWF.sh index 9b01df9704..c89aa0c53c 100644 --- a/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/rsyncGridsToCWF.sh +++ b/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/rsyncGridsToCWF.sh @@ -8,9 +8,9 @@ # Authors: Virgil Middendorf (BYZ), Steve Sigler (MSO) # # Contributers: Ahmad Garabi, Ken Sargeant, Dave Pike, Dave Rosenberg, # # Tim Barker, Maureen Ballard, Jay Smith, Dave Tomalak, # -# Evelyn Bersack, # +# Evelyn Bersack, Juliya Dynina # # # -# Date of last revision: 07/07/11 # +# Date of last revision: 11/02/12 # # # # Script description: This script can create a netcdf file containing IFPS # # grids, quality control the netcdf file, send the file to a local rsync # @@ -141,6 +141,7 @@ # 04/16/12: Added a little error checking for work directory and replaced # # the hard-coded path to /awips2/fxa/bin with $FXA_BIN. Removed # # awips1 code. # +# 11/02/12: Restored error checking for AWIPS2. # ################################################################################ # check to see if site id was passed as argument # if not then exit from the script @@ -227,7 +228,7 @@ cdfTimeRange="-s ${start_time} -e ${end_time} " # The script will attempt to create the netcdf file three times before failing. creationAttemptCount=1 badGridFlag=1 -while (( ( $creationAttemptCount <= creationAttempts ) && ( $badGridFlag == 1 ) )) +while (( ( $creationAttemptCount <= $creationAttempts ) && ( $badGridFlag == 1 ) )) do # create the netcdf file echo starting netcdf file creation...attempt number ${creationAttemptCount} at $(date) >> $LOG_FILE @@ -239,7 +240,7 @@ do if (( filesize < 1000000 )) ;then echo $filesize >> $LOG_FILE if [[ $turnOffAllNotifications == "no" ]] ;then - ${FXA_BIN}/sendNotificationMsg ANNOUNCER LOCAL ${probAlertNum} "${SITE} netcdf file determined to be incomplete and not sent to webfarms. Did you publish to official?" + ${GFESUITE_BIN}/sendGfeMessage -h ${CDSHOST} -c NDFD -m "${SITE} netcdf file determined to be incomplete and not sent to webfarms. Did you publish to official?" -s fi rm -f ${WRKDIR}/CurrentFcst.$$.${site}.cdf echo netcdf file is too small. Either the Official database is empty OR EDEX is down. >> $LOG_FILE @@ -253,25 +254,21 @@ do ############################################## # STOP HERE RIGHT NOW ############################################## - if [[ $QCnetCDF == "yes" ]] ;then #Check netcdf file for errors. echo started netcdf file checking at $(date) >> $LOG_FILE - ${GFESUITE_BIN}/iscMosaic -h $CDSHOST $parmlist -f ${WRKDIR}/CurrentFcst.$$.${site}.cdf -d ${SITE}_GRID_Test_Fcst_00000000_0000 -D $iscMosaicDelay >> ${WRKDIR}/iscmosaicOutput.$$ 2>&1 + ${GFESUITE_BIN}/iscMosaic -h $CDSHOST $parmlist -f ${WRKDIR}/CurrentFcst.$$.${site}.cdf -d ${SITE}_GRID_Test_Fcst_00000000_0000 -D $iscMosaicDelay -# cd $runDir - iscmosaicError=$(cat ${WRKDIR}/iscmosaicOutput.$$ | grep Failure) - if [[ $iscmosaicError != "" ]] ;then - echo "isc error|${iscmosaicError}|" >> $LOG_FILE + if [[ $? > 0 ]] ;then if [[ $creationAttemptCount == $creationAttempts ]] ;then if [[ $turnOffAllNotifications == "no" ]] ;then - ${FXA_BIN}/sendNotificationMsg ANNOUNCER LOCAL 1 "Errors detected in ${SITE} netcdf file again and not sent to webfarms. Send Grids Manually." + ${GFESUITE_BIN}/sendGfeMessage -h ${CDSHOST} -c NDFD -m "Errors detected in ${SITE} netcdf file again and not sent to webfarms. Send Grids Manually." -s fi echo "Errors detected in ${SITE} netcdf file again and not sent to webfarms. Script stopped." >> $LOG_FILE exit else if [[ $turnOffAllNotifications == "no" ]] ;then - ${FXA_BIN}/sendNotificationMsg ANNOUNCER LOCAL 1 "Errors detected in ${SITE} netcdf file again. Regenerating netcdf file attempt # ${creationAttemptCount}." + ${GFESUITE_BIN}/sendGfeMessage -h ${CDSHOST} -c NDFD -m "Errors detected in ${SITE} netcdf file again. Regenerating netcdf file attempt # ${creationAttemptCount}." -s fi echo "Errors detected in ${SITE} netcdf file. Regenerating netcdf file." >> $LOG_FILE fi @@ -281,7 +278,6 @@ do echo The netcdf file appears to be good. >> $LOG_FILE badGridFlag=0 fi - rm -f ${WRKDIR}/iscmosaicOutput.$$ else echo netcdf file checking bypassed at $(date) >> $LOG_FILE badGridFlag=0 @@ -330,10 +326,31 @@ echo ...finished. >> $LOG_FILE echo " " >> $LOG_FILE # move optimized netcdf file to the local rsync server. -echo trying to scp optimized netcdf file to $locServer at $(date) >> $LOG_FILE -scp ${WRKDIR}/CurrentFcst.$$.${site}.opt.cdf.gz ${locServer}:${locDirectory}/${site} >> $LOG_FILE 2>&1 -echo ...finished. >> $LOG_FILE -echo " " >> $LOG_FILE +for i in 1 2 3 +do + CHK=`ssh -q -o "BatchMode yes" -o "ConnectTimeout 5" $locServer "echo success"`; + if [ "success" = $CHK ] >/dev/null 2>&1 + then + echo attempt $i to scp optimized netcdf file to $locServer at $(date) >> $LOG_FILE + scp ${WRKDIR}/CurrentFcst.$$.${site}.opt.cdf.gz ${locServer}:${locDirectory}/${site} >> $LOG_FILE 2>&1 + echo ...finished. >> $LOG_FILE + echo " " >> $LOG_FILE + break + fi + + # failed to connect - wait 5 seconds and try again + sleep 5 +done + +if [[ $CHK != "success" ]] ;then + if [[ $turnOffAllNotifications == "no" ]] ;then + ${GFESUITE_BIN}/sendGfeMessage -h ${CDSHOST} -c NDFD -m "Failed to send optimized netcdf file to $locServer. Script stopped." -s + fi + # cleanup the zipped optimized file on AWIPS + rm -f ${WRKDIR}/CurrentFcst.$$.${site}.opt.cdf.gz + echo "Failed to send optimized netcdf file to $locServer at $(date). Script stopped." >> $LOG_FILE + exit 1 +fi # cleaning up the zipped optimized file on AWIPS. echo cleaning up the zipped optimized file on AWIPS at $(date) >> $LOG_FILE @@ -345,7 +362,7 @@ echo " " >> $LOG_FILE if [[ $SendQCgoodNotification == "yes" ]] ;then echo sending forecaster notification that QC passed at $(date) >> $LOG_FILE if [[ $turnOffAllNotifications == "no" ]] ;then - ${FXA_BIN}/sendNotificationMsg ANNOUNCER LOCAL 1 "${SITE} netcdf file passed quality control check. Now rsyncing the file to the webfarms." + ${GFESUITE_BIN}/sendGfeMessage -h ${CDSHOST} -c NDFD -m "${SITE} netcdf file passed quality control check. Now rsyncing the file to the webfarms." -s fi echo ...finished. >> $LOG_FILE echo " " >> $LOG_FILE @@ -386,7 +403,7 @@ do echo Waited more than $rsyncWait minutes to start a rsync to the Web Farm >> $LOG_FILE echo but another rsync process is still running - so could not. >> $LOG_FILE if [[ $turnOffAllNotifications == "no" ]] ;then - ${FXA_BIN}/sendNotificationMsg ANNOUNCER LOCAL 1 "${SITE} GFE netcdf file NOT sent to the Consolidated web farm. Another rsync process blocked transfer." + ${GFESUITE_BIN}/sendGfeMessage -h ${CDSHOST} -c NDFD -m "${SITE} GFE netcdf file NOT sent to the Consolidated web farm. Another rsync process blocked transfer." -s fi rsync_ok="no" break @@ -427,7 +444,7 @@ do msg=$(ssh $locServer ${locDirectory}/checkCWFGrids.pl ${SITE}) if [[ $msg != "" ]] ;then if [[ $turnOffAllNotifications == "no" ]] ;then - ${FXA_BIN}/sendNotificationMsg ANNOUNCER LOCAL ${probAlertNum} "${msg}" + ${GFESUITE_BIN}/sendGfeMessage -h ${CDSHOST} -c NDFD -m "${msg}" -s fi echo Detected that grids did NOT make it to the Consolidated web farm at $(date) >> $LOG_FILE echo "${msg}" >> $LOG_FILE @@ -451,7 +468,7 @@ do if [[ $sendCWFnotification == "yes" ]] ;then echo Detected that grids DID make it to the consolidated web farm at $(date) >> $LOG_FILE if [[ $turnOffAllNotifications == "no" ]] ;then - ${FXA_BIN}/sendNotificationMsg ANNOUNCER LOCAL 1 "${SITE} GFE netcdf file sent to the consolidated web farm." + ${GFESUITE_BIN}/sendGfeMessage -h ${CDSHOST} -c NDFD -m "${SITE} GFE netcdf file sent to the consolidated web farm." -s fi fi fi @@ -460,14 +477,14 @@ do if [[ $sendCWFnotification == "yes" ]] ;then echo Detected that grids DID make it to the consolidated web farm at $(date) >> $LOG_FILE if [[ $turnOffAllNotifications == "no" ]] ;then - ${FXA_BIN}/sendNotificationMsg ANNOUNCER LOCAL 1 "${SITE} GFE netcdf file sent to the consolidated web farm." + ${GFESUITE_BIN}/sendGfeMessage -h ${CDSHOST} -c NDFD -m "${SITE} GFE netcdf file sent to the consolidated web farm." -s fi fi fi if [[ ( $rsyncAttempt > 5 ) && ( $rsyncCompleted = 0) ]] ;then rsyncCompleted=1 if [[ $turnOffAllNotifications == "no" ]] ;then - ${FXA_BIN}/sendNotificationMsg ANNOUNCER LOCAL ${probAlertNum} "${SITE} GFE netcdf file was NOT sent to the Consolidated Web Farm, because rsync connection is broken." + ${GFESUITE_BIN}/sendGfeMessage -h ${CDSHOST} -c NDFD -m "${SITE} GFE netcdf file was NOT sent to the Consolidated Web Farm, because rsync connection is broken." -s fi echo Detected that grids did NOT make it to the Consolidated web farm at $(date) >> $LOG_FILE fi diff --git a/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/src/ifpservertext/ifpServerText.py b/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/src/ifpservertext/ifpServerText.py index 754120700b..75c9ce4c2d 100644 --- a/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/src/ifpservertext/ifpServerText.py +++ b/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/src/ifpservertext/ifpServerText.py @@ -111,7 +111,7 @@ class ifpServerText: "EditAreaGroup": ("COMMON_STATIC", "gfe/editAreaGroups"), "SampleSet": ("COMMON_STATIC", "gfe/sampleSets"), "ColorTable": ("CAVE_STATIC", "colormaps/GFE"), - "WeatherElementGroup": ("COMMON_STATIC", "gfe/weGroups"), + "WeatherElementGroup": ("CAVE_STATIC", "gfe/weGroups"), "SelectTR": ("COMMON_STATIC", "gfe/text/selecttr"), "Tool": ("CAVE_STATIC", "gfe/userPython/smartTools"), "Procedure": ("CAVE_STATIC", "gfe/userPython/procedures"), @@ -770,4 +770,4 @@ def main(): if __name__ == "__main__": main() - \ No newline at end of file + diff --git a/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/src/sendgfemessage/sendGfeMessage.py b/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/src/sendgfemessage/sendGfeMessage.py index 94421881f2..5ad2abf5b0 100755 --- a/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/src/sendgfemessage/sendGfeMessage.py +++ b/edexOsgi/com.raytheon.uf.tools.gfesuite/cli/src/sendgfemessage/sendGfeMessage.py @@ -72,7 +72,7 @@ def main(): # Currently sendNotificationMsg requires the optional (flag) arguments # be placed prior to the positional arguments. - commandLine = "sendNotificationMsg" + commandLine = "/awips2/fxa/bin/sendNotificationMsg" if options.host is not None: commandLine += " --host=" + options.host if options.port is not None: @@ -83,4 +83,4 @@ def main(): os.system(commandLine) if __name__ == "__main__": - main() \ No newline at end of file + main() diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.airmet/utility/common_static/base/purge/airmetPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.airmet/utility/common_static/base/purge/airmetPurgeRules.xml index 231d8d228d..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.airmet/utility/common_static/base/purge/airmetPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.airmet/utility/common_static/base/purge/airmetPurgeRules.xml @@ -1,10 +1,6 @@ - - - - airmet - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.atcf/utility/common_static/base/purge/atcfPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.atcf/utility/common_static/base/purge/atcfPurgeRules.xml index 7233168ff6..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.atcf/utility/common_static/base/purge/atcfPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.atcf/utility/common_static/base/purge/atcfPurgeRules.xml @@ -1,10 +1,6 @@ - - - - atcf - default - + + 02-00:00:00 - + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.aww/utility/common_static/base/purge/awwPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.aww/utility/common_static/base/purge/awwPurgeRules.xml index 18246e2fee..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.aww/utility/common_static/base/purge/awwPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.aww/utility/common_static/base/purge/awwPurgeRules.xml @@ -1,10 +1,6 @@ - - - - aww - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.convsigmet/utility/common_static/base/purge/convsigmetPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.convsigmet/utility/common_static/base/purge/convsigmetPurgeRules.xml index 607053c111..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.convsigmet/utility/common_static/base/purge/convsigmetPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.convsigmet/utility/common_static/base/purge/convsigmetPurgeRules.xml @@ -1,10 +1,6 @@ - - - - convsigmet - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ffg/utility/common_static/base/purge/ffgPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ffg/utility/common_static/base/purge/ffgPurgeRules.xml index ef81f2842c..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ffg/utility/common_static/base/purge/ffgPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.ffg/utility/common_static/base/purge/ffgPurgeRules.xml @@ -1,10 +1,6 @@ - - - - ffg - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.idft/utility/common_static/base/purge/idftPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.idft/utility/common_static/base/purge/idftPurgeRules.xml index 1fea1f8e9a..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.idft/utility/common_static/base/purge/idftPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.idft/utility/common_static/base/purge/idftPurgeRules.xml @@ -1,10 +1,6 @@ - - - - idft - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.intlsigmet/utility/common_static/base/purge/intlsigmetPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.intlsigmet/utility/common_static/base/purge/intlsigmetPurgeRules.xml index ec52166237..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.intlsigmet/utility/common_static/base/purge/intlsigmetPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.intlsigmet/utility/common_static/base/purge/intlsigmetPurgeRules.xml @@ -1,10 +1,6 @@ - - - - intlsigmet - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.mcidas/utility/common_static/base/purge/mcidasPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.mcidas/utility/common_static/base/purge/mcidasPurgeRules.xml index 826cd1c2f9..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.mcidas/utility/common_static/base/purge/mcidasPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.mcidas/utility/common_static/base/purge/mcidasPurgeRules.xml @@ -1,10 +1,6 @@ - - - - mcidas - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.mosaic/utility/common_static/base/purge/mosaicPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.mosaic/utility/common_static/base/purge/mosaicPurgeRules.xml index 4b3fbc3ad3..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.mosaic/utility/common_static/base/purge/mosaicPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.mosaic/utility/common_static/base/purge/mosaicPurgeRules.xml @@ -1,10 +1,6 @@ - - - - mosaic - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncairep/utility/common_static/base/purge/ncairepPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncairep/utility/common_static/base/purge/ncairepPurgeRules.xml index c46545c6f1..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncairep/utility/common_static/base/purge/ncairepPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.ncairep/utility/common_static/base/purge/ncairepPurgeRules.xml @@ -1,10 +1,6 @@ - - - - ncairep - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/utility/common_static/base/purge/ncccfpPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/utility/common_static/base/purge/ncccfpPurgeRules.xml index b5df5f2bf5..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/utility/common_static/base/purge/ncccfpPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.ncccfp/utility/common_static/base/purge/ncccfpPurgeRules.xml @@ -1,10 +1,6 @@ - - - - ncccfp - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncgrib/utility/common_static/base/purge/ncgribPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncgrib/utility/common_static/base/purge/ncgribPurgeRules.xml index fc4036ff66..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncgrib/utility/common_static/base/purge/ncgribPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.ncgrib/utility/common_static/base/purge/ncgribPurgeRules.xml @@ -1,10 +1,6 @@ - - - - ncgrib - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpafm/utility/common_static/base/purge/ncpafmPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncpafm/utility/common_static/base/purge/ncpafmPurgeRules.xml index 7dbdccaa38..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpafm/utility/common_static/base/purge/ncpafmPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.ncpafm/utility/common_static/base/purge/ncpafmPurgeRules.xml @@ -1,10 +1,6 @@ - - - - ncpafm - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/utility/common_static/base/purge/ncpirepPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/utility/common_static/base/purge/ncpirepPurgeRules.xml index 7688e13c5a..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/utility/common_static/base/purge/ncpirepPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.ncpirep/utility/common_static/base/purge/ncpirepPurgeRules.xml @@ -1,10 +1,6 @@ - - - - ncpirep - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncscat/utility/common_static/base/purge/ncscatPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncscat/utility/common_static/base/purge/ncscatPurgeRules.xml index 35e8b4f8b3..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncscat/utility/common_static/base/purge/ncscatPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.ncscat/utility/common_static/base/purge/ncscatPurgeRules.xml @@ -1,10 +1,6 @@ - - - - ncscat - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncscd/utility/common_static/base/purge/ncscdPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncscd/utility/common_static/base/purge/ncscdPurgeRules.xml index f1d6e14871..1182b36c71 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncscd/utility/common_static/base/purge/ncscdPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.ncscd/utility/common_static/base/purge/ncscdPurgeRules.xml @@ -1,12 +1,8 @@ - - - - ncscd - default - + + 24 =00-01:00:00 00-01:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.nctaf/utility/common_static/base/purge/nctafPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.nctaf/utility/common_static/base/purge/nctafPurgeRules.xml index 22b03c216c..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.nctaf/utility/common_static/base/purge/nctafPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.nctaf/utility/common_static/base/purge/nctafPurgeRules.xml @@ -1,10 +1,6 @@ - - - - nctaf - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ncuair/utility/common_static/base/purge/ncuairPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ncuair/utility/common_static/base/purge/ncuairPurgeRules.xml index 29ca43c402..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ncuair/utility/common_static/base/purge/ncuairPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.ncuair/utility/common_static/base/purge/ncuairPurgeRules.xml @@ -1,10 +1,6 @@ - - - - ncuair - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.nonconvsigmet/utility/common_static/base/purge/nonconvsigmetPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.nonconvsigmet/utility/common_static/base/purge/nonconvsigmetPurgeRules.xml index d59b31d88b..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.nonconvsigmet/utility/common_static/base/purge/nonconvsigmetPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.nonconvsigmet/utility/common_static/base/purge/nonconvsigmetPurgeRules.xml @@ -1,10 +1,6 @@ - - - - nonconvsigmet - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.sgwh/utility/common_static/base/purge/sgwhPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.sgwh/utility/common_static/base/purge/sgwhPurgeRules.xml index 6326568e5c..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.sgwh/utility/common_static/base/purge/sgwhPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.sgwh/utility/common_static/base/purge/sgwhPurgeRules.xml @@ -1,10 +1,6 @@ - - - - sgwh - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.sgwhv/utility/common_static/base/purge/sgwhvPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.sgwhv/utility/common_static/base/purge/sgwhvPurgeRules.xml index 71a920d434..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.sgwhv/utility/common_static/base/purge/sgwhvPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.sgwhv/utility/common_static/base/purge/sgwhvPurgeRules.xml @@ -1,10 +1,6 @@ - - - - sgwhv - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.ssha/utility/common_static/base/purge/sshaPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.ssha/utility/common_static/base/purge/sshaPurgeRules.xml index 65d1c786b5..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.ssha/utility/common_static/base/purge/sshaPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.ssha/utility/common_static/base/purge/sshaPurgeRules.xml @@ -1,10 +1,6 @@ - - - - ssha - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.stormtrack/utility/common_static/base/purge/stormTrackPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.stormtrack/utility/common_static/base/purge/stormTrackPurgeRules.xml index 250c5b6974..62b81678f1 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.stormtrack/utility/common_static/base/purge/stormTrackPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.stormtrack/utility/common_static/base/purge/stormTrackPurgeRules.xml @@ -1,10 +1,6 @@ - - - - stormtrack - default - + + 99-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.tcm/utility/common_static/base/purge/tcmPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.tcm/utility/common_static/base/purge/tcmPurgeRules.xml index 3e048a6272..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.tcm/utility/common_static/base/purge/tcmPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.tcm/utility/common_static/base/purge/tcmPurgeRules.xml @@ -1,10 +1,6 @@ - - - - tcm - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.edex.plugin.wcp/utility/common_static/base/purge/wcpPurgeRules.xml b/ncep/gov.noaa.nws.ncep.edex.plugin.wcp/utility/common_static/base/purge/wcpPurgeRules.xml index 91b796c037..8ec526365d 100644 --- a/ncep/gov.noaa.nws.ncep.edex.plugin.wcp/utility/common_static/base/purge/wcpPurgeRules.xml +++ b/ncep/gov.noaa.nws.ncep.edex.plugin.wcp/utility/common_static/base/purge/wcpPurgeRules.xml @@ -1,10 +1,6 @@ - - - - wcp - default - + + 02-00:00:00 - - \ No newline at end of file + + diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpDataPaneResource.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpDataPaneResource.java index dd6fed3b89..b3bb1653eb 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpDataPaneResource.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpDataPaneResource.java @@ -869,8 +869,8 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{ //font10.dispose(); } @SuppressWarnings("deprecation") - private void drawPanel2(IGraphicsTarget target, Rectangle rect) - throws VizException { + private void drawPanel2(IGraphicsTarget target, Rectangle rect) throws VizException + { /* * Chin's NOTE:::: * This pages based on BigNsharp @@ -1070,7 +1070,7 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{ nsharpNative.nsharpLib.get_lpvaluesData(lpvls); } // set parcel back to user selection - if (oldlplchoice == 1) + /*if (oldlplchoice == 1) pres = 0; else if (oldlplchoice == 2) pres = 0; @@ -1081,11 +1081,30 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{ else if (oldlplchoice == 5) pres = NsharpNativeConstants.USER_LAYER; else if (oldlplchoice == 6) - pres = NsharpNativeConstants.MU_LAYER; + pres = NsharpNativeConstants.MU_LAYER;*/ //System.out.println("drawPanel2-2 called define_parcel pType="+oldlplchoice+" pre="+ pres); - - nsharpNative.nsharpLib.define_parcel(oldlplchoice, pres); - } + try{ + if(oldlplchoice == NsharpNativeConstants.PARCELTYPE_USER_DEFINED){ + if(NsharpParcelDialog.getAccess() != null){ + pres = NsharpParcelDialog.getAccess().getUserDefdParcelMb(); + } + else + pres = NsharpNativeConstants.parcelToLayerMap.get(oldlplchoice); + } + else + pres = NsharpNativeConstants.parcelToLayerMap.get(oldlplchoice); + + //reset and define oldchoice parcel + nsharpNative.nsharpLib.define_parcel(oldlplchoice,pres); + } + catch (NullPointerException e) { + // when in changing pane configuration situation, an odd scenario may happened that + // "oldlplchoice" may be a null, and parcelToLayerMap.get(oldlplchoice); throws a + // NullPointerException. In that case, we do not re-define_parcel and continue on + e.printStackTrace(); + } + + } else { h1 = NsharpNativeConstants.STORM_MOTION_HEIGHT2[i][0]; h2 = NsharpNativeConstants.STORM_MOTION_HEIGHT2[i][1]; @@ -3267,6 +3286,10 @@ public class NsharpDataPaneResource extends NsharpAbstractPaneResource{ //Chin Note; ext size is its view size Not canvas size IExtent ext = getDescriptor().getRenderableDisplay().getExtent(); ext.reset(); + this.rectangle = new Rectangle((int)ext.getMinX(), (int) ext.getMinY(), + (int) ext.getWidth(), (int) ext.getHeight()); + pe = new PixelExtent(this.rectangle); + getDescriptor().setNewPe(pe); defineCharHeight(font10); float prevHeight = dataPaneHeight; float prevWidth = dataPaneWidth; diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java index 9e23f9aab7..dc24c41e2a 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpResourceHandler.java @@ -1535,7 +1535,8 @@ public class NsharpResourceHandler { if(soundMap.size() <=0 || (skewtPaneRsc==null)){ return; } - if(timeLineStateList.isEmpty() || stnStateList.isEmpty()){ + if(timeLineStateList.isEmpty() || stnStateList.isEmpty() || + currentTimeLineStateListIndex < 0 || currentStnStateListIndex < 0){ //if no data was loaded since, then display this data any way displayNewData = true; } diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpTimeStnPaneResource.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpTimeStnPaneResource.java index 40e438f82b..c3da6bbc6d 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpTimeStnPaneResource.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpTimeStnPaneResource.java @@ -443,7 +443,10 @@ public class NsharpTimeStnPaneResource extends NsharpAbstractPaneResource{ super.handleResize(); IExtent ext = getDescriptor().getRenderableDisplay().getExtent(); ext.reset(); - + this.rectangle = new Rectangle((int)ext.getMinX(), (int) ext.getMinY(), + (int) ext.getWidth(), (int) ext.getHeight()); + pe = new PixelExtent(this.rectangle); + getDescriptor().setNewPe(pe); defineCharHeight(font10); //rscHandler.setCharHeight(charHeight); float prevHeight = paneHeight; diff --git a/ost/gov.noaa.nws.ost.edex.plugin.regionalsat/utility/common_static/base/purge/regionalsatPurgeRules.xml b/ost/gov.noaa.nws.ost.edex.plugin.regionalsat/utility/common_static/base/purge/regionalsatPurgeRules.xml index fbed4d37d9..b77fc3adbb 100644 --- a/ost/gov.noaa.nws.ost.edex.plugin.regionalsat/utility/common_static/base/purge/regionalsatPurgeRules.xml +++ b/ost/gov.noaa.nws.ost.edex.plugin.regionalsat/utility/common_static/base/purge/regionalsatPurgeRules.xml @@ -1,164 +1,118 @@ - - - - satellite - default - + + creatingEntity + physicalElement + 24 - + - - satellite - creatingEntity=HRPT;physicalElement=Imager 11 micron IR - + HRPT + Imager 11 micron IR 48 - - satellite - creatingEntity=HRPT;physicalElement=Imager Channel 4-5 IR - - 48 - - - - satellite - creatingEntity=HRPT;physicalElement=Imager 3.9 micron IR - + HRPT + Imager Channel 4-5 IR 48 - - satellite - creatingEntity=HRPT;physicalElement=Imager 3 Channel Diff - + HRPT + Imager 3.9 micron IR 48 - - satellite - creatingEntity=HRPT;physicalElement=Imager Visible - + HRPT + Imager 3 Channel Diff 48 - - satellite - creatingEntity=MTSAT;physicalElement=Imager 11 micron IR - + HRPT + Imager Visible 48 - - satellite - creatingEntity=MTSAT;physicalElement=Imager Visible - + MTSAT + Imager 11 micron IR 48 - - satellite - creatingEntity=MTSAT;physicalElement=Imager Channel 4-5 IR - + MTSAT + Imager Visible 48 - - satellite - creatingEntity=GVAR;physicalElement=Imager 11 micron IR - + MTSAT + Imager Channel 4-5 IR 48 - - satellite - creatingEntity=GVAR;physicalElement=Imager 3.9 micron IR - + GVAR + Imager 11 micron IR 48 - - satellite - creatingEntity=GVAR;physicalElement=Imager Visible - + GVAR + Imager 3.9 micron IR 48 - - satellite - creatingEntity=GVAR;physicalElement=Imager 6.7-6.5 micron IR (WV) - + GVAR + Imager Visible 48 - - satellite - creatingEntity=DMSP;physicalElement=Imager Visible - + GVAR + Imager 6.7-6.5 micron IR (WV) 48 - - satellite - creatingEntity=DMSP;physicalElement=Imager 11 micron IR - + DMSP + Imager Visible 48 - - satellite - creatingEntity=FY1C;physicalElement=Imager 11 micron IR - + DMSP + Imager 11 micron IR 48 - - satellite - creatingEntity=FY1C;physicalElement=Imager Channel 4-5 IR - + FY1C + Imager 11 micron IR 48 - - satellite - creatingEntity=FY1C;physicalElement=Imager 3 Channel Diff - + FY1C + Imager Channel 4-5 IR 48 - - satellite - creatingEntity=FY1C;physicalElement=Imager Visible - + FY1C + Imager 3 Channel Diff 48 - - satellite - creatingEntity=FY3C;physicalElement=Imager 11 micron IR - + FY1C + Imager Visible 48 - - satellite - creatingEntity=FY3C;physicalElement=Imager Channel 4-5 IR - + FY3C + Imager 11 micron IR 48 - - satellite - creatingEntity=FY3C;physicalElement=Imager 3 Channel Diff - + FY3C + Imager Channel 4-5 IR 48 - - satellite - creatingEntity=FY3C;physicalElement=Imager Visible - + FY3C + Imager 3 Channel Diff 48 - + + + FY3C + Imager Visible + 48 + diff --git a/ost/gov.noaa.nws.ost.edex.plugin.regionalsat/utility/common_static/site/AFC/purge/regionalsatPurgeRules.xml b/ost/gov.noaa.nws.ost.edex.plugin.regionalsat/utility/common_static/site/AFC/purge/regionalsatPurgeRules.xml index fbed4d37d9..b77fc3adbb 100644 --- a/ost/gov.noaa.nws.ost.edex.plugin.regionalsat/utility/common_static/site/AFC/purge/regionalsatPurgeRules.xml +++ b/ost/gov.noaa.nws.ost.edex.plugin.regionalsat/utility/common_static/site/AFC/purge/regionalsatPurgeRules.xml @@ -1,164 +1,118 @@ - - - - satellite - default - + + creatingEntity + physicalElement + 24 - + - - satellite - creatingEntity=HRPT;physicalElement=Imager 11 micron IR - + HRPT + Imager 11 micron IR 48 - - satellite - creatingEntity=HRPT;physicalElement=Imager Channel 4-5 IR - - 48 - - - - satellite - creatingEntity=HRPT;physicalElement=Imager 3.9 micron IR - + HRPT + Imager Channel 4-5 IR 48 - - satellite - creatingEntity=HRPT;physicalElement=Imager 3 Channel Diff - + HRPT + Imager 3.9 micron IR 48 - - satellite - creatingEntity=HRPT;physicalElement=Imager Visible - + HRPT + Imager 3 Channel Diff 48 - - satellite - creatingEntity=MTSAT;physicalElement=Imager 11 micron IR - + HRPT + Imager Visible 48 - - satellite - creatingEntity=MTSAT;physicalElement=Imager Visible - + MTSAT + Imager 11 micron IR 48 - - satellite - creatingEntity=MTSAT;physicalElement=Imager Channel 4-5 IR - + MTSAT + Imager Visible 48 - - satellite - creatingEntity=GVAR;physicalElement=Imager 11 micron IR - + MTSAT + Imager Channel 4-5 IR 48 - - satellite - creatingEntity=GVAR;physicalElement=Imager 3.9 micron IR - + GVAR + Imager 11 micron IR 48 - - satellite - creatingEntity=GVAR;physicalElement=Imager Visible - + GVAR + Imager 3.9 micron IR 48 - - satellite - creatingEntity=GVAR;physicalElement=Imager 6.7-6.5 micron IR (WV) - + GVAR + Imager Visible 48 - - satellite - creatingEntity=DMSP;physicalElement=Imager Visible - + GVAR + Imager 6.7-6.5 micron IR (WV) 48 - - satellite - creatingEntity=DMSP;physicalElement=Imager 11 micron IR - + DMSP + Imager Visible 48 - - satellite - creatingEntity=FY1C;physicalElement=Imager 11 micron IR - + DMSP + Imager 11 micron IR 48 - - satellite - creatingEntity=FY1C;physicalElement=Imager Channel 4-5 IR - + FY1C + Imager 11 micron IR 48 - - satellite - creatingEntity=FY1C;physicalElement=Imager 3 Channel Diff - + FY1C + Imager Channel 4-5 IR 48 - - satellite - creatingEntity=FY1C;physicalElement=Imager Visible - + FY1C + Imager 3 Channel Diff 48 - - satellite - creatingEntity=FY3C;physicalElement=Imager 11 micron IR - + FY1C + Imager Visible 48 - - satellite - creatingEntity=FY3C;physicalElement=Imager Channel 4-5 IR - + FY3C + Imager 11 micron IR 48 - - satellite - creatingEntity=FY3C;physicalElement=Imager 3 Channel Diff - + FY3C + Imager Channel 4-5 IR 48 - - satellite - creatingEntity=FY3C;physicalElement=Imager Visible - + FY3C + Imager 3 Channel Diff 48 - + + + FY3C + Imager Visible + 48 + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/__init__.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/__init__.py index 5b50d7706f..f73c59de6b 100644 --- a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/__init__.py +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/__init__.py @@ -21,7 +21,8 @@ # File auto-generated by PythonFileGenerator __all__ = [ - 'gfe' + 'gfe', + 'grib' ] diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/AbstractGfeRequest.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/AbstractGfeRequest.py new file mode 100644 index 0000000000..057decc980 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/AbstractGfeRequest.py @@ -0,0 +1,44 @@ +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## + +# File auto-generated against equivalent DynamicSerialize Java class + +import abc + + +class AbstractGfeRequest(object): + __metaclass__ = abc.ABCMeta + + @abc.abstractmethod + def __init__(self): + self.siteID = None + self.workstationID = None + + def getSiteID(self): + return self.siteID + + def setSiteID(self, siteID): + self.siteID = siteID + + def getWorkstationID(self): + return self.workstationID + + def setWorkstationID(self, workstationID): + self.workstationID = workstationID diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/ClearPracticeVTECTableRequest.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/ClearPracticeVTECTableRequest.py new file mode 100644 index 0000000000..a478846e05 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/ClearPracticeVTECTableRequest.py @@ -0,0 +1,45 @@ +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## + +# File auto-generated against equivalent DynamicSerialize Java class + +from dynamicserialize.dstypes.com.raytheon.uf.common.dataplugin.gfe.request import AbstractGfeRequest + + +class ClearPracticeVTECTableRequest(AbstractGfeRequest): + + def __init__(self): + super(ClearPracticeVTECTableRequest, self).__init__() + self.requestedSiteId = None + self.mode = None + + def getRequestedSiteId(self): + return self.requestedSiteId + + def setRequestedSiteId(self, requestedSiteId): + self.requestedSiteId = requestedSiteId + + def getMode(self): + return self.mode + + def setMode(self, mode): + if mode not in ['OPERATIONAL', 'PRACTICE']: + raise ValueError("Invalid value " + mode + " specified for ActiveTableMode.") + self.mode = mode diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/__init__.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/__init__.py index c969f576df..254921cff2 100644 --- a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/__init__.py +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/request/__init__.py @@ -21,6 +21,8 @@ # File auto-generated by PythonFileGenerator __all__ = [ + 'AbstractGfeRequest', + 'ClearPracticeVTECTableRequest', 'CommitGridsRequest', 'ConfigureTextProductsRequest', 'CreateNetCDFGridRequest', @@ -48,6 +50,8 @@ __all__ = [ ] from CommitGridsRequest import CommitGridsRequest +from AbstractGfeRequest import AbstractGfeRequest +from ClearPracticeVTECTableRequest import ClearPracticeVTECTableRequest from ConfigureTextProductsRequest import ConfigureTextProductsRequest from CreateNetCDFGridRequest import CreateNetCDFGridRequest from ExecuteIscMosaicRequest import ExecuteIscMosaicRequest diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/message/ServerResponse.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/message/ServerResponse.py index 3a0b745cd4..80f8fd0a17 100644 --- a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/message/ServerResponse.py +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/gfe/server/message/ServerResponse.py @@ -56,4 +56,7 @@ class ServerResponse(object): for serverMsg in self.messages: compMessage += serverMsg.getMessage() + "\n" - return compMessage \ No newline at end of file + return compMessage + + def __str__(self): + return self.message() \ No newline at end of file diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/grib/__init__.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/grib/__init__.py new file mode 100644 index 0000000000..eaa0c74aed --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/grib/__init__.py @@ -0,0 +1,27 @@ +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## + +# File auto-generated by PythonFileGenerator + +__all__ = [ + 'request' + ] + + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/grib/request/DeleteAllModelDataRequest.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/grib/request/DeleteAllModelDataRequest.py new file mode 100644 index 0000000000..6bb7c6cff7 --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/grib/request/DeleteAllModelDataRequest.py @@ -0,0 +1,33 @@ +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## + +# File auto-generated against equivalent DynamicSerialize Java class + +class DeleteAllModelDataRequest(object): + + def __init__(self, modelName=None): + self.modelName = modelName + + def getModelName(self): + return self.modelName + + def setModelName(self, modelName): + self.modelName = modelName + diff --git a/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/grib/request/__init__.py b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/grib/request/__init__.py new file mode 100644 index 0000000000..1bfd9bf59b --- /dev/null +++ b/pythonPackages/dynamicserialize/dstypes/com/raytheon/uf/common/dataplugin/grib/request/__init__.py @@ -0,0 +1,28 @@ +## +# This software was developed and / or modified by Raytheon Company, +# pursuant to Contract DG133W-05-CQ-1067 with the US Government. +# +# U.S. EXPORT CONTROLLED TECHNICAL DATA +# This software product contains export-restricted data whose +# export/transfer/disclosure is restricted by U.S. law. Dissemination +# to non-U.S. persons whether in the United States or abroad requires +# an export license or other authorization. +# +# Contractor Name: Raytheon Company +# Contractor Address: 6825 Pine Street, Suite 340 +# Mail Stop B8 +# Omaha, NE 68106 +# 402.291.0100 +# +# See the AWIPS II Master Rights File ("Master Rights File.pdf") for +# further licensing information. +## + +# File auto-generated by PythonFileGenerator + +__all__ = [ + 'DeleteAllModelDataRequest' + ] + +from DeleteAllModelDataRequest import DeleteAllModelDataRequest + diff --git a/rpms/awips2.core/Installer.httpd-pypies/configuration/apache/pypies.conf b/rpms/awips2.core/Installer.httpd-pypies/configuration/apache/pypies.conf index db909d2778..3bb8be3664 100644 --- a/rpms/awips2.core/Installer.httpd-pypies/configuration/apache/pypies.conf +++ b/rpms/awips2.core/Installer.httpd-pypies/configuration/apache/pypies.conf @@ -15,4 +15,5 @@ WSGIPythonHome /awips2/python Order deny,allow Allow from all - \ No newline at end of file + + diff --git a/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template b/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template index 30d0479e80..fd895b2376 100644 --- a/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template +++ b/rpms/awips2.core/Installer.ldm/patch/etc/pqact.conf.template @@ -4,6 +4,7 @@ # ------------ ---------- ----------- -------------------------- # 20120905 1090 jkorman Corrected several patterns as well as # combining similar patterns. +#20121009 1252 jkorman Corrections and additions from Dale Morris. #*************************************************************** # AWIPS 1 PATTERN GRAPHIC ^[PQ].* /redbook/Raw # PGNA00 KWNS 010001 !redbook 1_1/NMCGPHMCD/MCDSUM/PXSF001CN/20110201 0001 @@ -64,9 +65,8 @@ HDS ^(Z[DE]W[A-D][89]8) KWNO (..)(..)(..) /m0 !(grib|grib2)/[^/]*/([^/]*)/#([^/] # AWIPS1: GRID ^[YZ].[A-WYZ].*KWB.* /Grid/SBN/Raw # YUWG97 KWBG 010600 /mRUC2 !grib/ncep/RUC2/#236/201102010600/F006/UGRD/tropopause/ - HDS ^([YZ].[A-WYZ].{1,3}) (KWB.) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([^/]*)/([0-9]{8})([0-9]{4})/(F[0-9]{3})/([^/]*) - FILE -overwrite -log -close -edex /data_store/\6/(\3:yyyy)(\3:mm)\3/\4/\7/GRID\8/\(10)Z_\(11)_\(12)-\1_\2_\3\4\5_(seq).\5.%Y%m%d%H + FILE -overwrite -log -close -edex /data_store/\6/(\3:yyyy)(\3:mm)\3/\4/\7/GRID\8/\(10)Z_\(11)_\(12)-\1_\2_\3\4\5_(seq).\6.%Y%m%d%H # AWIPS1: GRID ^YEI.[89]8.*KWNH /Grid/SBN/Raw #!MAINT! This line is a superset duplicate of line 16 (which only triggers on /ncep/) - However cannot find any data matching this pattern. @@ -75,7 +75,7 @@ HDS ^(YEI.[89]8) KWNH (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([^/]*)/([0- # This line enables the regional rfc qpf gribs HDS ^(YEI.[89]8) (KALR|KFWR|KKRF|KMSR|KORN|KPTR|KRHA|KRSA|KSTR|KTAR|KTIR|KTUA) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([^/]*)/([0-9]{8})([0-9]{4})/(F[0-9]{3})/[^/]*/([^/]*) - FILE -overwrite -log -close -edex /data_store/\6/(\3:yyyy)(\3:mm)/\3/\4/\7/GRID\8/(10)Z_\(11)_\(12)-\1_\2_\3\4\5_(seq).\6.%Y%m%d%H + FILE -overwrite -log -close -edex /data_store/\6/(\3:yyyy)(\3:mm)\3/\4/\7/GRID\8/\(10)Z_\(11)_\(12)-\1_\2_\3\4\5_(seq).\6.%Y%m%d%H # AWIPS1: GRID ^ZEX.98.*KWNH /Grid/SBN/Raw @@ -266,19 +266,21 @@ ANY ^([LM].[AB].{1,3}) (KWBS) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([^/ # *** This is only be available during an active storm. Verified 20120828 - Hurricane Isaac. ANY ^(LGXT[0-2][0-9]) KNHC (..)(..)(..) - FILE -overwrite -log -close -edex /data_store/grib2/(\2:yyyy)(\2:mm)\2/\3/TPC/\1_KNHC_\2\3\4_(seq).grib2.%Y%m%d%H + FILE -overwrite -log -close -edex /data_store/grib2/(\2:yyyy)(\2:mm)\2/\3/TPC/\3\4Z_SURGE-\1_KNHC_\2\3\4_(seq).grib2.%Y%m%d%H # AWIPS1: GRID ^LGXP[0-9][0-9].*KNHC /Grid/SBN/rawGrib2 # *** This is only be available during an active storm. Verified 20120828 - Hurricane Isaac. ANY ^(LGXP[0-9][0-9]) KNHC (..)(..)(..) - FILE -overwrite -log -close -edex /data_store/grib2/(\2:yyyy)(\2:mm)\2/\3/TPC/\1_KNHC_\2\3\4_(seq).grib2.%Y%m%d%H + FILE -overwrite -log -close -edex /data_store/grib2/(\2:yyyy)(\2:mm)\2/\3/TPC/\3\4Z_SURGE-\1_KNHC_\2\3\4_(seq).grib2.%Y%m%d%H # AWIPS1: GRID ^LDIZ11.*KWNS /Grid/SBN/rawGrib2 # LDIZ11 KWNS 180039 !grib2/ncep/0/#202/FHRS//LVL -ANY ^(LDIZ1[1-9]|LDIZ2[7-9]|LDIZ3[0789]|LDIZ4[0-1]) (KWNS) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/[^/]*/#([^/]*)/([^/]*) - FILE -overwrite -log -close -edex /data_store/\6/(\3:yyyy)(\3:mm)\3/\4/SPC/GRID\7/\4/\5Z_\1_\2_\3\4\5_(seq).\6.%Y%m%d%H +#ANY ^(LDIZ1[1-9]|LDIZ2[7-9]|LDIZ3[0789]|LDIZ4[0-1]) (KWNS) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/[^/]*/#([^/]*)/([^/]*) +# FILE -overwrite -log -close -edex /data_store/\6/(\3:yyyy)(\3:mm)\3/\4/SPC/GRID\7/\4\5Z-\1_\2_\3\4\5_(seq).\6.%Y%m%d%H +ANY ^(LDIZ1[1-9]|LDIZ2[7-9]|LDIZ3[0789]|LDIZ4[0-1]) (KWNS) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/[^/]*/#([^/]*)/([0-9]{8})([0-9]{4})(F[0-9]{3})/([^/]*) + FILE -overwrite -log -close -edex /data_store/\6/(\3:yyyy)(\3:mm)\3/\4/SPC/GRID\7/\9Z_\(10)_\(11)-\1_\2_\3\4\5_(seq).\6.%Y%m%d%H # AWIPS1: GRID ^ZETA98.(KTUA|PACR|KSTR|KRSA|KORN|KRHA|KKRF|KMSR|KTAR|KPTR|KTIR|KALR|KFWR) /Grid/SBN/HydroRaw # ZETA98 KTAR 012300 /mNWS_160 !grib/nws/NWS_160/#255/201102012200/F001/APCP/sfc/ @@ -297,7 +299,7 @@ ANY ^(ZDIA98) (....) (..)(..)(..)[^!]*!(grib|grib2)/[^/]*/([^/]*)/#([^/]*)/([0-9 # AWIPS1: POINT ^IUAK01.* /ispan/bufr/profiler # IUAK01 PANC 012300 HDS ^(IUPT0[1-4]|IUPT40|IUAK01) (.{4}) (..)(..)(..) - FILE -overwrite -log -close -edex /data_store/profiler/(\3:yyyy)(\3:mm)3/\4/\1_\2_\3\4\5_(seq).bufr.%Y%m%d%H + FILE -overwrite -log -close -edex /data_store/profiler/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).bufr.%Y%m%d%H # AWIPS1: POINT ^IUSZ[4-9][0-9].* /ispan/bufr/raob # IUSZ53 KWBC 020205 @@ -325,8 +327,20 @@ IDS|DDPLUS ^(T[BCHPRTWXY][A-Z]{2}[0-9]{2}) ([A-Z]{4}) (..)(..)(..) FILE -overwrite -log -close -edex /data_store/text/\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d # summaries -IDS|DDPLUS ^(A.{5}) (.{4}) (..)(..)(..) +#IDS|DDPLUS ^(A.{5}) (.{4}) (..)(..)(..) +# FILE -overwrite -log -close -edex /data_store/summaries/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +# Change submitted by Dale Morris +IDS|DDPLUS ^(A[AC-FH-RT-Z]..[0-9][0-9]) (.{4}) (..)(..)(..) FILE -overwrite -log -close -edex /data_store/summaries/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +IDS|DDPLUS ^(AG..[0-9][0-9]) (KWB.) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/summaries/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +#shef +IDS|DDPLUS ^(A[BS]..[0-9][0-9]) (....) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/shef/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +IDS|DDPLUS ^(AG..[0-9][0-9]) (KALR|KFWR|KKRF|KMSR|KORN|KPTR|KRHA|KRSA|KSTR|KTAR|KTIR|KTUR|KTUA)(..)(..)(..) + FILE -overwrite -log -close -edex /data_store/shef/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +IDS|DDPLUS ^(SR..[0-9][0-9]) (....) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/shef/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H # fire wx spot fcst reports IDS|DDPLUS ^(B.{5}) (.{4}) (..)(..)(..) @@ -337,11 +351,33 @@ IDS|DDPLUS ^(C.{5}) (.{4}) (..)(..)(..) FILE -overwrite -log -close -edex /data_store/climate/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H # forecast -IDS|DDPLUS ^(F.{5}) (.{4}) (..)(..)(..) +#IDS|DDPLUS ^(F.{5}) (.{4}) (..)(..)(..) +# FILE -overwrite -log -close -edex /data_store/forecast/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +# Change submitted by Dale Morris +IDS|DDPLUS ^(F[A-FH-NP-Z]..[0-9][0-9]) (.{4}) (..)(..)(..) FILE -overwrite -log -close -edex /data_store/forecast/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +IDS|DDPLUS ^(FOUS[1-589].) (....) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/forecast/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +#shef forecasts +IDS|DDPLUS ^(FG..[0-9][0-9]) (.{4}) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/shef/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +IDS|DDPLUS ^(FOUS[67].) (....) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/shef/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H # misc adm messages -IDS|DDPLUS ^(N.{5}) (.{4}) (..)(..)(..) +#IDS|DDPLUS ^(N.{5}) (.{4}) (..)(..)(..) +# FILE -overwrite -log -close -edex /data_store/misc_adm_messages/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +# +# separate out svrwx lsr and GSM misc adm messages +IDS|DDPLUS ^(N[A-VYZ]....) (.{4}) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/misc_adm_messages/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +IDS|DDPLUS ^(NWUS[01346-9].) (.{4}) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/misc_adm_messages/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +IDS|DDPLUS ^(NWUS5.) (.{4}) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/lsr/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +IDS|DDPLUS ^(NWUS2.) (.{4}) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/svrwx/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +IDS|DDPLUS ^(NXUS[0-57-9].) (....) (..)(..)(..) FILE -overwrite -log -close -edex /data_store/misc_adm_messages/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H # xml @@ -435,9 +471,10 @@ IDS|DDPLUS ^(V.{5}) (.{4}) (..)(..)(..) # ^(WT)(NT|PZ)\d{2} KNHC.* # ^(WTP)A\d{2} PHFO.* # ^(NWU)S\d{2} KWNS.* -# +# +# Change suggested by Dale Morris IDS|DDPLUS ^(W.....) (.{4}) (..)(..)(..) - FILE -overwrite -log -close -edex /data_store/warning/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H + FILE -overwrite -log -close -edex /data_store/wwa/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H # AWIPS1: TEXT ^WAUS4[1-6].* /aiv/advisories/Raw # WAUS44 KKCI 031822 AAA /pWA4T @@ -469,6 +506,19 @@ IDS|DDPLUS ^(WSUS3[123]) (.{4}) (..)(..)(..) IDS|DDPLUS ^(W[ACSV]US[04][1-6]) (.{4}) (..)(..)(..) FILE -overwrite -log -close -edex /data_store/nonconvsigment/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +# airmet +IDS|DDPLUS ^(WAUS4[1-6]) (.{4}) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/airmet/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +# intlsigmets +IDS|DDPLUS ^(W[CSV]PA((0[1-9])|(1[1-3]))) (PHFO) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/intlsigmet/(\6:yyyy)(\6:mm)\6/\7/\4/\1_\5_\6\7\8_(seq).%Y%m%d%H +IDS|DDPLUS ^(W[CSV]NT((0[1-9])|(1[1-3]))) (KKCI) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/intlsigmet/(\6:yyyy)(\6:mm)\6/\7/\4/\1_\5_\6\7\8_(seq).%Y%m%d%H +IDS|DDPLUS ^(WAAK4[789]) (PAWU) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/intlsigmet/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H +IDS|DDPLUS ^(W[CSV]PN0[1-6]) (KKCI) (..)(..)(..) + FILE -overwrite -log -close -edex /data_store/intlsigmet/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d%H + # already included in text pattern #IDS|DDPLUS ^(S[IMN]V[DCE]..|SSV[DX]..) (....) (..)(..)(..) # FILE -overwrite -log -close /data_store/sfcobs/\3/\4/\1_\2_\3\4\5_(seq).%Y%m%d @@ -508,8 +558,9 @@ ANY ^(IUAX0[12]) (....) (..)(..)(..) EXP ^/data_store/acars/acars_raw/(acars_decrypted.*) FILE -overwrite -log -close -edex /data_store/acars/acars_decrypted/\1.acars.%Y%m%d%H - -ANY ^(IUA[^X]0[12]) (....) (..)(..)(..) +# Need to make sure that IUAK and IUAX are disallowed. +# IUAK are Alaskan profilers and IUAX has encrypted ACARS handled above! +ANY ^(IUA[^XK]0[12]) (....) (..)(..)(..) FILE -overwrite -close -edex /data_store/acars/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).bufr.%Y%m%d%H # AWIPS1: POINT ^JSAT98.*KKCI.* /aiv/ncwf/Raw @@ -554,7 +605,7 @@ HDS ^(JUTX0[1-9]) (....) (..)(..)(..) HDS ^(IUTX0[1-9]) (....) (..)(..)(..) FILE -overwrite -log -close -edex /data_store/poessndg/(\3:yyyy)(\3:mm)\3/\4/\1_\2_\3\4\5_(seq).bufr.%Y%m%d%H -## HDW Bufr Patters ## +## HDW Bufr Patterns ## # From [east|west]HDWBufrAcq_patterns.template # ### From Automation ###