Issue #1444 - Fix updating subsets by loading a saved subset from the saved subset tab.
Change-Id: Ibc6b93fd8a9d7a9fdf07b28d77f4f32e706ae05a Former-commit-id:16a86f47e6
[formerly35d73f0354
] [formerly16a86f47e6
[formerly35d73f0354
] [formerly4cbe807a52
[formerly 843a771d3c6247326d1e832eb598072f7c313499]]] Former-commit-id:4cbe807a52
Former-commit-id:c498087b96
[formerly98ec2a5269
] Former-commit-id:855af43259
This commit is contained in:
parent
27535c8f2f
commit
ad0f7088af
6 changed files with 128 additions and 44 deletions
|
@ -20,6 +20,8 @@
|
|||
package com.raytheon.uf.viz.datadelivery.subscription.subset;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
|
@ -37,26 +39,27 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
|
|||
|
||||
/**
|
||||
* {@link IDataTimingSubsetView} implementation for Gridded data.
|
||||
*
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 22, 2012 0743 djohnson Initial creation
|
||||
* Aug 29, 2012 0223 mpduff Removed cycle times.
|
||||
* Sep 07, 2012 0684 mpduff Clear fcstHour selection before setting new selection.
|
||||
* Sep 24, 2012 1209 djohnson Display text when there are no available cycles, move validation to presenter.
|
||||
* Jan 10, 2013 1444 mpduff Add updateSelectedForecastHours method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GriddedTimingSubsetTab extends DataTimingSubsetTab
|
||||
implements IGriddedDataTimingSubsetView {
|
||||
public class GriddedTimingSubsetTab extends DataTimingSubsetTab implements
|
||||
IGriddedDataTimingSubsetView {
|
||||
|
||||
/** Forecast dual list */
|
||||
private DualList fcstDualList;
|
||||
|
@ -68,14 +71,14 @@ public class GriddedTimingSubsetTab extends DataTimingSubsetTab
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param parentComp
|
||||
* @param dataSet
|
||||
* @param callback
|
||||
* @param shell
|
||||
*/
|
||||
public GriddedTimingSubsetTab(Composite parentComp,
|
||||
IDataSize callback, Shell shell) {
|
||||
public GriddedTimingSubsetTab(Composite parentComp, IDataSize callback,
|
||||
Shell shell) {
|
||||
super(parentComp, callback, shell);
|
||||
}
|
||||
|
||||
|
@ -111,7 +114,7 @@ public class GriddedTimingSubsetTab extends DataTimingSubsetTab
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
|
@ -132,8 +135,45 @@ public class GriddedTimingSubsetTab extends DataTimingSubsetTab
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setAvailableForecastHours(List<String> forecastHours) {
|
||||
fcstDualList.setFullList(new ArrayList<String>(forecastHours));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void updateSelectedForecastHours(List<String> fcstHours) {
|
||||
List<String> selectedHrs = new ArrayList<String>();
|
||||
String[] selectedItems = fcstDualList.getSelectedSelection();
|
||||
|
||||
// Add the saved hours
|
||||
for (String fcstHr : fcstDualList.getAvailableListItems()) {
|
||||
if (fcstHours.contains(fcstHr)) {
|
||||
selectedHrs.add(fcstHr);
|
||||
}
|
||||
}
|
||||
|
||||
// Add in the previously selected hours
|
||||
selectedHrs.addAll(Arrays.asList(selectedItems));
|
||||
|
||||
// Sort the hours
|
||||
List<Integer> intList = new ArrayList<Integer>();
|
||||
for (String hr : selectedHrs) {
|
||||
intList.add(Integer.parseInt(hr));
|
||||
}
|
||||
|
||||
Collections.sort(intList);
|
||||
|
||||
selectedHrs.clear();
|
||||
for (int i : intList) {
|
||||
selectedHrs.add(String.valueOf(i));
|
||||
}
|
||||
fcstDualList.selectItems(selectedHrs.toArray(new String[selectedHrs
|
||||
.size()]));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,6 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
|||
import com.raytheon.uf.common.datadelivery.registry.Parameter;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Time;
|
||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
|
||||
import com.raytheon.uf.common.datadelivery.retrieval.util.DataSizeUtils;
|
||||
import com.raytheon.uf.common.geospatial.MapUtil;
|
||||
|
@ -122,6 +121,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
|
|||
* Dec 18, 2012 1439 mpduff Redo subscription name validation.
|
||||
* Jan 02, 2012 1345 djohnson Use gui thread task executor.
|
||||
* Jan 04, 2012 1420 mpduff Pass the subscription in to the GriddedTimingSelectionDlg.
|
||||
* Jan 10, 2013 1444 mpduff Fix the loading of saved subsets from the saved subset tab.
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -830,7 +830,8 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
}
|
||||
|
||||
/**
|
||||
* Load saved subset button action handler.
|
||||
* Load saved subset button action handler. This action takes the settings
|
||||
* from the saved subset and applies them to the current data set.
|
||||
*
|
||||
* @param subsetName
|
||||
* Name of the subset to load
|
||||
|
@ -840,27 +841,10 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
public void handleLoadSubset(String subsetName) {
|
||||
|
||||
// TODO: How else to do this other than casting?
|
||||
this.subsetXml = (SubsetXML<TIMEXML>) SubsetFileManager.getInstance()
|
||||
.loadSubset(subsetName);
|
||||
SubsetXML<TIMEXML> loadedSubsetXml = (SubsetXML<TIMEXML>) SubsetFileManager
|
||||
.getInstance().loadSubset(subsetName);
|
||||
|
||||
if (!spatialTabControls.getRegionSaveText().isEmpty()) {
|
||||
spatialTabControls.resetRegionSaveText();
|
||||
}
|
||||
|
||||
try {
|
||||
// TODO: How else other can casting?
|
||||
this.dataSet = (DATASET) DataDeliveryHandlers.getDataSetHandler()
|
||||
.getByNameAndProvider(subsetXml.getDatasetName(),
|
||||
subsetXml.getProviderName());
|
||||
|
||||
setText(DD_SUBSET_MANAGER + dataSet.getDataSetName());
|
||||
populate();
|
||||
|
||||
getShell().layout();
|
||||
getShell().pack();
|
||||
} catch (RegistryHandlerException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
}
|
||||
updateSelections(loadedSubsetXml);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -884,7 +868,17 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
TIMEXML time = subsetXml.getTime();
|
||||
this.timingTabControls.populate(time, dataSet);
|
||||
this.nameText.setText(subsetXml.getBaseSubsetName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Update selections with from the loadedSubsetXML object.
|
||||
*/
|
||||
private void updateSelections(SubsetXML<TIMEXML> loadedSubsetXml) {
|
||||
ArrayList<VerticalXML> vertList = loadedSubsetXml.getVerticalList();
|
||||
vTab.updateSettings(vertList);
|
||||
|
||||
TIMEXML time = loadedSubsetXml.getTime();
|
||||
timingTabControls.updateSettings(time);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,6 +65,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.VerticalXML;
|
|||
* Oct 4, 2012 1245 jpiatt Correct isValid method & code clean up.
|
||||
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
|
||||
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
|
||||
* Jan 10, 2013 1444 mpduff Add updateSettings method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -575,4 +576,27 @@ public class VerticalSubsetTab extends SubsetTab implements
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the selected parameters and levels.
|
||||
*
|
||||
* @param vertList
|
||||
*/
|
||||
public void updateSettings(ArrayList<VerticalXML> vertList) {
|
||||
for (VerticalXML vert : vertList) {
|
||||
for (ExpandItem item : expandBar.getItems()) {
|
||||
LevelParameterSelection lps = (LevelParameterSelection) item
|
||||
.getControl();
|
||||
if (vert.getLayerType().equalsIgnoreCase(item.getText())) {
|
||||
if (vert.getLevels() != null && !vert.getLevels().isEmpty()) {
|
||||
lps.selectLevels(vert.getLevels());
|
||||
}
|
||||
if (vert.getParameterList() != null
|
||||
&& !vert.getParameterList().isEmpty()) {
|
||||
lps.selectParameters(vert.getParameterList());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,8 @@ import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.TimeXML;
|
|||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 15, 2012 0743 djohnson Initial creation
|
||||
* Aug 29, 2012 0223 mpduff Changed as result of renamed objects.
|
||||
* Sep 24, 2012 1209 djohnson Sub-classes provide isValid() implementations.
|
||||
* Sep 24, 2012 1209 djohnson Sub-classes provide isValid() implementations.
|
||||
* Jan 10, 2013 1444 mpduff Add updateSettings method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -91,14 +92,14 @@ public abstract class DataTimingSubsetPresenter<DATASET extends DataSet, DATASET
|
|||
|
||||
/**
|
||||
* Check whether the view is valid.
|
||||
*
|
||||
*
|
||||
* @return true if the view is valid
|
||||
*/
|
||||
public abstract boolean isValid();
|
||||
|
||||
/**
|
||||
* Set boolean to whether or not date or cycle selections have changed.
|
||||
*
|
||||
*
|
||||
* @param dateCycleDirty
|
||||
* time/cycle have changed
|
||||
*/
|
||||
|
@ -108,16 +109,24 @@ public abstract class DataTimingSubsetPresenter<DATASET extends DataSet, DATASET
|
|||
|
||||
/**
|
||||
* Get the save information for this data timing presenter.
|
||||
*
|
||||
*
|
||||
* @return the save information
|
||||
*/
|
||||
public abstract TIMEXML getSaveInfo();
|
||||
|
||||
/**
|
||||
* Restore this data timing presenter from the save information.
|
||||
*
|
||||
*
|
||||
* @param time
|
||||
* the saved time information
|
||||
*/
|
||||
public abstract void populate(TIMEXML time, DataSet dataSet);
|
||||
|
||||
/**
|
||||
* Update the data timing presenter from the save information.
|
||||
*
|
||||
* @param time
|
||||
* the saved time information
|
||||
*/
|
||||
public abstract void updateSettings(TIMEXML time);
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SpecificDateTime
|
|||
* Aug 22, 2012 0743 djohnson Initial creation
|
||||
* Aug 29, 2012 0223 mpduff Removed cycles.
|
||||
* Sep 24, 2012 1209 djohnson Move isValid() in from view.
|
||||
* Jan 10, 2013 1444 mpduff Add updateSettings method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -50,12 +51,13 @@ import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SpecificDateTime
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GriddedTimingSubsetPresenter extends
|
||||
public class GriddedTimingSubsetPresenter
|
||||
extends
|
||||
DataTimingSubsetPresenter<GriddedDataSet, GriddedDataSetMetaData, IGriddedDataTimingSubsetView, SpecificDateTimeXML, GriddedDataSetMetaDataQuery> {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param dataSet
|
||||
* @param view
|
||||
*/
|
||||
|
@ -80,7 +82,7 @@ public class GriddedTimingSubsetPresenter extends
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
|
@ -98,7 +100,7 @@ public class GriddedTimingSubsetPresenter extends
|
|||
|
||||
/**
|
||||
* Get the selected forecast hours
|
||||
*
|
||||
*
|
||||
* @return the selected forecast hours
|
||||
*/
|
||||
public String[] getSelectedFcstHours() {
|
||||
|
@ -118,7 +120,15 @@ public class GriddedTimingSubsetPresenter extends
|
|||
@Override
|
||||
public boolean isValid() {
|
||||
String[] forecastHours = view.getSelectedFcstHours();
|
||||
|
||||
|
||||
return !CollectionUtil.isNullOrEmpty(forecastHours);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void updateSettings(SpecificDateTimeXML time) {
|
||||
view.updateSelectedForecastHours(time.getFcstHours());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
package com.raytheon.uf.viz.datadelivery.subscription.subset.presenter;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||
|
||||
|
@ -34,7 +33,8 @@ import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 22, 2012 0743 djohnson Initial creation
|
||||
* Aug 29, 2012 0223 mpduff Removed cycles.
|
||||
* Aug 29, 2012 0223 mpduff Removed cycles.
|
||||
* Jan 10, 2012 1444 mpduff Add updateSelectedForecastHours method.
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
|
@ -59,4 +59,11 @@ public interface IGriddedDataTimingSubsetView extends IDataTimingSubsetView {
|
|||
* @param fcstHours
|
||||
*/
|
||||
void setAvailableForecastHours(List<String> fcstHours);
|
||||
|
||||
/**
|
||||
* Update the selected forecast hours.
|
||||
*
|
||||
* @param fcstHours
|
||||
*/
|
||||
void updateSelectedForecastHours(List<String> fcstHours);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue