Merge "Issue #2386 - DD Front end refactor Peer review comments Change-Id: Ie3d503dca37af3eda917c096119d1c6d40488e0f" into development
Former-commit-id: c3550fa64755f73ee2a23080a0f786a2f170e6ae
This commit is contained in:
commit
baac431d85
32 changed files with 1785 additions and 3940 deletions
|
@ -61,6 +61,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
|||
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}.
|
||||
* Jul 26, 2013 2232 mpduff Refactored Data Delivery permissions.
|
||||
* Sep 04, 2013 2314 mpduff LoadSave dialog now non-blocking.
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -78,7 +79,7 @@ public class SubsetAction extends AbstractHandler {
|
|||
+ "subset" + File.separator;
|
||||
|
||||
/** Dialog instance */
|
||||
private SubsetManagerDlg<?, ?, ?> dlg = null;
|
||||
private SubsetManagerDlg dlg = null;
|
||||
|
||||
/** Dialog instance */
|
||||
private LoadSaveConfigDlg loadDlg = null;
|
||||
|
@ -106,7 +107,7 @@ public class SubsetAction extends AbstractHandler {
|
|||
public void dialogClosed(Object returnValue) {
|
||||
if (returnValue instanceof LocalizationFile) {
|
||||
LocalizationFile locFile = (LocalizationFile) returnValue;
|
||||
SubsetXML<?> subset = SubsetFileManager
|
||||
SubsetXML subset = SubsetFileManager
|
||||
.getInstance().loadSubset(
|
||||
locFile.getFile().getName());
|
||||
|
||||
|
|
|
@ -123,6 +123,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Sep 04, 2013 2314 mpduff Load/save config dialog now non-blocking.
|
||||
* Sep 26, 2013 2412 mpduff Handle auto selecting data type.
|
||||
* Sep 26, 2013 2413 mpduff Added isDirty check to New Configuration menu selection.
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -684,8 +685,8 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
|
|||
return;
|
||||
}
|
||||
|
||||
SubsetManagerDlg<?, ?, ?> dlg = SubsetManagerDlg.fromDataSet(
|
||||
shell, data);
|
||||
SubsetManagerDlg dlg = SubsetManagerDlg
|
||||
.fromDataSet(shell, data);
|
||||
dlg.open();
|
||||
}
|
||||
} catch (AuthException e) {
|
||||
|
|
|
@ -92,6 +92,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Jun 21, 2013 2132 mpduff Swap target and source envelopes.
|
||||
* Jul 12, 2013 2141 mpduff Valid envelope test happens as needed instead of when changes are made.
|
||||
* Oct 10, 2013 2104 mschenke Switched to use MapScalesManager
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -570,9 +571,6 @@ public class AreaComp extends Composite implements ISubset {
|
|||
regionLbl.setEnabled(flag);
|
||||
regionCombo.setEnabled(flag);
|
||||
selectCombo.setEnabled(flag);
|
||||
if (flag) {
|
||||
handleRegionSelection(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -49,7 +49,7 @@ import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
|
|||
* Aug 29, 2012 223 mpduff REfactor change.
|
||||
* Dec 18, 2012 1440 mpduff Ignore "None" group.
|
||||
* Jan 02, 2013 1441 djohnson Add isGroupSelected(), separate NO_GROUP constant to reusable location.
|
||||
*
|
||||
* Oct 14, 2013 2386 mpduff Added NONE_AVAILABLE constant.
|
||||
* </pre>
|
||||
*
|
||||
* @author jpiatt
|
||||
|
@ -57,6 +57,8 @@ import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
|
|||
*/
|
||||
public class GroupSelectComp extends Composite {
|
||||
|
||||
public final static String NONE_AVAILABLE = "None Available";
|
||||
|
||||
/** Group Name combo box. */
|
||||
private Combo groupNameCombo;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -104,7 +104,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
|
|||
* May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
|
||||
* Jun 14, 2013 2064 mpduff Null check for sorted column.
|
||||
* Jul 29, 2013 2232 mpduff IndexOutOfBoundsException check.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
* Jul 26, 2031 2232 mpduff Refactored Data Delivery permissions.
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
|
@ -227,8 +228,8 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
|
|||
try {
|
||||
if (DataDeliveryServices.getPermissionsService()
|
||||
.checkPermissions(user, msg, permission).isAuthorized()) {
|
||||
SubsetManagerDlg<?, ?, ?> dlg = SubsetManagerDlg
|
||||
.fromSubscription(this.getShell(), true, subscription);
|
||||
SubsetManagerDlg dlg = SubsetManagerDlg.fromSubscription(
|
||||
this.getShell(), true, subscription);
|
||||
|
||||
dlg.open();
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -19,13 +19,10 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.datadelivery.subscription.subset;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.IDataTimingSubsetView;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||
import com.raytheon.viz.ui.widgets.duallist.IUpdate;
|
||||
|
||||
/**
|
||||
|
@ -49,7 +46,8 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
|
|||
* Aug 20, 2012 0743 djohnson Add support for doing a specific date adhoc query, sub-class for data type specific operations.
|
||||
* Aug 29, 2012 0223 mpduff Overrode new method from interface.
|
||||
* Sep 24, 2012 1209 djohnson Remove isValid().
|
||||
* Nov 20, 2012 1286 djohnson Implement displayYesNoPopup.
|
||||
* Nov 20, 2012 1286 djohnson Implement displayYesNoPopup.
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -57,8 +55,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class DataTimingSubsetTab extends SubsetTab
|
||||
implements IUpdate, IDataTimingSubsetView {
|
||||
public class DataTimingSubsetTab extends SubsetTab implements IUpdate {
|
||||
|
||||
/** Parent composite */
|
||||
protected final Composite parentComp;
|
||||
|
@ -73,7 +70,7 @@ public class DataTimingSubsetTab extends SubsetTab
|
|||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
*
|
||||
* @param parentComp
|
||||
* @param callback
|
||||
* @param shell
|
||||
|
@ -86,26 +83,20 @@ public class DataTimingSubsetTab extends SubsetTab
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Set whether the date cycle is dirty.
|
||||
*
|
||||
* @param dirty
|
||||
* the boolean value
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setDirty(boolean dirty) {
|
||||
this.dirty = dirty;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
* Check whether the date cycle is dirty.
|
||||
*
|
||||
* @return true if the date cycle is dirty
|
||||
*/
|
||||
@Override
|
||||
public boolean isDirty() {
|
||||
return dirty;
|
||||
}
|
||||
|
@ -120,38 +111,4 @@ public class DataTimingSubsetTab extends SubsetTab
|
|||
callback.updateDataSize();
|
||||
this.dirty = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void displayPopup(String title, String message) {
|
||||
DataDeliveryUtils.showMessage(shell, SWT.OK, title, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean displayOkCancelPopup(String title, String message) {
|
||||
return DataDeliveryUtils.showMessage(shell, SWT.CANCEL | SWT.OK, title,
|
||||
message) == SWT.OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void displayErrorPopup(String title, String message) {
|
||||
DataDeliveryUtils.showMessage(shell, SWT.ERROR,
|
||||
title, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean displayYesNoPopup(String title, String message) {
|
||||
return DataDeliveryUtils.showYesNoMessage(shell, title, message) == SWT.YES;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -40,8 +40,7 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
|
|||
import com.raytheon.viz.ui.widgets.duallist.IUpdate;
|
||||
|
||||
/**
|
||||
*
|
||||
* TODO Add Description
|
||||
* Gridded ensemble subset tab.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -49,7 +48,8 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
|
|||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 3, 2013 bsteffen Initial creation
|
||||
* Jan 03, 2013 bsteffen Initial creation
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -58,7 +58,7 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
|
|||
*/
|
||||
public class GriddedEnsembleSubsetTab {
|
||||
|
||||
private static final String NAME = "Ensemble Members";
|
||||
private final String NAME = "Ensemble Members";
|
||||
|
||||
private final Set<IDataSize> listeners = new HashSet<IDataSize>();
|
||||
|
||||
|
@ -68,6 +68,14 @@ public class GriddedEnsembleSubsetTab {
|
|||
|
||||
private boolean modified;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param parentComp
|
||||
* Parent composite
|
||||
* @param ensemble
|
||||
* Ensemble object
|
||||
*/
|
||||
public GriddedEnsembleSubsetTab(Composite parentComp, Ensemble ensemble) {
|
||||
this.ensemble = ensemble;
|
||||
init(parentComp);
|
||||
|
@ -94,9 +102,7 @@ public class GriddedEnsembleSubsetTab {
|
|||
dualListConfig.setListWidth(175);
|
||||
dualListConfig.setShowUpDownBtns(false);
|
||||
dualListConfig.setFullList(ensemble.getMembers());
|
||||
dualList = new DualList(group, SWT.NONE, dualListConfig,
|
||||
new IUpdate() {
|
||||
|
||||
dualList = new DualList(group, SWT.NONE, dualListConfig, new IUpdate() {
|
||||
@Override
|
||||
public void selectionChanged() {
|
||||
modified = true;
|
||||
|
@ -110,10 +116,20 @@ public class GriddedEnsembleSubsetTab {
|
|||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tab name.
|
||||
*
|
||||
* @return the tab name
|
||||
*/
|
||||
public String getName() {
|
||||
return NAME;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ensemble object representing the selections in this tab.
|
||||
*
|
||||
* @return The populated ensemble object
|
||||
*/
|
||||
public Ensemble getEnsembleWithSelection() {
|
||||
Ensemble ensemble = new Ensemble(this.ensemble);
|
||||
ensemble.setSelectedMembers(Arrays.asList(dualList
|
||||
|
@ -129,45 +145,92 @@ public class GriddedEnsembleSubsetTab {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the ensemble data to the provided subscription.
|
||||
*
|
||||
* @param subscription
|
||||
* The subscription getting the ensemble data
|
||||
*/
|
||||
public void populateSubscription(Subscription subscription) {
|
||||
subscription.setEnsemble(getEnsembleWithSelection());
|
||||
}
|
||||
|
||||
/**
|
||||
* Load ensemble data from the provided subscription.
|
||||
*
|
||||
* @param subscription
|
||||
* The subscription with ensemble data
|
||||
*/
|
||||
public void loadFromSubscription(Subscription subscription) {
|
||||
loadFromEnsemble(subscription.getEnsemble());
|
||||
}
|
||||
|
||||
public void populateSubsetXML(SubsetXML<?> subsetXml) {
|
||||
/**
|
||||
* Load subset object with the ensemble data from this tab.
|
||||
*
|
||||
* @param subsetXml
|
||||
* The subset object
|
||||
*/
|
||||
public void populateSubsetXML(SubsetXML subsetXml) {
|
||||
subsetXml.setEnsemble(getEnsembleWithSelection());
|
||||
}
|
||||
|
||||
public void loadFromSubsetXML(SubsetXML<?> subsetXml) {
|
||||
/**
|
||||
* Load ensemble data from the provided subset object.
|
||||
*
|
||||
* @param subsetXml
|
||||
*/
|
||||
public void loadFromSubsetXML(SubsetXML subsetXml) {
|
||||
loadFromEnsemble(subsetXml.getEnsemble());
|
||||
}
|
||||
|
||||
/**
|
||||
* Does a valid selection exist?
|
||||
*
|
||||
* @return true if a valid selection
|
||||
*/
|
||||
public boolean isValid() {
|
||||
return !CollectionUtil.isNullOrEmpty(dualList.getSelectedListItems());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the modified flag
|
||||
*
|
||||
* @return the modified flag
|
||||
*/
|
||||
public boolean isModified() {
|
||||
return modified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the modified flag
|
||||
*
|
||||
* @param modified
|
||||
* true for modified
|
||||
*/
|
||||
public void setModified(boolean modified) {
|
||||
this.modified = modified;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a listener.
|
||||
*
|
||||
* @param listener
|
||||
* The listener
|
||||
*/
|
||||
public void addListener(IDataSize listener) {
|
||||
synchronized (this.listeners) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifiy the listeners.
|
||||
*/
|
||||
protected void notifyListeners() {
|
||||
Collection<IDataSize> listeners;
|
||||
synchronized (this.listeners) {
|
||||
listeners = new ArrayList<IDataSize>(
|
||||
this.listeners);
|
||||
listeners = new ArrayList<IDataSize>(this.listeners);
|
||||
}
|
||||
for (IDataSize listener : listeners) {
|
||||
listener.updateDataSize();
|
||||
|
|
|
@ -43,7 +43,6 @@ import org.eclipse.swt.widgets.TabFolder;
|
|||
import org.eclipse.swt.widgets.TabItem;
|
||||
import org.geotools.geometry.jts.ReferencedEnvelope;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.collect.Ordering;
|
||||
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
|
||||
|
@ -70,10 +69,12 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
|
|||
import com.raytheon.uf.common.time.util.ImmutableDate;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
import com.raytheon.uf.common.util.SizeUtil;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.GriddedTimingSelectionPresenter;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.GriddedTimingSubsetPresenter;
|
||||
import com.raytheon.uf.viz.datadelivery.common.xml.AreaXML;
|
||||
import com.raytheon.uf.viz.datadelivery.filter.MetaDataManager;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.GriddedTimeXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SpecificDateTimeXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.TimeXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.VerticalXML;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||
|
||||
|
@ -104,6 +105,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
|||
* Jun 14, 2013 2108 mpduff Refactored DataSizeUtils.
|
||||
* Jul 18, 2013 2205 djohnson If null time is selected from the dialog, return null for the adhoc.
|
||||
* Sept 25, 2013 1797 dhladky Separated Time from GriddedTime
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
*
|
||||
*
|
||||
* </pre>
|
||||
|
@ -112,16 +114,12 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GriddedSubsetManagerDlg
|
||||
extends
|
||||
SubsetManagerDlg<GriddedDataSet, GriddedTimingSubsetPresenter, SpecificDateTimeXML> {
|
||||
private static final String TIMING_TAB_GRID = "Forecast Hours";
|
||||
public class GriddedSubsetManagerDlg extends SubsetManagerDlg {
|
||||
private final String TIMING_TAB_GRID = "Forecast Hours";
|
||||
|
||||
@VisibleForTesting
|
||||
final String POPUP_TITLE = "Notice";
|
||||
private final String POPUP_TITLE = "Notice";
|
||||
|
||||
@VisibleForTesting
|
||||
final String NO_DATA_FOR_DATE_AND_CYCLE = "No data is available for the specified date and cycle combination.";
|
||||
private final String NO_DATA_FOR_DATE_AND_CYCLE = "No data is available for the specified date and cycle combination.";
|
||||
|
||||
/** Status Handler */
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
|
@ -138,8 +136,7 @@ public class GriddedSubsetManagerDlg
|
|||
|
||||
private final List<String> asString = new ArrayList<String>();
|
||||
|
||||
@VisibleForTesting
|
||||
final Map<String, ImmutableDate> dateStringToDateMap = new HashMap<String, ImmutableDate>();
|
||||
private final Map<String, ImmutableDate> dateStringToDateMap = new HashMap<String, ImmutableDate>();
|
||||
|
||||
private boolean useLatestDate = true;
|
||||
|
||||
|
@ -152,41 +149,74 @@ public class GriddedSubsetManagerDlg
|
|||
/** Gridded data size utility */
|
||||
private GriddedDataSizeUtils dataSize;
|
||||
|
||||
private final GriddedDataSet dataSet;
|
||||
|
||||
private GriddedTimingSubsetTab timingTabControls;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param shell
|
||||
* parent shell
|
||||
* @param loadDataSet
|
||||
* true if loading data set
|
||||
* @param subscription
|
||||
* the subscription object
|
||||
*/
|
||||
public GriddedSubsetManagerDlg(Shell shell, boolean loadDataSet,
|
||||
Subscription subscription) {
|
||||
super(shell, loadDataSet, subscription);
|
||||
this.dataSet = (GriddedDataSet) MetaDataManager.getInstance()
|
||||
.getDataSet(subscription.getDataSetName(),
|
||||
subscription.getProvider());
|
||||
setTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param shell
|
||||
* parent shell
|
||||
* @param dataSet
|
||||
* The dataset object
|
||||
* @param loadDataSet
|
||||
* true if loading data set
|
||||
* @param subsetXml
|
||||
* The subset object
|
||||
*/
|
||||
public GriddedSubsetManagerDlg(Shell shell, GriddedDataSet dataSet,
|
||||
boolean loadDataSet, SubsetXML<SpecificDateTimeXML> subsetXml) {
|
||||
super(shell, dataSet, loadDataSet, subsetXml);
|
||||
boolean loadDataSet, SubsetXML subsetXml) {
|
||||
super(shell, loadDataSet, dataSet);
|
||||
this.dataSet = dataSet;
|
||||
this.subsetXml = subsetXml;
|
||||
setTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param shell
|
||||
* parent shell
|
||||
* @param dataSet
|
||||
* The dataset object
|
||||
*/
|
||||
public GriddedSubsetManagerDlg(Shell shell, GriddedDataSet dataSet) {
|
||||
super(shell, dataSet);
|
||||
this.dataSet = dataSet;
|
||||
setTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void setTitle() {
|
||||
setText(DD_SUBSET_MANAGER + dataSet.getDataSetName());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void createTabs(TabFolder tabFolder) {
|
||||
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||
|
@ -211,9 +241,7 @@ public class GriddedSubsetManagerDlg
|
|||
timingComp.setLayout(gl);
|
||||
timingComp.setLayoutData(gd);
|
||||
timingTab.setControl(timingComp);
|
||||
timingTabControls = getDataTimingSubsetPresenter(timingComp, dataSet,
|
||||
this, shell);
|
||||
timingTabControls.init();
|
||||
timingTabControls = new GriddedTimingSubsetTab(timingComp, this, shell);
|
||||
|
||||
Ensemble e = dataSet.getEnsemble();
|
||||
if (e != null && e.getMembers() != null) {
|
||||
|
@ -228,6 +256,24 @@ public class GriddedSubsetManagerDlg
|
|||
ensembleTab.addListener(this);
|
||||
ensembleTabItem.setText(ensembleTab.getName());
|
||||
}
|
||||
|
||||
TabItem spatialTab = new TabItem(tabFolder, SWT.NONE);
|
||||
spatialTab.setText(SPATIAL_TAB);
|
||||
Composite spatialComp = new Composite(tabFolder, SWT.NONE);
|
||||
spatialComp.setLayout(gl);
|
||||
spatialComp.setLayoutData(gd);
|
||||
spatialTab.setControl(spatialComp);
|
||||
spatialTabControls = new SpatialSubsetTab(spatialComp, dataSet, this);
|
||||
|
||||
SortedSet<Integer> forecastHours = new TreeSet<Integer>(
|
||||
dataSet.getForecastHours());
|
||||
|
||||
List<String> forecastHoursAsString = new ArrayList<String>();
|
||||
for (Integer integer : forecastHours) {
|
||||
forecastHoursAsString.add(Integer.toString(integer));
|
||||
}
|
||||
|
||||
timingTabControls.setAvailableForecastHours(forecastHoursAsString);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -248,16 +294,22 @@ public class GriddedSubsetManagerDlg
|
|||
return invalidTabs;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void populateSubsetXML(SubsetXML<SpecificDateTimeXML> subset) {
|
||||
protected void populateSubsetXML(SubsetXML subset) {
|
||||
super.populateSubsetXML(subset);
|
||||
if (ensembleTab != null) {
|
||||
ensembleTab.populateSubsetXML(subset);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void loadFromSubsetXML(SubsetXML<SpecificDateTimeXML> subsetXml) {
|
||||
protected void loadFromSubsetXML(SubsetXML subsetXml) {
|
||||
super.loadFromSubsetXML(subsetXml);
|
||||
if (ensembleTab != null) {
|
||||
ensembleTab.loadFromSubsetXML(subsetXml);
|
||||
|
@ -266,8 +318,9 @@ public class GriddedSubsetManagerDlg
|
|||
ArrayList<VerticalXML> vertList = subsetXml.getVerticalList();
|
||||
vTab.populate(vertList, dataSet);
|
||||
|
||||
SpecificDateTimeXML time = subsetXml.getTime();
|
||||
this.timingTabControls.populate(time, dataSet);
|
||||
TimeXML time = subsetXml.getTime();
|
||||
this.timingTabControls.setSelectedForecastHours(((GriddedTimeXML) time)
|
||||
.getFcstHours());
|
||||
|
||||
updateDataSize();
|
||||
}
|
||||
|
@ -292,7 +345,7 @@ public class GriddedSubsetManagerDlg
|
|||
|
||||
timeXml.setLatestData(true);
|
||||
|
||||
this.timingTabControls.populate(timeXml, dataSet);
|
||||
this.timingTabControls.setSelectedForecastHours(timeXml.getFcstHours());
|
||||
|
||||
// Vertical/Parameters
|
||||
Map<String, VerticalXML> levelMap = new HashMap<String, VerticalXML>();
|
||||
|
@ -332,6 +385,23 @@ public class GriddedSubsetManagerDlg
|
|||
ArrayList<VerticalXML> vertList = new ArrayList<VerticalXML>(
|
||||
levelMap.values());
|
||||
vTab.populate(vertList, dataSet);
|
||||
|
||||
// Area
|
||||
AreaXML area = new AreaXML();
|
||||
|
||||
ReferencedEnvelope envelope = this.subscription.getCoverage()
|
||||
.getEnvelope();
|
||||
ReferencedEnvelope requestEnvelope = this.subscription.getCoverage()
|
||||
.getRequestEnvelope();
|
||||
|
||||
if (requestEnvelope != null && !requestEnvelope.isEmpty()) {
|
||||
area.setEnvelope(requestEnvelope);
|
||||
} else {
|
||||
area.setEnvelope(envelope);
|
||||
}
|
||||
|
||||
spatialTabControls.setDataSet(this.dataSet);
|
||||
spatialTabControls.populate(area);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -340,6 +410,11 @@ public class GriddedSubsetManagerDlg
|
|||
if (!modified && ensembleTab != null) {
|
||||
modified = ensembleTab.isModified();
|
||||
}
|
||||
|
||||
if (!modified && timingTabControls.isDirty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return modified;
|
||||
}
|
||||
|
||||
|
@ -349,18 +424,7 @@ public class GriddedSubsetManagerDlg
|
|||
if (ensembleTab != null) {
|
||||
ensembleTab.setModified(false);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected GriddedTimingSubsetPresenter getDataTimingSubsetPresenter(
|
||||
Composite parentComp, GriddedDataSet dataSet, IDataSize callback,
|
||||
Shell shell) {
|
||||
GriddedTimingSubsetTab view = new GriddedTimingSubsetTab(parentComp,
|
||||
callback, shell);
|
||||
return new GriddedTimingSubsetPresenter(dataSet, view);
|
||||
timingTabControls.setDirty(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -383,7 +447,7 @@ public class GriddedSubsetManagerDlg
|
|||
@Override
|
||||
protected SpecificDateTimeXML getTimeXmlFromSubscription() {
|
||||
SpecificDateTimeXML timeXml = new SpecificDateTimeXML();
|
||||
GriddedTime time = (GriddedTime)this.subscription.getTime();
|
||||
GriddedTime time = (GriddedTime) this.subscription.getTime();
|
||||
List<Integer> cycleTimes = time.getCycleTimes();
|
||||
if (!CollectionUtil.isNullOrEmpty(cycleTimes)) {
|
||||
for (int cycle : cycleTimes) {
|
||||
|
@ -476,9 +540,8 @@ public class GriddedSubsetManagerDlg
|
|||
*/
|
||||
@Override
|
||||
protected GriddedTime setupDataSpecificTime(Time subTime, Subscription sub) {
|
||||
|
||||
GriddedTime newTime = (GriddedTime)subTime;
|
||||
|
||||
GriddedTime newTime = (GriddedTime) subTime;
|
||||
|
||||
if (asString.isEmpty()) {
|
||||
SortedSet<ImmutableDate> newestToOldest = new TreeSet<ImmutableDate>(
|
||||
Ordering.natural().reverse());
|
||||
|
@ -496,7 +559,7 @@ public class GriddedSubsetManagerDlg
|
|||
asString.add("No Data Available");
|
||||
} else {
|
||||
for (ImmutableDate date : newestToOldest) {
|
||||
this.dataSet.getTime().getCycleTimes();
|
||||
// this.dataSet.getTime().getCycleTimes();
|
||||
String displayString = dateFormat.get().format(date);
|
||||
|
||||
if (!asString.contains(displayString)) {
|
||||
|
@ -507,42 +570,39 @@ public class GriddedSubsetManagerDlg
|
|||
}
|
||||
}
|
||||
|
||||
GriddedTimingSelectionPresenter presenter = new GriddedTimingSelectionPresenter(
|
||||
new GriddedTimingSelectionDlg(getShell(), dataSet.getCycles(),
|
||||
sub), dataSet, asString);
|
||||
Integer cycle = presenter.open();
|
||||
GriddedTimingSelectionDlg dlg = new GriddedTimingSelectionDlg(
|
||||
getShell(), dataSet, sub, asString);
|
||||
|
||||
if (presenter.isCancel()) {
|
||||
GriddedTimeSelection selection = dlg.openDlg();
|
||||
|
||||
if (selection.isCancel()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (cycle != null) {
|
||||
GriddedTime time;
|
||||
this.useLatestDate = (cycle == -999 ? true : false);
|
||||
if (!useLatestDate) {
|
||||
newTime.addCycleTime(cycle);
|
||||
String selectedDate = presenter.getDate();
|
||||
metaData = retrieveFilteredDataSetMetaData(selectedDate, cycle);
|
||||
if (metaData == null) {
|
||||
return null;
|
||||
} else {
|
||||
time = (GriddedTime)metaData.getTime();
|
||||
time.addCycleTime(cycle);
|
||||
return time;
|
||||
}
|
||||
GriddedTime time;
|
||||
int cycle = selection.getCycle();
|
||||
this.useLatestDate = (cycle == -999 ? true : false);
|
||||
if (!selection.isLatest()) {
|
||||
newTime.addCycleTime(cycle);
|
||||
String selectedDate = selection.getDate();
|
||||
metaData = retrieveFilteredDataSetMetaData(selectedDate, cycle);
|
||||
if (metaData == null) {
|
||||
return null;
|
||||
} else {
|
||||
// If ulse latest data is selected then add all cycle times, the
|
||||
// retrieval generator will determine which one to use.
|
||||
time = (GriddedTime)dataSet.getTime();
|
||||
for (Integer c : new TreeSet<Integer>(dataSet.getCycles())) {
|
||||
time.addCycleTime(c);
|
||||
}
|
||||
time = (GriddedTime) metaData.getTime();
|
||||
time.addCycleTime(cycle);
|
||||
return time;
|
||||
}
|
||||
} else {
|
||||
// If use latest data is selected then add all cycle times, the
|
||||
// retrieval generator will determine which one to use.
|
||||
time = dataSet.getTime();
|
||||
for (Integer c : new TreeSet<Integer>(dataSet.getCycles())) {
|
||||
time.addCycleTime(c);
|
||||
}
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
return null;
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -588,8 +648,12 @@ public class GriddedSubsetManagerDlg
|
|||
boolean create) {
|
||||
ArrayList<Parameter> selectedParameterObjs = vTab.getParameters();
|
||||
sub.setParameter(selectedParameterObjs);
|
||||
sub.setProvider(dataSet.getProviderName());
|
||||
sub.setDataSetName(dataSet.getDataSetName());
|
||||
sub.setDataSetType(dataSet.getDataSetType());
|
||||
sub.setDataSetName(dataSet.getDataSetName());
|
||||
|
||||
GriddedTime dataSetTime = (GriddedTime)dataSet.getTime();
|
||||
GriddedTime dataSetTime = dataSet.getTime();
|
||||
|
||||
GriddedTime newTime = new GriddedTime();
|
||||
|
||||
|
@ -600,7 +664,7 @@ public class GriddedSubsetManagerDlg
|
|||
}
|
||||
sub.setTime(newTime);
|
||||
} else if (!create) {
|
||||
GriddedTime time = (GriddedTime)sub.getTime();
|
||||
GriddedTime time = (GriddedTime) sub.getTime();
|
||||
List<String> fcstHours = time.getFcstHours();
|
||||
String[] selectedItems = this.timingTabControls
|
||||
.getSelectedFcstHours();
|
||||
|
@ -623,7 +687,7 @@ public class GriddedSubsetManagerDlg
|
|||
sub.setTime(newTime);
|
||||
}
|
||||
|
||||
GriddedCoverage cov = (GriddedCoverage) dataSet.getCoverage();
|
||||
GriddedCoverage cov = dataSet.getCoverage();
|
||||
cov.setModelName(dataSet.getDataSetName());
|
||||
cov.setGridName(getNameText());
|
||||
GridCoverage coverage = cov.getGridCoverage();
|
||||
|
@ -655,4 +719,12 @@ public class GriddedSubsetManagerDlg
|
|||
|
||||
return sub;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected TimeXML getDataTimeInfo() {
|
||||
return timingTabControls.getSaveInfo();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,111 @@
|
|||
/**
|
||||
* 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.datadelivery.subscription.subset;
|
||||
|
||||
/**
|
||||
* Data object to hold the gridded data timing information.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 14, 2013 2386 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GriddedTimeSelection {
|
||||
/** Selected cycle */
|
||||
private int cycle;
|
||||
|
||||
/** Latest time flag */
|
||||
private boolean latest;
|
||||
|
||||
/** Selected data date */
|
||||
private String date;
|
||||
|
||||
/** Cancel flag */
|
||||
private boolean cancel;
|
||||
|
||||
/**
|
||||
* @return the cycle
|
||||
*/
|
||||
public int getCycle() {
|
||||
return cycle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cycle
|
||||
* the cycle to set
|
||||
*/
|
||||
public void setCycle(int cycle) {
|
||||
this.cycle = cycle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the latest
|
||||
*/
|
||||
public boolean isLatest() {
|
||||
return latest;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param latest
|
||||
* the latest to set
|
||||
*/
|
||||
public void setLatest(boolean latest) {
|
||||
this.latest = latest;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the date
|
||||
*/
|
||||
public String getDate() {
|
||||
return date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param date
|
||||
* the date to set
|
||||
*/
|
||||
public void setDate(String date) {
|
||||
this.date = date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the cancel
|
||||
*/
|
||||
public boolean isCancel() {
|
||||
return cancel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param cancel
|
||||
* the cancel to set
|
||||
*/
|
||||
public void setCancel(boolean cancel) {
|
||||
this.cancel = cancel;
|
||||
}
|
||||
}
|
|
@ -19,13 +19,13 @@
|
|||
**/
|
||||
package com.raytheon.uf.viz.datadelivery.subscription.subset;
|
||||
|
||||
import static com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.getMaxLatency;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.ShellAdapter;
|
||||
import org.eclipse.swt.events.ShellEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
|
@ -34,16 +34,13 @@ import org.eclipse.swt.widgets.Layout;
|
|||
import org.eclipse.swt.widgets.List;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.PriorityComp;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.IGriddedTimingSelectionDlgView;
|
||||
import com.raytheon.uf.viz.datadelivery.system.SystemRuleManager;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils;
|
||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||
import com.raytheon.viz.ui.presenter.components.ButtonConf;
|
||||
import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
|
||||
import com.raytheon.viz.ui.presenter.components.ListConf;
|
||||
|
||||
/**
|
||||
* Gridded data/cycle selection dialog for adhoc queries.
|
||||
|
@ -61,6 +58,7 @@ import com.raytheon.viz.ui.presenter.components.ListConf;
|
|||
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||
* Feb 26, 2013 1592 djohnson When the shell is closed, don't submit the query.
|
||||
* Jun 04, 2013 223 mpduff PriorityComp constructor changed.
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -68,8 +66,7 @@ import com.raytheon.viz.ui.presenter.components.ListConf;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GriddedTimingSelectionDlg extends CaveSWTDialog implements
|
||||
IGriddedTimingSelectionDlgView {
|
||||
public class GriddedTimingSelectionDlg extends CaveSWTDialog {
|
||||
|
||||
/** The Main Composite */
|
||||
private Composite dateComp;
|
||||
|
@ -98,26 +95,35 @@ public class GriddedTimingSelectionDlg extends CaveSWTDialog implements
|
|||
/** Cycle times */
|
||||
private final Set<Integer> cycleTimes;
|
||||
|
||||
private final GriddedDataSet dataset;
|
||||
|
||||
private final java.util.List<String> dateList;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param parentShell
|
||||
* @param cycleTimes
|
||||
* @param dataset
|
||||
* @param subscription
|
||||
* @param dateStringToDateMap
|
||||
*/
|
||||
protected GriddedTimingSelectionDlg(Shell parentShell,
|
||||
Set<Integer> cycleTimes, Subscription subscription) {
|
||||
public GriddedTimingSelectionDlg(Shell parentShell, GriddedDataSet dataset,
|
||||
Subscription subscription, java.util.List<String> dateList) {
|
||||
super(parentShell);
|
||||
setText("Select Date/Cycle");
|
||||
this.cycleTimes = cycleTimes;
|
||||
this.cycleTimes = dataset.getCycles();
|
||||
this.subscription = subscription;
|
||||
this.dataset = dataset;
|
||||
this.dateList = dateList;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Open the dialog.
|
||||
*
|
||||
* @return the selection
|
||||
*/
|
||||
@Override
|
||||
public Integer openDlg() {
|
||||
return (Integer) this.open();
|
||||
public GriddedTimeSelection openDlg() {
|
||||
return (GriddedTimeSelection) this.open();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -134,14 +140,26 @@ public class GriddedTimingSelectionDlg extends CaveSWTDialog implements
|
|||
|
||||
useLatestChk = new Button(dateComp, SWT.CHECK);
|
||||
useLatestChk.setLayoutData(gd);
|
||||
useLatestChk.setText("Get Latest Data");
|
||||
useLatestChk.setSelection(true);
|
||||
useLatestChk.setToolTipText("Use the latest time");
|
||||
useLatestChk.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
dateCycleList.setEnabled(!useLatestChk.getSelection());
|
||||
}
|
||||
});
|
||||
|
||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
gd.heightHint = 150;
|
||||
this.dateCycleList = new List(dateComp, SWT.SINGLE | SWT.BORDER
|
||||
| SWT.V_SCROLL);
|
||||
dateCycleList.setLayoutData(gd);
|
||||
dateCycleList.setEnabled(false);
|
||||
|
||||
// Get latency value
|
||||
SystemRuleManager ruleManager = SystemRuleManager.getInstance();
|
||||
|
||||
int latency = ruleManager.getLatency(this.subscription, cycleTimes);
|
||||
SubscriptionPriority priority = ruleManager.getPriority(
|
||||
this.subscription, cycleTimes);
|
||||
|
@ -157,10 +175,28 @@ public class GriddedTimingSelectionDlg extends CaveSWTDialog implements
|
|||
gd = new GridData(btnWidth, SWT.DEFAULT);
|
||||
okBtn = new Button(buttonComp, SWT.PUSH);
|
||||
okBtn.setLayoutData(gd);
|
||||
okBtn.setText("OK");
|
||||
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
handleOk();
|
||||
close();
|
||||
}
|
||||
});
|
||||
|
||||
gd = new GridData(btnWidth, SWT.DEFAULT);
|
||||
cancelBtn = new Button(buttonComp, SWT.PUSH);
|
||||
cancelBtn.setLayoutData(gd);
|
||||
cancelBtn.setText("Cancel");
|
||||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
GriddedTimeSelection gts = new GriddedTimeSelection();
|
||||
gts.setCancel(true);
|
||||
setReturnValue(gts);
|
||||
close();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -181,177 +217,56 @@ public class GriddedTimingSelectionDlg extends CaveSWTDialog implements
|
|||
*/
|
||||
@Override
|
||||
protected void preOpened() {
|
||||
preOpenCallback.run();
|
||||
|
||||
populate();
|
||||
shell.layout();
|
||||
shell.pack();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Check if the latest data checkbox is enabled.
|
||||
*
|
||||
* @return true if enabled.
|
||||
*/
|
||||
@Override
|
||||
public void setLatestDataCheckBox(final CheckBoxConf checkBoxConf) {
|
||||
useLatestChk.setText(checkBoxConf.getDisplayText());
|
||||
useLatestChk.setSelection(checkBoxConf.isInitiallyChecked());
|
||||
useLatestChk.setToolTipText(checkBoxConf.getToolTipText());
|
||||
useLatestChk.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
checkBoxConf.getOnCheckedChangeAction().run();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setDateCycleList(ListConf dateCycleListConf) {
|
||||
GridData gd = new GridData(dateCycleListConf.getWidth(),
|
||||
dateCycleListConf.getHeight());
|
||||
dateCycleList.setItems(dateCycleListConf.getItems());
|
||||
dateCycleList.setLayoutData(gd);
|
||||
dateCycleList.setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setOkButton(final ButtonConf okBtnConf) {
|
||||
okBtn.setText(okBtnConf.getDisplayText());
|
||||
okBtn.setToolTipText(okBtnConf.getToolTipText());
|
||||
okBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
okBtnConf.getOnClickAction().run();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setCancelButton(final ButtonConf cancelBtnConf) {
|
||||
cancelBtn.setText(cancelBtnConf.getDisplayText());
|
||||
cancelBtn.setToolTipText(cancelBtnConf.getToolTipText());
|
||||
cancelBtn.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
close();
|
||||
cancelBtnConf.getOnClickAction().run();
|
||||
}
|
||||
});
|
||||
|
||||
shell.addShellListener(new ShellAdapter() {
|
||||
@Override
|
||||
public void shellClosed(ShellEvent event) {
|
||||
cancelBtnConf.getOnClickAction().run();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setPreOpenCallback(Runnable callback) {
|
||||
this.preOpenCallback = callback;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isLatestDataEnabled() {
|
||||
return useLatestChk.getSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Set the date/cycle list enabled.
|
||||
*/
|
||||
@Override
|
||||
public void setDateCycleListEnabled() {
|
||||
this.dateCycleList.setEnabled(!this.useLatestChk.getSelection());
|
||||
}
|
||||
|
||||
private void populate() {
|
||||
for (String date : this.dateList) {
|
||||
dateCycleList.add(date);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* OK Button action method.
|
||||
*/
|
||||
@Override
|
||||
public String getSelection() {
|
||||
if (dateCycleList.isEnabled()) {
|
||||
return dateCycleList.getItem(dateCycleList.getSelectionIndex());
|
||||
private void handleOk() {
|
||||
GriddedTimeSelection data = new GriddedTimeSelection();
|
||||
if (!isLatestDataEnabled()) {
|
||||
String selection = dateCycleList.getItem(dateCycleList
|
||||
.getSelectionIndex());
|
||||
DataDeliveryGUIUtils.latencyValidChk(
|
||||
priorityComp.getLatencyValue(), getMaxLatency(dataset));
|
||||
|
||||
// parse off the date/cycle time selected
|
||||
String[] parts = selection.split(" - ");
|
||||
String selectedDate = parts[0];
|
||||
String cycleStr = parts[1];
|
||||
cycleStr = cycleStr.substring(0, cycleStr.indexOf(" Z"));
|
||||
data.setCycle(Integer.parseInt(cycleStr));
|
||||
data.setDate(selection);
|
||||
} else {
|
||||
data.setCycle(-999);
|
||||
data.setLatest(true);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
// not used
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void displayPopup(String title, String message) {
|
||||
DataDeliveryUtils.showMessage(getShell(), SWT.OK, title, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void displayErrorPopup(String title, String message) {
|
||||
DataDeliveryUtils.showMessage(shell, SWT.ERROR, title, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean displayOkCancelPopup(String title, String message) {
|
||||
return DataDeliveryUtils.showMessage(shell, SWT.CANCEL | SWT.OK, title,
|
||||
message) == SWT.OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean displayYesNoPopup(String title, String message) {
|
||||
return DataDeliveryUtils.showYesNoMessage(shell, title, message) == SWT.YES;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void closeDlg() {
|
||||
close();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int getLatency() {
|
||||
return priorityComp.getLatencyValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public SubscriptionPriority getPriority() {
|
||||
return priorityComp.getPriority();
|
||||
setReturnValue(data);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,13 +32,13 @@ import org.eclipse.swt.widgets.Group;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.IDataTimingSubsetView;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.IGriddedDataTimingSubsetView;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SpecificDateTimeXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.TimeXML;
|
||||
import com.raytheon.viz.ui.widgets.duallist.DualList;
|
||||
import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
|
||||
|
||||
/**
|
||||
* {@link IDataTimingSubsetView} implementation for Gridded data.
|
||||
* Implementation for Gridded data.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
|
@ -51,6 +51,7 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
|
|||
* 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.
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -58,8 +59,8 @@ import com.raytheon.viz.ui.widgets.duallist.DualListConfig;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GriddedTimingSubsetTab extends DataTimingSubsetTab implements
|
||||
IGriddedDataTimingSubsetView {
|
||||
public class GriddedTimingSubsetTab extends DataTimingSubsetTab {// implements
|
||||
// IGriddedDataTimingSubsetView {
|
||||
|
||||
/** Forecast dual list */
|
||||
private DualList fcstDualList;
|
||||
|
@ -67,27 +68,27 @@ public class GriddedTimingSubsetTab extends DataTimingSubsetTab implements
|
|||
/** Forecast dual configuration */
|
||||
private final DualListConfig forecastHoursDualConfig = new DualListConfig();
|
||||
|
||||
/** Forecast Group */
|
||||
private Group forecastGrp;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param parentComp
|
||||
* @param dataSet
|
||||
* Parent composite
|
||||
* @param callback
|
||||
* The callback class
|
||||
* @param shell
|
||||
* the shell
|
||||
*/
|
||||
public GriddedTimingSubsetTab(Composite parentComp, IDataSize callback,
|
||||
Shell shell) {
|
||||
super(parentComp, callback, shell);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
private void init() {
|
||||
|
||||
GridLayout gl = new GridLayout(1, false);
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
|
@ -114,18 +115,20 @@ public class GriddedTimingSubsetTab extends DataTimingSubsetTab implements
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the selected forecast hours
|
||||
*
|
||||
* {@inheritDoc}
|
||||
* @return the selected forecast hours
|
||||
*/
|
||||
@Override
|
||||
public String[] getSelectedFcstHours() {
|
||||
return this.fcstDualList.getSelectedListItems();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* List of hours to set
|
||||
*
|
||||
* @param fcstHours
|
||||
* list of fcst hours
|
||||
*/
|
||||
@Override
|
||||
public void setSelectedForecastHours(List<String> fcstHours) {
|
||||
fcstDualList.clearSelection();
|
||||
|
||||
|
@ -136,17 +139,21 @@ public class GriddedTimingSubsetTab extends DataTimingSubsetTab implements
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Set the available forecast hours
|
||||
*
|
||||
* @param forecastHours
|
||||
* list of fcst hours
|
||||
*/
|
||||
@Override
|
||||
public void setAvailableForecastHours(List<String> forecastHours) {
|
||||
fcstDualList.setFullList(new ArrayList<String>(forecastHours));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Update the selected forecast hours.
|
||||
*
|
||||
* @param fcstHours
|
||||
* list of fcst hours
|
||||
*/
|
||||
@Override
|
||||
public void updateSelectedForecastHours(List<String> fcstHours) {
|
||||
List<String> selectedHrs = new ArrayList<String>();
|
||||
String[] selectedItems = fcstDualList.getSelectedSelection();
|
||||
|
@ -176,4 +183,28 @@ public class GriddedTimingSubsetTab extends DataTimingSubsetTab implements
|
|||
fcstDualList.selectItems(selectedHrs.toArray(new String[selectedHrs
|
||||
.size()]));
|
||||
}
|
||||
|
||||
/**
|
||||
* Are the data valid?
|
||||
*
|
||||
* @return true if valid
|
||||
*/
|
||||
public boolean isValid() {
|
||||
if (fcstDualList.getSelectedListItems().length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the save info for the tab.
|
||||
*
|
||||
* @return TimeXML object
|
||||
*/
|
||||
public TimeXML getSaveInfo() {
|
||||
SpecificDateTimeXML time = new SpecificDateTimeXML();
|
||||
time.setFcstHours(new ArrayList<String>(Arrays.asList(fcstDualList
|
||||
.getSelectedListItems())));
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,11 +42,14 @@ import com.raytheon.uf.common.datadelivery.registry.PointTime;
|
|||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Time;
|
||||
import com.raytheon.uf.common.datadelivery.retrieval.util.PointDataSizeUtils;
|
||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||
import com.raytheon.uf.common.status.UFStatus;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.common.util.SizeUtil;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.PointTimeSubsetPresenter;
|
||||
import com.raytheon.uf.viz.datadelivery.common.xml.AreaXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.PointTimeXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.TimeXML;
|
||||
|
||||
/**
|
||||
* {@link SubsetManagerDlg} for point data sets.
|
||||
|
@ -65,6 +68,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML;
|
|||
* Sep 10, 2013 2351 dhladky Finished adhoc queries
|
||||
* Sep 16, 2013 2383 bgonzale Start time precedes end time.
|
||||
* Oct 10, 2013 1797 bgonzale Refactored registry Time objects.
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -72,14 +76,22 @@ import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML;
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class PointSubsetManagerDlg extends
|
||||
SubsetManagerDlg<PointDataSet, PointTimeSubsetPresenter, PointTimeXML> {
|
||||
public class PointSubsetManagerDlg extends SubsetManagerDlg {
|
||||
/** Status Handler */
|
||||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(PointSubsetManagerDlg.class);
|
||||
|
||||
private static final String TIMING_TAB_TEXT = "Retrieval Interval";
|
||||
private final String TIMING_TAB_TEXT = "Retrieval Interval";
|
||||
|
||||
/** Point data size utility */
|
||||
private PointDataSizeUtils dataSize;
|
||||
|
||||
/** The data set */
|
||||
private PointDataSet dataSet;
|
||||
|
||||
/** The point subset tab */
|
||||
private PointTimeSubsetTab timingTabControls;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
|
@ -93,6 +105,7 @@ public class PointSubsetManagerDlg extends
|
|||
public PointSubsetManagerDlg(Shell shell, boolean loadDataSet,
|
||||
Subscription subscription) {
|
||||
super(shell, loadDataSet, subscription);
|
||||
setTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,8 +121,11 @@ public class PointSubsetManagerDlg extends
|
|||
* the subset xml object
|
||||
*/
|
||||
public PointSubsetManagerDlg(Shell shell, PointDataSet dataSet,
|
||||
boolean loadDataSet, SubsetXML<PointTimeXML> subsetXml) {
|
||||
super(shell, dataSet, loadDataSet, subsetXml);
|
||||
boolean loadDataSet, SubsetXML subsetXml) {
|
||||
super(shell, loadDataSet, dataSet);
|
||||
this.dataSet = dataSet;
|
||||
this.subsetXml = subsetXml;
|
||||
setTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,8 +138,21 @@ public class PointSubsetManagerDlg extends
|
|||
*/
|
||||
public PointSubsetManagerDlg(Shell shell, PointDataSet dataSet) {
|
||||
super(shell, dataSet);
|
||||
this.dataSet = dataSet;
|
||||
setTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void setTitle() {
|
||||
setText(DD_SUBSET_MANAGER + dataSet.getDataSetName());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
void createTabs(TabFolder tabFolder) {
|
||||
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||
|
@ -136,9 +165,15 @@ public class PointSubsetManagerDlg extends
|
|||
timingComp.setLayout(gl);
|
||||
timingComp.setLayoutData(gd);
|
||||
timingTab.setControl(timingComp);
|
||||
timingTabControls = getDataTimingSubsetPresenter(timingComp, dataSet,
|
||||
this, shell);
|
||||
timingTabControls.init();
|
||||
timingTabControls = new PointTimeSubsetTab(timingComp, this, shell);
|
||||
|
||||
TabItem spatialTab = new TabItem(tabFolder, SWT.NONE);
|
||||
spatialTab.setText(SPATIAL_TAB);
|
||||
Composite spatialComp = new Composite(tabFolder, SWT.NONE);
|
||||
spatialComp.setLayout(gl);
|
||||
spatialComp.setLayoutData(gd);
|
||||
spatialTab.setControl(spatialComp);
|
||||
spatialTabControls = new SpatialSubsetTab(spatialComp, dataSet, this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,18 +197,6 @@ public class PointSubsetManagerDlg extends
|
|||
.getDataSetSizeInBytes(env, interval)));
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected PointTimeSubsetPresenter getDataTimingSubsetPresenter(
|
||||
Composite parentComp, PointDataSet dataSet, IDataSize callback,
|
||||
Shell shell) {
|
||||
PointTimeSubsetTab view = new PointTimeSubsetTab(parentComp, callback,
|
||||
shell);
|
||||
return new PointTimeSubsetPresenter(dataSet, view);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
@ -209,8 +232,11 @@ public class PointSubsetManagerDlg extends
|
|||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected <T extends Subscription> T populateSubscription(T sub,
|
||||
boolean create) {
|
||||
protected Subscription populateSubscription(Subscription sub, boolean create) {
|
||||
sub.setProvider(dataSet.getProviderName());
|
||||
sub.setDataSetName(dataSet.getDataSetName());
|
||||
sub.setDataSetType(dataSet.getDataSetType());
|
||||
sub.setDataSetName(dataSet.getDataSetName());
|
||||
|
||||
Time newTime = new PointTime();
|
||||
newTime = setupDataSpecificTime(newTime, sub);
|
||||
|
@ -242,21 +268,16 @@ public class PointSubsetManagerDlg extends
|
|||
return sub;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.datadelivery.subscription.subset.SubsetManagerDlg
|
||||
* #loadFromSubsetXML
|
||||
* (com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML)
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected void loadFromSubsetXML(SubsetXML<PointTimeXML> subsetXml) {
|
||||
protected void loadFromSubsetXML(SubsetXML subsetXml) {
|
||||
super.loadFromSubsetXML(subsetXml);
|
||||
|
||||
PointTimeXML time = subsetXml.getTime();
|
||||
this.timingTabControls.populate(time, dataSet);
|
||||
|
||||
PointTimeXML time = (PointTimeXML) subsetXml.getTime();
|
||||
this.timingTabControls.setDataRetrievalInterval(time
|
||||
.getDataRetrievalInterval());
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -275,6 +296,29 @@ public class PointSubsetManagerDlg extends
|
|||
time.setDataRetrievalInterval(((PointTime) subscription.getTime())
|
||||
.getInterval());
|
||||
|
||||
this.timingTabControls.populate(time, dataSet);
|
||||
this.timingTabControls.setDataRetrievalInterval(time
|
||||
.getDataRetrievalInterval());
|
||||
|
||||
AreaXML area = new AreaXML();
|
||||
ReferencedEnvelope envelope = this.subscription.getCoverage()
|
||||
.getEnvelope();
|
||||
ReferencedEnvelope requestEnvelope = this.subscription.getCoverage()
|
||||
.getRequestEnvelope();
|
||||
|
||||
if (requestEnvelope != null && !requestEnvelope.isEmpty()) {
|
||||
area.setEnvelope(requestEnvelope);
|
||||
} else {
|
||||
area.setEnvelope(envelope);
|
||||
}
|
||||
spatialTabControls.setDataSet(this.dataSet);
|
||||
spatialTabControls.populate(area);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
protected TimeXML getDataTimeInfo() {
|
||||
return timingTabControls.getSaveInfo();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.eclipse.swt.widgets.Label;
|
|||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.PointTime;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.IPointDataTimingSubsetView;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.PointTimeXML;
|
||||
|
||||
/**
|
||||
* Point Time Subset Tab. Sets the data retrieval interval.
|
||||
|
@ -49,6 +49,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.IPointData
|
|||
* May 29, 2013 223 mpduff Initial creation.
|
||||
* Jun 06, 2013 2038 djohnson Place refresh intervals into PointTime so BandwidthManager has access.
|
||||
* Jun 13, 2013 2108 mpduff Update data set size on change.
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -56,8 +57,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.IPointData
|
|||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class PointTimeSubsetTab extends DataTimingSubsetTab implements
|
||||
IPointDataTimingSubsetView {
|
||||
public class PointTimeSubsetTab extends DataTimingSubsetTab {
|
||||
|
||||
/** Data Retrieval Intervals */
|
||||
private final String[] INTERVALS;
|
||||
|
@ -87,18 +87,11 @@ public class PointTimeSubsetTab extends DataTimingSubsetTab implements
|
|||
}
|
||||
INTERVALS = allowedRefreshIntervals
|
||||
.toArray(new String[allowedRefreshIntervals.size()]);
|
||||
|
||||
init();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* com.raytheon.uf.viz.datadelivery.subscription.subset.DataTimingSubsetTab
|
||||
* #init()
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
private void init() {
|
||||
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
GridLayout gl = new GridLayout(2, false);
|
||||
|
@ -124,9 +117,11 @@ public class PointTimeSubsetTab extends DataTimingSubsetTab implements
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Set the data retrieval interval
|
||||
*
|
||||
* @param interval
|
||||
* the retrieval interval
|
||||
*/
|
||||
@Override
|
||||
public void setDataRetrievalInterval(int interval) {
|
||||
int idx = 0;
|
||||
for (String s : INTERVALS) {
|
||||
|
@ -139,9 +134,10 @@ public class PointTimeSubsetTab extends DataTimingSubsetTab implements
|
|||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
* Get the data retrieval interval
|
||||
*
|
||||
* @return the retrieval interval
|
||||
*/
|
||||
@Override
|
||||
public int getDataRetrievalInterval() {
|
||||
return Integer.parseInt(intervalCombo.getItem(intervalCombo
|
||||
.getSelectionIndex()));
|
||||
|
@ -150,7 +146,18 @@ public class PointTimeSubsetTab extends DataTimingSubsetTab implements
|
|||
/**
|
||||
* Handle a selection change.
|
||||
*/
|
||||
protected void handleSelection() {
|
||||
private void handleSelection() {
|
||||
selectionChanged();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tab's save information.
|
||||
*
|
||||
* @return The PointTimeXML data object
|
||||
*/
|
||||
public PointTimeXML getSaveInfo() {
|
||||
PointTimeXML ptx = new PointTimeXML();
|
||||
ptx.setDataRetrievalInterval(getDataRetrievalInterval());
|
||||
return ptx;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.eclipse.swt.widgets.Label;
|
|||
import org.eclipse.swt.widgets.Text;
|
||||
import org.geotools.geometry.jts.ReferencedEnvelope;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
||||
import com.raytheon.uf.viz.datadelivery.common.ui.AreaComp;
|
||||
import com.raytheon.uf.viz.datadelivery.common.xml.AreaXML;
|
||||
|
@ -60,6 +61,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
|||
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
|
||||
* Feb 20, 2013 1589 mpduff Fix to allow saving custom areas.
|
||||
* Jun 14, 2013 2064 mpudff Force an update of region controls.
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -220,8 +222,7 @@ public class SpatialSubsetTab extends SubsetTab implements IDataSize {
|
|||
* @return Region Name
|
||||
*/
|
||||
public String getRegionSaveText() {
|
||||
String saveName = savedRegionTxt.getText().trim();
|
||||
return saveName;
|
||||
return savedRegionTxt.getText().trim();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -321,7 +322,7 @@ public class SpatialSubsetTab extends SubsetTab implements IDataSize {
|
|||
String regionName = area.getRegionName();
|
||||
|
||||
// set the region name in the combo box
|
||||
if (regionName != null) {
|
||||
if (!Strings.isNullOrEmpty(regionName)) {
|
||||
int i = 0;
|
||||
areaComp.setRegion(regionName);
|
||||
|
||||
|
@ -335,7 +336,7 @@ public class SpatialSubsetTab extends SubsetTab implements IDataSize {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
areaComp.updateRegionControls();
|
||||
}
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
|||
* Aug 22, 2012 0743 djohnson Add TimeXML subclasses.
|
||||
* Nov 19, 2012 1289 bgonzale Added deleteArea(String) method.
|
||||
* Jun 04, 2013 223 mpduff Added PointTimeXML to JaxB context.
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -72,11 +73,14 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
|
|||
*/
|
||||
|
||||
public class SubsetFileManager {
|
||||
/** Singleton instance */
|
||||
private static SubsetFileManager instance = new SubsetFileManager();
|
||||
|
||||
/** Area file path */
|
||||
private final String AREA_PATH = "dataDelivery" + File.separator + "subset"
|
||||
+ File.separator + "area" + File.separator;
|
||||
|
||||
/** Subset file path */
|
||||
private final String SUBSET_PATH = "dataDelivery" + File.separator
|
||||
+ "subset" + File.separator;
|
||||
|
||||
|
@ -93,8 +97,12 @@ public class SubsetFileManager {
|
|||
/** Unmarshaller object */
|
||||
private Unmarshaller unmarshaller;
|
||||
|
||||
/** Array of subset files */
|
||||
private LocalizationFile[] subsetFiles;
|
||||
|
||||
/**
|
||||
* Private constructor.
|
||||
*/
|
||||
private SubsetFileManager() {
|
||||
createContext();
|
||||
}
|
||||
|
@ -133,6 +141,7 @@ public class SubsetFileManager {
|
|||
* @param area
|
||||
* The area xml object to save
|
||||
* @param shell
|
||||
* The calling dialog's shell
|
||||
* @return true if save successful
|
||||
*/
|
||||
public boolean saveArea(AreaXML area, Shell shell) {
|
||||
|
@ -202,8 +211,6 @@ public class SubsetFileManager {
|
|||
/**
|
||||
* Get the AreaXML file
|
||||
*
|
||||
* @param name
|
||||
* Saved file name
|
||||
* @return AreaXML object
|
||||
*/
|
||||
public LocalizationFile[] getAreas() {
|
||||
|
@ -227,7 +234,6 @@ public class SubsetFileManager {
|
|||
area = (AreaXML) unmarshaller.unmarshal(file);
|
||||
} catch (JAXBException e) {
|
||||
statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
return area;
|
||||
}
|
||||
|
@ -255,6 +261,7 @@ public class SubsetFileManager {
|
|||
* @param subset
|
||||
* the object to save
|
||||
* @param shell
|
||||
* The calling dialog's shell
|
||||
* @return true if successfully saved
|
||||
*/
|
||||
public boolean saveSubset(SubsetXML subset, Shell shell) {
|
||||
|
@ -279,15 +286,12 @@ public class SubsetFileManager {
|
|||
try {
|
||||
marshaller.marshal(subset, subsetLocFile.getFile());
|
||||
subsetLocFile.save();
|
||||
System.out.println("Saved " + subsetLocFile.getFile().getPath());
|
||||
|
||||
return true;
|
||||
} catch (JAXBException e) {
|
||||
statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e);
|
||||
e.printStackTrace();
|
||||
} catch (LocalizationOpFailedException e) {
|
||||
statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -301,7 +305,7 @@ public class SubsetFileManager {
|
|||
*
|
||||
* @return The SubsetXML object
|
||||
*/
|
||||
public SubsetXML<?> loadSubset(String subsetName) {
|
||||
public SubsetXML loadSubset(String subsetName) {
|
||||
// Load the subset files if not already loaded
|
||||
if (subsetFiles == null || subsetFiles.length == 0) {
|
||||
getSubsets();
|
||||
|
@ -310,7 +314,7 @@ public class SubsetFileManager {
|
|||
for (LocalizationFile lf : subsetFiles) {
|
||||
if (lf.getFile().getName().equals(subsetName)) {
|
||||
try {
|
||||
return (SubsetXML<?>) unmarshaller.unmarshal(lf.getFile());
|
||||
return (SubsetXML) unmarshaller.unmarshal(lf.getFile());
|
||||
} catch (JAXBException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
|
|
|
@ -71,10 +71,6 @@ import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
|
|||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.ForceApplyPromptResponse;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceApplyPromptDisplayText;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.presenter.CreateSubscriptionDlgPresenter;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.DataTimingSubsetPresenter;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.PointTimeXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SpecificDateTimeXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.TimeXML;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.VerticalXML;
|
||||
|
@ -133,14 +129,14 @@ import com.raytheon.viz.ui.presenter.IDisplay;
|
|||
* Jun 04, 2013 223 mpduff Moved data type specific code to sub classes.
|
||||
* Jun 11, 2013 2064 mpduff Fix editing of subscriptions.
|
||||
* Jun 14, 2013 2108 mpduff Refactored DataSizeUtils.
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extends DataTimingSubsetPresenter<DATASET, ?, ?, TIMEXML, ?>, TIMEXML extends TimeXML>
|
||||
extends CaveSWTDialog implements ITabAction, IDataSize, IDisplay,
|
||||
IForceApplyPromptDisplayText {
|
||||
public abstract class SubsetManagerDlg extends CaveSWTDialog implements
|
||||
ITabAction, IDataSize, IDisplay, IForceApplyPromptDisplayText {
|
||||
/** constant */
|
||||
private final static String DATASETS_NOT_SUPPORTED = "Datasets of type [%s] are currently not supported!";
|
||||
|
||||
|
@ -148,6 +144,9 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
private final IUFStatusHandler statusHandler = UFStatus
|
||||
.getHandler(SubsetManagerDlg.class);
|
||||
|
||||
private final ISubscriptionService subscriptionService = DataDeliveryServices
|
||||
.getSubscriptionService();
|
||||
|
||||
/** Subset Name text box */
|
||||
private Text nameText;
|
||||
|
||||
|
@ -157,30 +156,17 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
/** TabFolder object */
|
||||
private TabFolder tabFolder;
|
||||
|
||||
/** DataSet object */
|
||||
protected DATASET dataSet;
|
||||
|
||||
/** Create a subscription dialog */
|
||||
private CreateSubscriptionDlgPresenter subDlg;
|
||||
|
||||
/** Saved subset tab */
|
||||
private SavedSubsetTab subsetTab;
|
||||
|
||||
/** Vertical subset tab */
|
||||
protected VerticalSubsetTab vTab;
|
||||
|
||||
/**
|
||||
* The presenter class separates as much of the logic from the SWT code as
|
||||
* possible. It also allows for unit testing of the logic since SWT is
|
||||
* typically not ran headless.
|
||||
**/
|
||||
protected PRESENTER timingTabControls;
|
||||
|
||||
/** Spatial subset tab */
|
||||
protected SpatialSubsetTab spatialTabControls;
|
||||
|
||||
/** Subset XML file object */
|
||||
private SubsetXML<TIMEXML> subsetXml;
|
||||
protected SubsetXML subsetXml;
|
||||
|
||||
/** Load dataset flag */
|
||||
private boolean loadDataSet = false;
|
||||
|
@ -195,40 +181,35 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
protected boolean initialized = false;
|
||||
|
||||
/** Subset manager constant */
|
||||
private final String DD_SUBSET_MANAGER = "Data Delivery Subset Manager - ";
|
||||
protected final String DD_SUBSET_MANAGER = "Data Delivery Subset Manager - ";
|
||||
|
||||
/** Vertical tab text */
|
||||
protected final String VERTICAL_TAB = "Vertical Levels/Parameters";
|
||||
|
||||
private final String SPATIAL_TAB = "Spatial";
|
||||
/** Spatial tab text */
|
||||
protected final String SPATIAL_TAB = "Spatial";
|
||||
|
||||
private final ISubscriptionService subscriptionService = DataDeliveryServices
|
||||
.getSubscriptionService();
|
||||
/** The create subscription dialog */
|
||||
private CreateSubscriptionDlg subDlg;
|
||||
|
||||
/** The dataset */
|
||||
private final DataSet dataSet;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param shell
|
||||
* The parent Shell
|
||||
* @param dataSet
|
||||
* The DataSetMetaData
|
||||
* @param loadDataSet
|
||||
* Populate the dialog if true
|
||||
* @param subsetXml
|
||||
* The SubsetXML object to load
|
||||
* @param dataSet
|
||||
* The DataSetMetaData
|
||||
*/
|
||||
public SubsetManagerDlg(Shell shell, DATASET dataSet, boolean loadDataSet,
|
||||
SubsetXML<TIMEXML> subsetXml) {
|
||||
public SubsetManagerDlg(Shell shell, boolean loadDataSet, DataSet dataSet) {
|
||||
super(shell, SWT.RESIZE | SWT.DIALOG_TRIM | SWT.MIN,
|
||||
CAVE.INDEPENDENT_SHELL);
|
||||
if (dataSet != null) {
|
||||
setText(DD_SUBSET_MANAGER + dataSet.getDataSetName());
|
||||
} else {
|
||||
setText(DD_SUBSET_MANAGER);
|
||||
}
|
||||
|
||||
this.dataSet = dataSet;
|
||||
this.subsetXml = subsetXml;
|
||||
this.loadDataSet = loadDataSet;
|
||||
this.dataSet = dataSet;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -240,8 +221,8 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
* @param dataSet
|
||||
* The DataSetMetaData
|
||||
*/
|
||||
public SubsetManagerDlg(Shell shell, DATASET dataSet) {
|
||||
this(shell, dataSet, false, null);
|
||||
public SubsetManagerDlg(Shell shell, DataSet dataSet) {
|
||||
this(shell, false, dataSet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -261,15 +242,42 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
CAVE.INDEPENDENT_SHELL);
|
||||
this.create = false;
|
||||
this.loadDataSet = true;
|
||||
// TODO: Is there a cleaner way to do this other than casting?
|
||||
this.dataSet = (DATASET) MetaDataManager.getInstance().getDataSet(
|
||||
|
||||
this.dataSet = MetaDataManager.getInstance().getDataSet(
|
||||
subscription.getDataSetName(), subscription.getProvider());
|
||||
this.subscription = subscription;
|
||||
setText(DD_SUBSET_MANAGER + "Edit: " + subscription.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create the type specific tabs.
|
||||
*
|
||||
* @param tabFolder
|
||||
*/
|
||||
abstract void createTabs(TabFolder tabFolder);
|
||||
|
||||
/** Populate the subscription object */
|
||||
protected abstract <T extends Subscription> T populateSubscription(T sub,
|
||||
boolean create);
|
||||
|
||||
/**
|
||||
* Setup the timing information specific to the data type.
|
||||
*/
|
||||
protected abstract Time setupDataSpecificTime(Time newTime, Subscription sub);
|
||||
|
||||
/**
|
||||
* Get the Time object.
|
||||
*
|
||||
* @return The time object
|
||||
*/
|
||||
protected abstract TimeXML getTimeXmlFromSubscription();
|
||||
|
||||
/** Set the title */
|
||||
protected abstract void setTitle();
|
||||
|
||||
/** Get the data time information */
|
||||
protected abstract TimeXML getDataTimeInfo();
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
@ -333,7 +341,6 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
tabFolder.setLayoutData(gd);
|
||||
createCommonTabs(tabFolder);
|
||||
tabFolder.pack();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -345,22 +352,12 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
protected void opened() {
|
||||
// Set the min size of the shell to the current
|
||||
// shell size since it has been packed before this call
|
||||
// shell.setMinimumSize(shell.getSize());
|
||||
shell.setMinimumSize(shell.getSize());
|
||||
}
|
||||
|
||||
/** Create the tabs */
|
||||
private void createCommonTabs(TabFolder tabFolder) {
|
||||
createTabs(tabFolder);
|
||||
GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
|
||||
GridLayout gl = new GridLayout(1, false);
|
||||
|
||||
TabItem spatialTab = new TabItem(tabFolder, SWT.NONE);
|
||||
spatialTab.setText(SPATIAL_TAB);
|
||||
Composite spatialComp = new Composite(tabFolder, SWT.NONE);
|
||||
spatialComp.setLayout(gl);
|
||||
spatialComp.setLayoutData(gd);
|
||||
spatialTab.setControl(spatialComp);
|
||||
spatialTabControls = new SpatialSubsetTab(spatialComp, dataSet, this);
|
||||
|
||||
TabItem savedSetsTab = new TabItem(tabFolder, SWT.NONE);
|
||||
savedSetsTab.setText("Saved Subsets");
|
||||
|
@ -369,23 +366,6 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
subsetTab = new SavedSubsetTab(savedSetsComp, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct and return the presenter class.
|
||||
*
|
||||
* @param shell
|
||||
* @param subsetManagerDlg
|
||||
* @param dataSet2
|
||||
* @param timingComp
|
||||
*
|
||||
* @return the presenter instance
|
||||
*/
|
||||
protected abstract PRESENTER getDataTimingSubsetPresenter(
|
||||
Composite parentComp, DATASET dataSet, IDataSize callback,
|
||||
Shell shell);
|
||||
|
||||
protected abstract <T extends Subscription> T populateSubscription(T sub,
|
||||
boolean create);
|
||||
|
||||
/** Create the information composite */
|
||||
private void createInfoComp() {
|
||||
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
|
@ -491,14 +471,14 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
* Launch the Create Subscription GUI
|
||||
*/
|
||||
private boolean handleOK(Subscription sub) {
|
||||
System.out.println("SubsetManagerDlg.handleOK(): Implement Me");
|
||||
if (this.validated(true)) {
|
||||
if (subDlg != null && !subDlg.isDisposed()) {
|
||||
subDlg.bringToTop();
|
||||
} else {
|
||||
subDlg = new CreateSubscriptionDlgPresenter(
|
||||
new CreateSubscriptionDlg(shell, create), dataSet,
|
||||
create, new VizAppTaskExecutor());
|
||||
subDlg.setSubscriptionData(sub);
|
||||
subDlg = new CreateSubscriptionDlg(shell, create, dataSet,
|
||||
new VizAppTaskExecutor());
|
||||
subDlg.setSubscription(sub);
|
||||
subDlg.open();
|
||||
}
|
||||
return subDlg.getStatus() == Status.OK;
|
||||
|
@ -508,7 +488,7 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
}
|
||||
|
||||
/**
|
||||
* Query button action handler.
|
||||
* * u Query button action handler.
|
||||
*/
|
||||
private void handleQuery() {
|
||||
boolean valid = this.validated(false);
|
||||
|
@ -597,16 +577,12 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
sub.setActive(this.subscription.isActive());
|
||||
sub.setPriority(this.subscription.getPriority());
|
||||
}
|
||||
sub.setProvider(dataSet.getProviderName());
|
||||
sub.setDataSetName(dataSet.getDataSetName());
|
||||
sub.setDataSetType(dataSet.getDataSetType());
|
||||
|
||||
// Catch the case where the user closes this dialog.
|
||||
if (this.isDisposed()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
sub.setDataSetName(dataSet.getDataSetName());
|
||||
sub.setSubscriptionId("AdHocID");
|
||||
if (this.subscription != null) {
|
||||
if (this.subscription.getDescription() != null) {
|
||||
|
@ -620,11 +596,6 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
return populateSubscription(sub, create);
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the timing information specific to the data type.
|
||||
*/
|
||||
protected abstract Time setupDataSpecificTime(Time newTime, Subscription sub);
|
||||
|
||||
/**
|
||||
* Display cancel changes message.
|
||||
*/
|
||||
|
@ -699,9 +670,36 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
}
|
||||
|
||||
/**
|
||||
* Validate the area.
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
private boolean validateArea() {
|
||||
@Override
|
||||
public void handleSaveSubset() {
|
||||
|
||||
if (!DataDeliveryGUIUtils.hasText(this.nameText)) {
|
||||
DataDeliveryUtils.showMessage(getShell(), SWT.OK, "Name Required",
|
||||
"Name requred. A subset name must be entered.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (DataDeliveryGUIUtils.INVALID_CHAR_PATTERN.matcher(
|
||||
nameText.getText().trim()).find()) {
|
||||
DataDeliveryUtils
|
||||
.showMessage(getShell(), SWT.ERROR, "Invalid Characters",
|
||||
"Invalid characters. The Subset Name may only contain letters/numbers/dashes.");
|
||||
return;
|
||||
}
|
||||
|
||||
SubsetXML subset = new SubsetXML();
|
||||
populateSubsetXML(subset);
|
||||
|
||||
// Have all the info, now save the file
|
||||
SubsetFileManager.getInstance().saveSubset(subset, this.shell);
|
||||
setClean();
|
||||
subsetTab.enableButtons(nameText);
|
||||
}
|
||||
|
||||
/** Validate the area */
|
||||
protected boolean validateArea() {
|
||||
ReferencedEnvelope envelope = spatialTabControls.getEnvelope();
|
||||
|
||||
if (envelope == null) {
|
||||
|
@ -723,7 +721,9 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
valid = true;
|
||||
}
|
||||
} catch (TransformException e) {
|
||||
statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
|
||||
statusHandler.handle(
|
||||
com.raytheon.uf.common.status.UFStatus.Priority.PROBLEM,
|
||||
e.getLocalizedMessage(), e);
|
||||
}
|
||||
|
||||
if (!valid) {
|
||||
|
@ -743,33 +743,13 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleSaveSubset() {
|
||||
|
||||
if (!DataDeliveryGUIUtils.hasText(this.nameText)) {
|
||||
DataDeliveryUtils.showMessage(getShell(), SWT.OK, "Name Required",
|
||||
"Name requred. A subset name must be entered.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (DataDeliveryGUIUtils.INVALID_CHAR_PATTERN.matcher(
|
||||
nameText.getText().trim()).find()) {
|
||||
DataDeliveryUtils
|
||||
.showMessage(getShell(), SWT.ERROR, "Invalid Characters",
|
||||
"Invalid characters. The Subset Name may only contain letters/numbers/dashes.");
|
||||
return;
|
||||
}
|
||||
|
||||
SubsetXML<TIMEXML> subset = new SubsetXML<TIMEXML>();
|
||||
populateSubsetXML(subset);
|
||||
|
||||
// Have all the info, now save the file
|
||||
SubsetFileManager.getInstance().saveSubset(subset, this.shell);
|
||||
setClean();
|
||||
subsetTab.enableButtons(nameText);
|
||||
}
|
||||
|
||||
protected void populateSubsetXML(SubsetXML<TIMEXML> subset) {
|
||||
/**
|
||||
* Populate the subset XML data object.
|
||||
*
|
||||
* @param subset
|
||||
* The SubsetXML object to populate
|
||||
*/
|
||||
protected void populateSubsetXML(SubsetXML subset) {
|
||||
subset.setBaseSubsetName(nameText.getText());
|
||||
subset.setDatasetName(dataSet.getDataSetName());
|
||||
subset.setProviderName(dataSet.getProviderName());
|
||||
|
@ -778,8 +758,8 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
AreaXML area = spatialTabControls.getSaveInfo();
|
||||
subset.setArea(area);
|
||||
|
||||
// TODO Only save this for grid. Once Obs have parameters then this will
|
||||
// need to be saved for obs
|
||||
// TODO Only save this for grid. Once Obs have parameters then this
|
||||
// will need to be saved for obs
|
||||
if (dataSet.getDataSetType() == DataType.GRID) {
|
||||
// next save vertical layer/parameter info
|
||||
ArrayList<VerticalXML> vertList = vTab.getSaveInfo();
|
||||
|
@ -787,7 +767,7 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
}
|
||||
|
||||
// finally the date/cycle/forecast data
|
||||
TIMEXML time = timingTabControls.getSaveInfo();
|
||||
TimeXML time = getDataTimeInfo();
|
||||
subset.setTime(time);
|
||||
}
|
||||
|
||||
|
@ -801,15 +781,19 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void handleLoadSubset(String subsetName) {
|
||||
|
||||
// TODO: How else to do this other than casting?
|
||||
SubsetXML<TIMEXML> loadedSubsetXml = (SubsetXML<TIMEXML>) SubsetFileManager
|
||||
.getInstance().loadSubset(subsetName);
|
||||
SubsetXML loadedSubsetXml = SubsetFileManager.getInstance().loadSubset(
|
||||
subsetName);
|
||||
|
||||
loadFromSubsetXML(loadedSubsetXml);
|
||||
}
|
||||
|
||||
protected void loadFromSubsetXML(SubsetXML<TIMEXML> subsetXml) {
|
||||
/**
|
||||
* Populate the dialog from the SubsetXML object.
|
||||
*
|
||||
* @param subsetXml
|
||||
* The subset xml object
|
||||
*/
|
||||
protected void loadFromSubsetXML(SubsetXML subsetXml) {
|
||||
if (this.subsetXml == subsetXml) {
|
||||
// only populate area and name if subsetXml is loading from initial
|
||||
// load, not from the saved subsets tab.
|
||||
|
@ -821,35 +805,16 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Populate the dialog from the Subscription object.
|
||||
*
|
||||
* @param subscription
|
||||
* The subscription object
|
||||
*/
|
||||
protected void loadFromSubscription(Subscription subscription) {
|
||||
this.nameText.setText(this.subscription.getName());
|
||||
|
||||
// Area
|
||||
AreaXML area = new AreaXML();
|
||||
|
||||
ReferencedEnvelope envelope = this.subscription.getCoverage()
|
||||
.getEnvelope();
|
||||
ReferencedEnvelope requestEnvelope = this.subscription.getCoverage()
|
||||
.getRequestEnvelope();
|
||||
|
||||
if (requestEnvelope != null && !requestEnvelope.isEmpty()) {
|
||||
area.setEnvelope(requestEnvelope);
|
||||
} else {
|
||||
area.setEnvelope(envelope);
|
||||
}
|
||||
|
||||
spatialTabControls.setDataSet(this.dataSet);
|
||||
spatialTabControls.populate(area);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Time object.
|
||||
*
|
||||
* @return The time object
|
||||
*/
|
||||
protected abstract TIMEXML getTimeXmlFromSubscription();
|
||||
|
||||
/**
|
||||
* If any mods have been made to the composite selections, set dirty true.
|
||||
*/
|
||||
|
@ -859,10 +824,6 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
return true;
|
||||
}
|
||||
|
||||
if (timingTabControls.isDirty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (spatialTabControls.isSpatialDirty()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -877,7 +838,6 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
if (vTab != null) {
|
||||
vTab.setClean();
|
||||
}
|
||||
timingTabControls.setDirty(false);
|
||||
spatialTabControls.setSpatialDirty(false);
|
||||
}
|
||||
|
||||
|
@ -887,19 +847,18 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
*
|
||||
* @param shell
|
||||
* the current dialog shell
|
||||
* @param data
|
||||
* @param dataSet
|
||||
* the data set
|
||||
* @return the dialog
|
||||
*/
|
||||
public static SubsetManagerDlg<?, ?, ?> fromDataSet(Shell shell,
|
||||
DataSet data) {
|
||||
if (data.getDataSetType() == DataType.GRID) {
|
||||
return new GriddedSubsetManagerDlg(shell, (GriddedDataSet) data);
|
||||
} else if (data.getDataSetType() == DataType.POINT) {
|
||||
return new PointSubsetManagerDlg(shell, (PointDataSet) data);
|
||||
public static SubsetManagerDlg fromDataSet(Shell shell, DataSet dataSet) {
|
||||
if (dataSet.getDataSetType() == DataType.GRID) {
|
||||
return new GriddedSubsetManagerDlg(shell, (GriddedDataSet) dataSet);
|
||||
} else if (dataSet.getDataSetType() == DataType.POINT) {
|
||||
return new PointSubsetManagerDlg(shell, (PointDataSet) dataSet);
|
||||
}
|
||||
throw new IllegalArgumentException(String.format(
|
||||
DATASETS_NOT_SUPPORTED, data.getClass().getName()));
|
||||
DATASETS_NOT_SUPPORTED, dataSet.getClass().getName()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -914,7 +873,7 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
* the subscription object
|
||||
* @return SubsetManagerDlg
|
||||
*/
|
||||
public static SubsetManagerDlg<?, ?, ?> fromSubscription(Shell shell,
|
||||
public static SubsetManagerDlg fromSubscription(Shell shell,
|
||||
boolean loadDataSet, Subscription subscription) {
|
||||
if (DataType.GRID == subscription.getDataSetType()) {
|
||||
return new GriddedSubsetManagerDlg(shell, loadDataSet, subscription);
|
||||
|
@ -941,14 +900,14 @@ public abstract class SubsetManagerDlg<DATASET extends DataSet, PRESENTER extend
|
|||
* @return SubsetManagerDlg
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static SubsetManagerDlg<?, ?, ?> fromSubsetXML(Shell shell,
|
||||
DataSet data, boolean loadDataSet, SubsetXML<?> subset) {
|
||||
public static SubsetManagerDlg fromSubsetXML(Shell shell, DataSet data,
|
||||
boolean loadDataSet, SubsetXML subset) {
|
||||
if (data instanceof GriddedDataSet) {
|
||||
return new GriddedSubsetManagerDlg(shell, (GriddedDataSet) data,
|
||||
loadDataSet, (SubsetXML<SpecificDateTimeXML>) subset);
|
||||
loadDataSet, subset);
|
||||
} else if (data instanceof PointDataSet) {
|
||||
return new PointSubsetManagerDlg(shell, (PointDataSet) data, true,
|
||||
(SubsetXML<PointTimeXML>) subset);
|
||||
subset);
|
||||
}
|
||||
throw new IllegalArgumentException(String.format(
|
||||
DATASETS_NOT_SUPPORTED, data.getClass().getName()));
|
||||
|
|
|
@ -1,127 +0,0 @@
|
|||
/**
|
||||
* 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.datadelivery.subscription.subset.presenter;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetMetaDataFilterableQuery;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.TimeXML;
|
||||
|
||||
/**
|
||||
* The presenter class that handles logic for {@link IDataTimingSubsetView}
|
||||
* classes. The model-view-presenter pattern (MVP) allows all of the logic and
|
||||
* important state to be gui implementation independent, which greatly assists
|
||||
* testing. This class is thread-safe.
|
||||
*
|
||||
* @see http://aspiringcraftsman.com/tag/model-view-presenter
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 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.
|
||||
* Jan 10, 2013 1444 mpduff Add updateSettings method.
|
||||
* Jun 04, 2013 223 mpduff Move Grid specific items to sub class.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class DataTimingSubsetPresenter<DATASET extends DataSet, DATASETMETADATA extends DataSetMetaData, VIEW extends IDataTimingSubsetView, TIMEXML extends TimeXML, QUERY extends DataSetMetaDataFilterableQuery<DATASETMETADATA>> {
|
||||
@VisibleForTesting
|
||||
final String POPUP_TITLE = "Notice";
|
||||
|
||||
@VisibleForTesting
|
||||
final String SUBSCRIPTIONS_ONLY_USE_LATEST_DATE = "Subscriptions always use the latest date, only adhoc queries support specific date requests."
|
||||
+ " Overriding options to use the latest date.";
|
||||
|
||||
protected final VIEW view;
|
||||
|
||||
protected DATASET dataSet;
|
||||
|
||||
/**
|
||||
* @param dataSet
|
||||
* @param dataTimingSubsetTab
|
||||
*/
|
||||
public DataTimingSubsetPresenter(DATASET dataSet, VIEW view) {
|
||||
this.dataSet = dataSet;
|
||||
this.view = view;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the presenter.
|
||||
*/
|
||||
public void init() {
|
||||
view.init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public boolean isDirty() {
|
||||
return view.isDirty();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public void setDirty(boolean b) {
|
||||
view.setDirty(b);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
|
@ -1,235 +0,0 @@
|
|||
/**
|
||||
* 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.datadelivery.subscription.subset.presenter;
|
||||
|
||||
import static com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.getMaxLatency;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils;
|
||||
import com.raytheon.viz.ui.presenter.components.ButtonConf;
|
||||
import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
|
||||
import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
|
||||
import com.raytheon.viz.ui.presenter.components.ListConf;
|
||||
|
||||
/**
|
||||
* Gridded data timing selection dialog presenter.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 12, 2012 mpduff Initial creation
|
||||
* Sep 27, 2012 1202 bgonzale Set selectionDate to date and cycle.
|
||||
* Oct 11, 2012 1263 jpiatt Modified for cancel flag.
|
||||
* Jan 04, 2013 1420 mpduff Add the dataset object.
|
||||
* Jan 22, 2013 1519 djohnson Use DataDeliveryUtils.getMaxLatency().
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GriddedTimingSelectionPresenter {
|
||||
|
||||
/** Popup title */
|
||||
@VisibleForTesting
|
||||
final String POPUP_TITLE = "Notice";
|
||||
|
||||
/** Popup message for no data selected */
|
||||
@VisibleForTesting
|
||||
final String VALID_DATE_MUST_BE_SELECTED = "A valid date must be selected.";
|
||||
|
||||
/** The dialog view class */
|
||||
private final IGriddedTimingSelectionDlgView view;
|
||||
|
||||
/** Latest data check box conf object */
|
||||
@VisibleForTesting
|
||||
final CheckBoxConf latestDataChkConf;
|
||||
|
||||
/** Latest data check box action handler */
|
||||
private final Runnable latestDataChkAction = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
toggleUseLatestData();
|
||||
}
|
||||
};
|
||||
|
||||
/** Ok button action handler */
|
||||
@VisibleForTesting
|
||||
final Runnable okBtnAction = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (handleOk()) {
|
||||
view.closeDlg();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** Cancel button action handler */
|
||||
@VisibleForTesting
|
||||
final Runnable cancelBtnAction = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
cancel = true;
|
||||
}
|
||||
};
|
||||
|
||||
/** Cancel flag */
|
||||
private boolean cancel = false;
|
||||
|
||||
/** Date/cycle list conf object */
|
||||
@VisibleForTesting
|
||||
final ListConf dateCycleListConf;
|
||||
|
||||
/** Ok button conf object */
|
||||
@VisibleForTesting
|
||||
final ButtonConf okBtnConf;
|
||||
|
||||
/** Cancel button conf object */
|
||||
@VisibleForTesting
|
||||
ButtonConf cancelBtnConf;
|
||||
|
||||
/** The selected cycle */
|
||||
private int cycle = -999;
|
||||
|
||||
/** The selected date */
|
||||
private String selectedDate;
|
||||
|
||||
/** The Gridded dataset obj */
|
||||
private final GriddedDataSet dataSet;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param view
|
||||
* The view
|
||||
* @param dataSet
|
||||
* The dataset
|
||||
* @param dateCycleList
|
||||
* The date/cycle list values
|
||||
*/
|
||||
public GriddedTimingSelectionPresenter(IGriddedTimingSelectionDlgView view,
|
||||
GriddedDataSet dataSet, List<String> dateCycleList) {
|
||||
this.view = view;
|
||||
this.dataSet = dataSet;
|
||||
|
||||
latestDataChkConf = new CheckBoxConf("Get Latest Data", true,
|
||||
"Use the latest time", latestDataChkAction);
|
||||
|
||||
int width = 175;
|
||||
int height = 225;
|
||||
dateCycleListConf = new ListConf("Date/Cycle options",
|
||||
dateCycleList.toArray(new String[dateCycleList.size()]), true,
|
||||
width, height);
|
||||
|
||||
okBtnConf = new ButtonConf(true, "OK", null, okBtnAction);
|
||||
cancelBtnConf = new ButtonConf(true, "Cancel", null, cancelBtnAction);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize the view.
|
||||
*/
|
||||
public void init() {
|
||||
view.setLatestDataCheckBox(latestDataChkConf);
|
||||
view.setDateCycleList(dateCycleListConf);
|
||||
view.setOkButton(okBtnConf);
|
||||
view.setCancelButton(cancelBtnConf);
|
||||
}
|
||||
|
||||
/**
|
||||
* OK Button action method.
|
||||
*
|
||||
* @return true if everything ok
|
||||
*/
|
||||
protected boolean handleOk() {
|
||||
if (!view.isLatestDataEnabled()) {
|
||||
String selection = view.getSelection();
|
||||
if (ComboBoxConf.SELECT_ONE.equals(selection)
|
||||
|| ComboBoxConf.NONE_AVAILABLE.equals(selection)) {
|
||||
view.displayPopup(POPUP_TITLE, VALID_DATE_MUST_BE_SELECTED);
|
||||
return false;
|
||||
}
|
||||
|
||||
DataDeliveryGUIUtils.latencyValidChk(view.getLatency(),
|
||||
getMaxLatency(dataSet));
|
||||
|
||||
// parse off the date/cycle time selected
|
||||
String[] parts = selection.split(" - ");
|
||||
this.selectedDate = selection;
|
||||
String cycleStr = parts[1];
|
||||
cycleStr = cycleStr.substring(0, cycleStr.indexOf(" Z"));
|
||||
this.cycle = Integer.parseInt(cycleStr);
|
||||
} else {
|
||||
this.cycle = -999;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called via the "Use Latest Data" checkbox being
|
||||
* selected/unselected.
|
||||
*/
|
||||
protected void toggleUseLatestData() {
|
||||
view.setDateCycleListEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the dialog.
|
||||
*
|
||||
* @return The selected cycle
|
||||
*/
|
||||
public Integer open() {
|
||||
Runnable callback = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
init();
|
||||
}
|
||||
};
|
||||
this.view.setPreOpenCallback(callback);
|
||||
this.view.openDlg();
|
||||
|
||||
return cycle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the selected date.
|
||||
*
|
||||
* @return the selected date string
|
||||
*/
|
||||
public String getDate() {
|
||||
return this.selectedDate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cancel flag.
|
||||
*
|
||||
* @return true if cancel selected
|
||||
*/
|
||||
public boolean isCancel() {
|
||||
return cancel;
|
||||
}
|
||||
}
|
|
@ -1,141 +0,0 @@
|
|||
/**
|
||||
* 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.datadelivery.subscription.subset.presenter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.SortedSet;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.GriddedDataSetMetaDataQuery;
|
||||
import com.raytheon.uf.common.util.CollectionUtil;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SpecificDateTimeXML;
|
||||
|
||||
/**
|
||||
* {@link DataTimingSubsetPresenter} for Gridded data.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* 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>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GriddedTimingSubsetPresenter
|
||||
extends
|
||||
DataTimingSubsetPresenter<GriddedDataSet, GriddedDataSetMetaData, IGriddedDataTimingSubsetView, SpecificDateTimeXML, GriddedDataSetMetaDataQuery> {
|
||||
|
||||
@VisibleForTesting
|
||||
final String NO_DATA_FOR_DATE_AND_CYCLE = "No data is available for the specified date and cycle combination.";
|
||||
|
||||
@VisibleForTesting
|
||||
final String MORE_THAN_ONE_CYCLE_SELECTED = "Adhoc queries can only be requested for a single cycle.";
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param dataSet
|
||||
* @param view
|
||||
*/
|
||||
public GriddedTimingSubsetPresenter(GriddedDataSet dataSet,
|
||||
IGriddedDataTimingSubsetView view) {
|
||||
super(dataSet, view);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
SortedSet<Integer> forecastHours = new TreeSet<Integer>(
|
||||
dataSet.getForecastHours());
|
||||
|
||||
List<String> forecastHoursAsString = new ArrayList<String>();
|
||||
for (Integer integer : forecastHours) {
|
||||
forecastHoursAsString.add(Integer.toString(integer));
|
||||
}
|
||||
|
||||
view.setAvailableForecastHours(forecastHoursAsString);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public SpecificDateTimeXML getSaveInfo() {
|
||||
|
||||
SpecificDateTimeXML time = new SpecificDateTimeXML();
|
||||
|
||||
String[] fcstHrs = view.getSelectedFcstHours();
|
||||
for (String hr : fcstHrs) {
|
||||
time.addHour(hr);
|
||||
}
|
||||
|
||||
return time;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the selected forecast hours
|
||||
*
|
||||
* @return the selected forecast hours
|
||||
*/
|
||||
public String[] getSelectedFcstHours() {
|
||||
return view.getSelectedFcstHours();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void populate(SpecificDateTimeXML time, DataSet dataSet) {
|
||||
view.setSelectedForecastHours(time.getFcstHours());
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether the selections are valid.
|
||||
*
|
||||
* @return true if tab is valid
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
String[] forecastHours = view.getSelectedFcstHours();
|
||||
|
||||
return !CollectionUtil.isNullOrEmpty(forecastHours);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void updateSettings(SpecificDateTimeXML time) {
|
||||
view.updateSelectedForecastHours(time.getFcstHours());
|
||||
}
|
||||
}
|
|
@ -1,62 +0,0 @@
|
|||
/**
|
||||
* 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.datadelivery.subscription.subset.presenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.viz.ui.presenter.IPresenterView;
|
||||
|
||||
/**
|
||||
* Implements view specific functions that the {@link DataTimingSubsetPresenter}
|
||||
* will call. For instance, the presenter will retrieve a list of available
|
||||
* dates for a specific dataset and call {@link #setDataSetDates(List)}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 15, 2012 0743 djohnson Initial creation
|
||||
* Aug 29, 2012 0223 mpduff Changed as result of renamed objects.
|
||||
* Sep 24, 2012 1209 djohnson isValid() moved to presenter.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IDataTimingSubsetView extends IPresenterView {
|
||||
/**
|
||||
* Check whether the date cycle is dirty.
|
||||
*
|
||||
* @return true if the date cycle is dirty
|
||||
*/
|
||||
boolean isDirty();
|
||||
|
||||
/**
|
||||
* Set whether the date cycle is dirty.
|
||||
*
|
||||
* @param b
|
||||
* the boolean value
|
||||
*/
|
||||
void setDirty(boolean b);
|
||||
}
|
|
@ -1,69 +0,0 @@
|
|||
/**
|
||||
* 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.datadelivery.subscription.subset.presenter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||
|
||||
/**
|
||||
* {@link IDataTimingSubsetView} that works with {@link GriddedDataSet}s.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 22, 2012 0743 djohnson Initial creation
|
||||
* Aug 29, 2012 0223 mpduff Removed cycles.
|
||||
* Jan 10, 2012 1444 mpduff Add updateSelectedForecastHours method.
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IGriddedDataTimingSubsetView extends IDataTimingSubsetView {
|
||||
|
||||
/**
|
||||
* Get the selected forecast hours
|
||||
*
|
||||
* @return the selected forecast hours
|
||||
*/
|
||||
String[] getSelectedFcstHours();
|
||||
|
||||
/**
|
||||
* @param fcstHours
|
||||
*/
|
||||
void setSelectedForecastHours(List<String> fcstHours);
|
||||
|
||||
/**
|
||||
* @param fcstHours
|
||||
*/
|
||||
void setAvailableForecastHours(List<String> fcstHours);
|
||||
|
||||
/**
|
||||
* Update the selected forecast hours.
|
||||
*
|
||||
* @param fcstHours
|
||||
*/
|
||||
void updateSelectedForecastHours(List<String> fcstHours);
|
||||
}
|
|
@ -1,128 +0,0 @@
|
|||
/**
|
||||
* 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.datadelivery.subscription.subset.presenter;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||
import com.raytheon.viz.ui.presenter.IPresenterView;
|
||||
import com.raytheon.viz.ui.presenter.components.ButtonConf;
|
||||
import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
|
||||
import com.raytheon.viz.ui.presenter.components.ListConf;
|
||||
|
||||
/**
|
||||
* IGriddedTimingSelectionDlgView interface
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 12, 2012 mpduff Initial creation.
|
||||
* Oct 11, 2012 1263 jpiatt Modified for cancel flag.
|
||||
* Jan 04, 2013 1420 mpduff Add getters for Latency and Priority.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IGriddedTimingSelectionDlgView extends IPresenterView {
|
||||
|
||||
/**
|
||||
* Open the view dialog.
|
||||
*
|
||||
* @return the selection
|
||||
*/
|
||||
Integer openDlg();
|
||||
|
||||
/**
|
||||
* Set the config object for the latest data check box.
|
||||
*
|
||||
* @param checkBoxConf
|
||||
*/
|
||||
void setLatestDataCheckBox(CheckBoxConf checkBoxConf);
|
||||
|
||||
/**
|
||||
* Set the date/cycle list config object.
|
||||
*
|
||||
* @param dateCycleListConf
|
||||
*/
|
||||
void setDateCycleList(ListConf dateCycleListConf);
|
||||
|
||||
/**
|
||||
* Set the config object for the ok button.
|
||||
*
|
||||
* @param okBtnConf
|
||||
*/
|
||||
void setOkButton(ButtonConf okBtnConf);
|
||||
|
||||
/**
|
||||
* Set the callback to be called at preopen.
|
||||
*
|
||||
* @param preOpenCallback
|
||||
*/
|
||||
void setPreOpenCallback(Runnable preOpenCallback);
|
||||
|
||||
/**
|
||||
* Check if the latest data checkbox is enabled.
|
||||
*
|
||||
* @return true if enabled.
|
||||
*/
|
||||
boolean isLatestDataEnabled();
|
||||
|
||||
/**
|
||||
* Set the date/cycle list enabled.
|
||||
*/
|
||||
void setDateCycleListEnabled();
|
||||
|
||||
/**
|
||||
* Get the list selection.
|
||||
*
|
||||
* @return the selected item in the list
|
||||
*/
|
||||
String getSelection();
|
||||
|
||||
/**
|
||||
* Close the dialog.
|
||||
*/
|
||||
void closeDlg();
|
||||
|
||||
/**
|
||||
* Set the cancel button.
|
||||
*
|
||||
* @param cancelBtnConf
|
||||
*/
|
||||
void setCancelButton(ButtonConf cancelBtnConf);
|
||||
|
||||
/**
|
||||
* Get the latency value.
|
||||
*
|
||||
* @return Latency value
|
||||
*/
|
||||
int getLatency();
|
||||
|
||||
/**
|
||||
* Get the priority.
|
||||
*
|
||||
* @return priority
|
||||
*/
|
||||
SubscriptionPriority getPriority();
|
||||
}
|
|
@ -1,54 +0,0 @@
|
|||
/**
|
||||
* 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.datadelivery.subscription.subset.presenter;
|
||||
|
||||
/**
|
||||
* TODO Add Description
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 29, 2013 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface IPointDataTimingSubsetView extends IDataTimingSubsetView {
|
||||
/**
|
||||
* Set the Data Retrieval Interval.
|
||||
*
|
||||
* @param interval
|
||||
* the interval to set
|
||||
*/
|
||||
void setDataRetrievalInterval(int interval);
|
||||
|
||||
/**
|
||||
* Get the Data Retrieval Interval.
|
||||
*
|
||||
* @return the data retrieval interval
|
||||
*/
|
||||
int getDataRetrievalInterval();
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
/**
|
||||
* 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.datadelivery.subscription.subset.presenter;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PointDataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.PointDataSetMetaData;
|
||||
import com.raytheon.uf.common.datadelivery.registry.ebxml.PointDataSetMetaDataQuery;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.PointTimeXML;
|
||||
|
||||
/**
|
||||
* Point timing tab Presenter.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* May 29, 2013 223 mpduff Initial creation.
|
||||
* Jun 13, 2013 2108 mpduff Get the retrieval interval from the view.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class PointTimeSubsetPresenter
|
||||
extends
|
||||
DataTimingSubsetPresenter<PointDataSet, PointDataSetMetaData, IPointDataTimingSubsetView, PointTimeXML, PointDataSetMetaDataQuery> {
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param dataSet
|
||||
* the PointDataSet
|
||||
* @param view
|
||||
* The View
|
||||
*/
|
||||
public PointTimeSubsetPresenter(PointDataSet dataSet,
|
||||
IPointDataTimingSubsetView view) {
|
||||
super(dataSet, view);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
// This is a combo box. Something is always selected. Just return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public PointTimeXML getSaveInfo() {
|
||||
PointTimeXML ptx = new PointTimeXML();
|
||||
ptx.setDataRetrievalInterval(view.getDataRetrievalInterval());
|
||||
return ptx;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void populate(PointTimeXML time, DataSet dataSet) {
|
||||
view.setDataRetrievalInterval(time.getDataRetrievalInterval());
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void updateSettings(PointTimeXML time) {
|
||||
view.setDataRetrievalInterval(time.getDataRetrievalInterval());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data retrieval interval.
|
||||
*
|
||||
* @return the data retrieval interval
|
||||
*/
|
||||
public int getDataRetrievalInterval() {
|
||||
return view.getDataRetrievalInterval();
|
||||
}
|
||||
}
|
|
@ -46,6 +46,7 @@ import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml;
|
|||
* Aug 10, 2012 1022 djohnson {@link SubsetXML} requires provider name.
|
||||
* Feb 15, 2013 1638 mschenke Moved Util.EOL into FileUtil.
|
||||
* Jun 04, 2013 223 mpduff Refactoring method name change.
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -54,7 +55,7 @@ import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml;
|
|||
*/
|
||||
@XmlRootElement(name = "Subset")
|
||||
@XmlAccessorType(XmlAccessType.NONE)
|
||||
public class SubsetXML<TIMEXML extends TimeXML> implements IDisplayXml {
|
||||
public class SubsetXML implements IDisplayXml {
|
||||
private static final String XML_FILE_EXTENSION = ".xml";
|
||||
|
||||
@XmlElement(name = "datasetName", type = String.class)
|
||||
|
@ -76,7 +77,7 @@ public class SubsetXML<TIMEXML extends TimeXML> implements IDisplayXml {
|
|||
protected ArrayList<VerticalXML> verticalList = new ArrayList<VerticalXML>();
|
||||
|
||||
@XmlElementRef
|
||||
protected TIMEXML time;
|
||||
protected TimeXML time;
|
||||
|
||||
/**
|
||||
* @return the subsetName
|
||||
|
@ -151,7 +152,7 @@ public class SubsetXML<TIMEXML extends TimeXML> implements IDisplayXml {
|
|||
/**
|
||||
* @return the time
|
||||
*/
|
||||
public TIMEXML getTime() {
|
||||
public TimeXML getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
|
@ -159,7 +160,7 @@ public class SubsetXML<TIMEXML extends TimeXML> implements IDisplayXml {
|
|||
* @param time
|
||||
* the time to set
|
||||
*/
|
||||
public void setTime(TIMEXML time) {
|
||||
public void setTime(TimeXML time) {
|
||||
this.time = time;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,413 +0,0 @@
|
|||
/**
|
||||
* 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.datadelivery.subscription.view;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
|
||||
import com.raytheon.viz.ui.presenter.IPresenterView;
|
||||
import com.raytheon.viz.ui.presenter.components.ButtonConf;
|
||||
import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
|
||||
|
||||
/**
|
||||
* Create Subscription Dialog View Interface.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 24, 2012 0223 mpduff Initial creation
|
||||
* Dec 13, 2012 1391 bgonzale Added status methods.
|
||||
* Jan 02, 2013 1441 djohnson Add isGroupSelected.
|
||||
* Jan 04, 2013 1420 mpduff Added getters for latency and priority.
|
||||
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
|
||||
* Apr 08, 2013 1826 djohnson Remove delivery options.
|
||||
* May 13, 2013 1040 mpduff Added getSharedSites method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public interface ICreateSubscriptionDlgView extends IPresenterView {
|
||||
/**
|
||||
* Get the subscription Name.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getSubscriptionName();
|
||||
|
||||
/**
|
||||
* Set the subscription name.
|
||||
*
|
||||
* @param subscriptionName
|
||||
*/
|
||||
void setSubscriptionName(String subscriptionName);
|
||||
|
||||
/**
|
||||
* Get the subscription description
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getSubscriptionDescription();
|
||||
|
||||
/**
|
||||
* Set the subscription description.
|
||||
*
|
||||
* @param subscriptionDescription
|
||||
*/
|
||||
void setSubscriptionDescription(String subscriptionDescription);
|
||||
|
||||
/**
|
||||
* Get the group name.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getGroupName();
|
||||
|
||||
/**
|
||||
* Set the group name.
|
||||
*
|
||||
* @param groupName
|
||||
*/
|
||||
void setGroupName(String groupName);
|
||||
|
||||
/**
|
||||
* Is the no expiration date checkbox checked?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isNoExpirationDate();
|
||||
|
||||
/**
|
||||
* Set the no expiration date checkbox
|
||||
*
|
||||
* @param noExpiration
|
||||
*/
|
||||
void setNoExpiration(boolean noExpiration);
|
||||
|
||||
/**
|
||||
* Get the start text.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getStartText();
|
||||
|
||||
/**
|
||||
* Get the selected status.
|
||||
*
|
||||
* @return Status.OK if Ok selected; Status.CANCEL if cancel selected.
|
||||
*/
|
||||
int getStatus();
|
||||
|
||||
/**
|
||||
* Set the selected status. Set to Status.OK if Ok selected; Status.CANCEL
|
||||
* if cancel selected.
|
||||
*/
|
||||
void setStatus(int status);
|
||||
|
||||
/**
|
||||
* Set the start date
|
||||
*
|
||||
* @param startDate
|
||||
*/
|
||||
void setStartDate(Date startDate);
|
||||
|
||||
/**
|
||||
* Get the expiration time text
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getExpirationText();
|
||||
|
||||
/**
|
||||
* Set the expiration date
|
||||
*
|
||||
* @param expDate
|
||||
*/
|
||||
void setExpirationDate(Date expDate);
|
||||
|
||||
/**
|
||||
* Get the is always active selection.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isAlwaysActive();
|
||||
|
||||
/**
|
||||
* Set the always active selection.
|
||||
*
|
||||
* @param active
|
||||
*/
|
||||
void setAlwaysActive(boolean active);
|
||||
|
||||
/**
|
||||
* Get the active start text
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getActiveStartText();
|
||||
|
||||
/**
|
||||
* Set the active start date
|
||||
*
|
||||
* @param activeStartDate
|
||||
*/
|
||||
void setActiveStartDate(Date activeStartDate);
|
||||
|
||||
/**
|
||||
* Get the active end text
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getActiveEndText();
|
||||
|
||||
/**
|
||||
* Set the active end date
|
||||
*
|
||||
* @param activeEndDate
|
||||
*/
|
||||
void setActiveEndDate(Date activeEndDate);
|
||||
|
||||
/**
|
||||
* Get the selected priority
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
SubscriptionPriority getPriority();
|
||||
|
||||
/**
|
||||
* Set the priority selection
|
||||
*
|
||||
* @param subscriptionPriority
|
||||
*/
|
||||
void setPriority(SubscriptionPriority subscriptionPriority);
|
||||
|
||||
/**
|
||||
* Open the dialog
|
||||
*/
|
||||
void openDlg();
|
||||
|
||||
/**
|
||||
* Is view disposed check
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isDisposed();
|
||||
|
||||
/**
|
||||
* Bring the view to the top
|
||||
*/
|
||||
void bringToTop();
|
||||
|
||||
/**
|
||||
* Set the subscription date fields enabled/disabled
|
||||
*
|
||||
* @param b
|
||||
*/
|
||||
void setSubscriptionDatesEnabled(boolean b);
|
||||
|
||||
/**
|
||||
* Set the start date button enabled/disabled
|
||||
*
|
||||
* @param b
|
||||
*/
|
||||
void setStartDateBtnEnabled(boolean b);
|
||||
|
||||
/**
|
||||
* Set the end date button enabled/disabled
|
||||
*
|
||||
* @param b
|
||||
*/
|
||||
void setEndDateBtnEnabled(boolean b);
|
||||
|
||||
/**
|
||||
* Set the active date fields enabled/disabled
|
||||
*
|
||||
* @param b
|
||||
*/
|
||||
void setActiveDatesEnabled(boolean b);
|
||||
|
||||
/**
|
||||
* Set the active end date button enabled/disabled
|
||||
*
|
||||
* @param b
|
||||
*/
|
||||
void setActiveEndDateBtnEnabled(boolean b);
|
||||
|
||||
/**
|
||||
* Set the active start date button enabled/disabled
|
||||
*
|
||||
* @param b
|
||||
*/
|
||||
void setActiveStartDateBtnEnabled(boolean b);
|
||||
|
||||
/**
|
||||
* Set the OK button config object.
|
||||
*
|
||||
* @param okConf
|
||||
*/
|
||||
void setOkConf(ButtonConf okConf);
|
||||
|
||||
/**
|
||||
* Get the create flag.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isCreate();
|
||||
|
||||
/**
|
||||
* Select all text in the subscription name field.
|
||||
*/
|
||||
void selectAllSubscriptionName();
|
||||
|
||||
/**
|
||||
* Get the change reason.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getChangeReason();
|
||||
|
||||
/**
|
||||
* Close the view dialog
|
||||
*/
|
||||
void closeDlg();
|
||||
|
||||
/**
|
||||
* Get list of selected cycle times
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Integer> getCycleTimes();
|
||||
|
||||
/**
|
||||
* Set the cycle checkbox config list
|
||||
*
|
||||
* @param checkboxConfList
|
||||
*/
|
||||
void setCycleConf(List<CheckBoxConf> checkboxConfList);
|
||||
|
||||
/**
|
||||
* Set the select all button config object
|
||||
*
|
||||
* @param selectAllConf
|
||||
*/
|
||||
void setSelectAllButton(ButtonConf selectAllConf);
|
||||
|
||||
/**
|
||||
* Set the deselect all button config object
|
||||
*
|
||||
* @param deselectAllConf
|
||||
*/
|
||||
void setDeselectAllButton(ButtonConf deselectAllConf);
|
||||
|
||||
/**
|
||||
* Set the date text fields enabled/disabled.
|
||||
*
|
||||
* @param flag
|
||||
*/
|
||||
void setDateTxtFieldsEnabled(boolean flag);
|
||||
|
||||
/**
|
||||
* Set the active text fields enabled/disabled
|
||||
*
|
||||
* @param flag
|
||||
*/
|
||||
void setActiveTextFieldsEnabled(boolean flag);
|
||||
|
||||
/**
|
||||
* Set the cycle times to select.
|
||||
*
|
||||
* @param cycleStrings
|
||||
*/
|
||||
void selectCycles(List<String> cycleStrings);
|
||||
|
||||
/**
|
||||
* The callback that should be performed when preOpened() is called.
|
||||
*
|
||||
* @param callback
|
||||
* the callback
|
||||
*/
|
||||
void setPreOpenCallback(Runnable callback);
|
||||
|
||||
/**
|
||||
* Create the cycle group portion of the subscription view.
|
||||
*/
|
||||
void createCycleGroup();
|
||||
|
||||
/**
|
||||
* Return the shell used for display content.
|
||||
*
|
||||
* @return the shell
|
||||
*/
|
||||
Shell getShell();
|
||||
|
||||
/**
|
||||
* Return true if a valid group is selected.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isGroupSelected();
|
||||
|
||||
/**
|
||||
* Get the latency value.
|
||||
*
|
||||
* @return the latency value
|
||||
*/
|
||||
int getLatencyValue();
|
||||
|
||||
/**
|
||||
* Set Subscription.
|
||||
*
|
||||
* @param subscription
|
||||
* the subscription
|
||||
*/
|
||||
void setSubscription(Subscription subscription);
|
||||
|
||||
/**
|
||||
* Set the cycle times of the model.
|
||||
*
|
||||
* @param cycleTimes
|
||||
*/
|
||||
void setCycleTimes(Set<Integer> cycleTimes);
|
||||
|
||||
/**
|
||||
* Get the list of shared sites
|
||||
*
|
||||
* @return shared sites
|
||||
*/
|
||||
String[] getSharedSites();
|
||||
|
||||
/**
|
||||
* Set the list of office ids.
|
||||
*
|
||||
* @param officeIDs
|
||||
* list of office ids
|
||||
*/
|
||||
void setOfficeIds(Set<String> officeIDs);
|
||||
}
|
|
@ -36,6 +36,7 @@ import org.eclipse.swt.widgets.Shell;
|
|||
|
||||
import com.raytheon.uf.common.datadelivery.registry.Coverage;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedTime;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Parameter;
|
||||
|
@ -81,6 +82,7 @@ import com.vividsolutions.jts.geom.Coordinate;
|
|||
* Jul 26, 2031 2232 mpduff Removed sendAuthorizationRequest method.
|
||||
* Aug 30, 2013 2288 bgonzale Added latency to details display.
|
||||
* Sept 30, 2013 1797 dhladky Time GriddedTime separation
|
||||
* Oct 11, 2013 2386 mpduff Refactor DD Front end.
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
|
@ -681,11 +683,11 @@ public class DataDeliveryUtils {
|
|||
}
|
||||
|
||||
final Time subTime = sub.getTime();
|
||||
|
||||
|
||||
if (subTime instanceof GriddedTime) {
|
||||
|
||||
GriddedTime gtime = (GriddedTime)subTime;
|
||||
|
||||
|
||||
GriddedTime gtime = (GriddedTime) subTime;
|
||||
|
||||
final List<String> fcstHours = gtime.getFcstHours();
|
||||
if (!CollectionUtil.isNullOrEmpty(fcstHours)) {
|
||||
fmtStr.append("Forecast Hours: ").append(newline);
|
||||
|
@ -708,7 +710,7 @@ public class DataDeliveryUtils {
|
|||
}
|
||||
} else if (subTime instanceof PointTime) {
|
||||
// Nothing done for Point at this time
|
||||
}
|
||||
}
|
||||
|
||||
List<Parameter> parmArray = sub.getParameter();
|
||||
if (!CollectionUtil.isNullOrEmpty(parmArray)) {
|
||||
|
@ -762,18 +764,14 @@ public class DataDeliveryUtils {
|
|||
* @return the maximum latency in minutes
|
||||
*/
|
||||
public static int getMaxLatency(Subscription<Time, Coverage> subscription) {
|
||||
|
||||
//TODO I am going to create a factory for Time so we don't have to do so much casting.
|
||||
// Getting the generics on subscription was part one of that project.
|
||||
|
||||
Time time = subscription.getTime();
|
||||
|
||||
if (time instanceof PointTime) {
|
||||
if (subscription.getDataSetType() == DataType.POINT) {
|
||||
return subscription.getLatencyInMinutes();
|
||||
} else if (time instanceof GriddedTime) {
|
||||
return getMaxLatency(((GriddedTime)subscription.getTime()).getCycleTimes());
|
||||
} else if (subscription.getDataSetType() == DataType.GRID) {
|
||||
return getMaxLatency(((GriddedTime) subscription.getTime())
|
||||
.getCycleTimes());
|
||||
} else {
|
||||
throw new IllegalArgumentException("Invalid Time object!");
|
||||
throw new IllegalArgumentException("Invalid Data Type: "
|
||||
+ subscription.getDataSetType().name());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,406 +0,0 @@
|
|||
/**
|
||||
* 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.datadelivery.subscription.presenter;
|
||||
|
||||
import static com.raytheon.uf.common.util.Matchers.yyyyMmDdMatches;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.Matchers.any;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Matchers.argThat;
|
||||
import static org.mockito.Matchers.same;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.times;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.common.datadelivery.registry.DataType;
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SiteSubscriptionFixture;
|
||||
import com.raytheon.uf.common.datadelivery.registry.Subscription;
|
||||
import com.raytheon.uf.common.datadelivery.registry.SubscriptionBuilder;
|
||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||
import com.raytheon.uf.common.time.CalendarBuilder;
|
||||
import com.raytheon.uf.common.time.util.TimeUtil;
|
||||
import com.raytheon.uf.common.time.util.TimeUtilTest;
|
||||
import com.raytheon.uf.viz.core.SameThreadGuiTaskExecutor;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceApplyPromptDisplayText;
|
||||
import com.raytheon.uf.viz.datadelivery.subscription.view.ICreateSubscriptionDlgView;
|
||||
|
||||
/**
|
||||
* Test {@link CreateSubscriptionDlgPresenter}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 24, 2012 mpduff Initial creation
|
||||
* Oct 17, 2012 0726 djohnson Remove unused registry code.
|
||||
* Nov 09, 2012 1286 djohnson Add test for storing subscription.
|
||||
* Nov 20, 2012 1286 djohnson {@link ISubscriptionService} now takes the view.
|
||||
* Jan 02, 2012 1345 djohnson Remove obsolete test.
|
||||
* Jan 04, 2013 1453 djohnson Add tests for setting the active period.
|
||||
* Jan 11, 2013 1453 djohnson Add test from failed test scenario.
|
||||
* Mar 28, 2013 1841 djohnson Subscription is now UserSubscription.
|
||||
* Apr 08, 2013 1826 djohnson Remove delivery options.
|
||||
* May 15, 2013 1040 mpduff Remove method.
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class CreateSubscriptionPresenterTest {
|
||||
|
||||
private final ICreateSubscriptionDlgView view = mock(ICreateSubscriptionDlgView.class);
|
||||
|
||||
private final GriddedDataSet dataSet = new OpenDapGriddedDataSet();
|
||||
{
|
||||
dataSet.setDataSetName("name");
|
||||
dataSet.setProviderName("provider");
|
||||
dataSet.setForecastHours(Sets.newHashSet(0, 3, 6));
|
||||
dataSet.setDataSetType(DataType.GRID);
|
||||
dataSet.setCycles(Sets.newHashSet(0, 6, 12));
|
||||
}
|
||||
|
||||
private final CreateSubscriptionDlgPresenter presenter = new CreateSubscriptionDlgPresenter(
|
||||
view, dataSet, true, new SameThreadGuiTaskExecutor());
|
||||
|
||||
private final ISubscriptionService service = mock(ISubscriptionService.class);
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
CreateSubscriptionDlgPresenter.subscriptionService = service;
|
||||
presenter.init();
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
TimeUtilTest.resumeTime();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpenCallsViewOpen() throws Exception {
|
||||
presenter.open();
|
||||
verify(view).openDlg();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInitOkBtnIsSet() {
|
||||
verify(view).setOkConf(presenter.OK_CONF);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyOkButtonConfiguration() {
|
||||
verify(view).setOkConf(presenter.OK_CONF);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyDurationValidationNoExpriationCheck() {
|
||||
when(view.isNoExpirationDate()).thenReturn(true);
|
||||
assertTrue(presenter.durationValidChk());
|
||||
verify(view).isNoExpirationDate();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyDurationValidationDates() {
|
||||
when(view.getStartText()).thenReturn("12/01/1999 01");
|
||||
when(view.getExpirationText()).thenReturn("12/31/1999 01");
|
||||
assertTrue(presenter.durationValidChk());
|
||||
verify(view).isNoExpirationDate();
|
||||
verify(view, times(2)).getStartText();
|
||||
verify(view, times(2)).getExpirationText();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyActivePeriodValidationAlwaysActive() {
|
||||
when(view.isAlwaysActive()).thenReturn(true);
|
||||
assertTrue(presenter.activePeriodValidChk());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyActivePeriodValidationDates() {
|
||||
when(view.isAlwaysActive()).thenReturn(false);
|
||||
when(view.getActiveStartText()).thenReturn("12/01");
|
||||
when(view.getActiveEndText()).thenReturn("12/31");
|
||||
assertTrue(presenter.activePeriodValidChk());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifySubscriptionIsSubmittedToSubscriptionService()
|
||||
throws RegistryHandlerException {
|
||||
Subscription subscription = SiteSubscriptionFixture.INSTANCE.get();
|
||||
|
||||
final ISubscriptionServiceResult result = mock(ISubscriptionServiceResult.class);
|
||||
when(
|
||||
service.store(same(subscription),
|
||||
any(IForceApplyPromptDisplayText.class))).thenReturn(
|
||||
result);
|
||||
|
||||
presenter.storeSubscription(subscription, "username");
|
||||
verify(service).store(same(subscription),
|
||||
any(IForceApplyPromptDisplayText.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyIfMessageIsNotReturnedFromSubscriptionServiceThenItIsNotDisplayed()
|
||||
throws RegistryHandlerException {
|
||||
Subscription subscription = SiteSubscriptionFixture.INSTANCE.get();
|
||||
|
||||
final ISubscriptionServiceResult result = mock(ISubscriptionServiceResult.class);
|
||||
when(result.hasMessageToDisplay()).thenReturn(false);
|
||||
|
||||
when(
|
||||
service.store(same(subscription),
|
||||
any(IForceApplyPromptDisplayText.class))).thenReturn(
|
||||
result);
|
||||
presenter.storeSubscription(subscription, "username");
|
||||
verify(view, never()).displayPopup(anyString(), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActivePeriodAssumesTheCurrentYearWhenDateIsToday()
|
||||
throws ParseException {
|
||||
TimeUtilTest.freezeTime();
|
||||
|
||||
Calendar cal = TimeUtil.newGmtCalendar();
|
||||
cal.add(Calendar.YEAR, -1);
|
||||
Date oneYearAgo = cal.getTime();
|
||||
|
||||
SiteSubscription subscription = new SubscriptionBuilder()
|
||||
.withActivePeriodStart(oneYearAgo)
|
||||
.withActivePeriodEnd(oneYearAgo).build();
|
||||
|
||||
CreateSubscriptionDlgPresenter presenter = new CreateSubscriptionDlgPresenter(
|
||||
view, dataSet, true, new SameThreadGuiTaskExecutor());
|
||||
presenter.setSubscriptionData(subscription);
|
||||
presenter.init();
|
||||
|
||||
verify(view).setActiveStartDate(
|
||||
argThat(yyyyMmDdMatches(TimeUtil.newDate())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActivePeriodStartAssumesTheNextYearWhenStartAndEndDateIsBeforeToday()
|
||||
throws ParseException {
|
||||
Calendar cal = TimeUtil.newGmtCalendar();
|
||||
cal.set(Calendar.MONTH, Calendar.JANUARY);
|
||||
cal.set(Calendar.DAY_OF_MONTH, 4);
|
||||
final Date yesterday = cal.getTime();
|
||||
|
||||
// Freeze time at Jan. 5
|
||||
TimeUtilTest.freezeTime(yesterday.getTime() + TimeUtil.MILLIS_PER_DAY);
|
||||
|
||||
SiteSubscription subscription = new SubscriptionBuilder()
|
||||
.withActivePeriodStart(yesterday)
|
||||
.withActivePeriodEnd(yesterday).build();
|
||||
|
||||
CreateSubscriptionDlgPresenter presenter = new CreateSubscriptionDlgPresenter(
|
||||
view, dataSet, true, new SameThreadGuiTaskExecutor());
|
||||
presenter.setSubscriptionData(subscription);
|
||||
presenter.init();
|
||||
|
||||
Calendar januaryFourthAYearLater = TimeUtil.newGmtCalendar();
|
||||
januaryFourthAYearLater.setTime(yesterday);
|
||||
januaryFourthAYearLater.add(Calendar.YEAR, 1);
|
||||
|
||||
verify(view).setActiveStartDate(
|
||||
argThat(yyyyMmDdMatches(januaryFourthAYearLater.getTime())));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActivePeriodStartAssumesTheCurrentYearWhenInActiveWindow()
|
||||
throws ParseException {
|
||||
Calendar cal = TimeUtil.newGmtCalendar();
|
||||
cal.set(Calendar.MONTH, Calendar.JANUARY);
|
||||
cal.set(Calendar.DAY_OF_MONTH, 4);
|
||||
final Date yesterday = cal.getTime();
|
||||
|
||||
// Freeze time at Jan. 5
|
||||
cal.add(Calendar.DAY_OF_MONTH, 1);
|
||||
TimeUtilTest.freezeTime(cal.getTimeInMillis());
|
||||
|
||||
cal.add(Calendar.DAY_OF_MONTH, 3);
|
||||
Date threeDaysFromNow = cal.getTime();
|
||||
|
||||
SiteSubscription subscription = new SubscriptionBuilder()
|
||||
.withActivePeriodStart(yesterday)
|
||||
.withActivePeriodEnd(threeDaysFromNow).build();
|
||||
|
||||
CreateSubscriptionDlgPresenter presenter = new CreateSubscriptionDlgPresenter(
|
||||
view, dataSet, true, new SameThreadGuiTaskExecutor());
|
||||
presenter.setSubscriptionData(subscription);
|
||||
presenter.init();
|
||||
|
||||
verify(view).setActiveStartDate(argThat(yyyyMmDdMatches(yesterday)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActivePeriodEndAssumesStartYearWhenDateIsToday()
|
||||
throws ParseException {
|
||||
|
||||
TimeUtilTest.freezeTime();
|
||||
|
||||
Calendar cal = TimeUtil.newGmtCalendar();
|
||||
cal.add(Calendar.YEAR, -1);
|
||||
Date oneYearAgo = cal.getTime();
|
||||
|
||||
Calendar cal2 = TimeUtil.newGmtCalendar();
|
||||
cal2.setTime(oneYearAgo);
|
||||
cal2.add(Calendar.DAY_OF_YEAR, 3);
|
||||
Date oneYearAgoPlusThreeDays = cal2.getTime();
|
||||
|
||||
SiteSubscription subscription = new SubscriptionBuilder()
|
||||
.withActivePeriodStart(oneYearAgo)
|
||||
.withActivePeriodEnd(oneYearAgoPlusThreeDays).build();
|
||||
|
||||
CreateSubscriptionDlgPresenter presenter = new CreateSubscriptionDlgPresenter(
|
||||
view, dataSet, true, new SameThreadGuiTaskExecutor());
|
||||
presenter.setSubscriptionData(subscription);
|
||||
presenter.init();
|
||||
|
||||
Calendar expectedCalendar = TimeUtil.newGmtCalendar();
|
||||
expectedCalendar.setTime(oneYearAgoPlusThreeDays);
|
||||
expectedCalendar.add(Calendar.YEAR, 1);
|
||||
|
||||
verify(view).setActiveEndDate(
|
||||
argThat(yyyyMmDdMatches(expectedCalendar.getTime())));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testActivePeriodEndCrossingYearBoundary() throws ParseException {
|
||||
Calendar cal = TimeUtil.newGmtCalendar();
|
||||
cal.set(Calendar.MONTH, Calendar.DECEMBER);
|
||||
cal.set(Calendar.DAY_OF_MONTH, 30);
|
||||
cal.set(Calendar.YEAR, 1970);
|
||||
final Date decemberThirtieth = cal.getTime();
|
||||
|
||||
Calendar cal2 = TimeUtil.newGmtCalendar();
|
||||
cal2.setTime(decemberThirtieth);
|
||||
cal2.set(Calendar.MONTH, Calendar.JANUARY);
|
||||
cal2.set(Calendar.DAY_OF_MONTH, 4);
|
||||
cal2.set(Calendar.YEAR, 1970);
|
||||
Date januaryFourth = cal2.getTime();
|
||||
|
||||
SiteSubscription subscription = new SubscriptionBuilder()
|
||||
.withActivePeriodStart(decemberThirtieth)
|
||||
.withActivePeriodEnd(januaryFourth).build();
|
||||
|
||||
// freeze time at december thirtieth of the current year
|
||||
Calendar decemberTenth = TimeUtil.newGmtCalendar();
|
||||
decemberTenth.set(Calendar.MONTH, Calendar.DECEMBER);
|
||||
decemberTenth.set(Calendar.DAY_OF_MONTH, 10);
|
||||
decemberTenth.set(Calendar.YEAR, 2000);
|
||||
TimeUtilTest.freezeTime(decemberTenth.getTimeInMillis());
|
||||
|
||||
CreateSubscriptionDlgPresenter presenter = new CreateSubscriptionDlgPresenter(
|
||||
view, dataSet, true, new SameThreadGuiTaskExecutor());
|
||||
presenter.setSubscriptionData(subscription);
|
||||
presenter.init();
|
||||
|
||||
Calendar expectedStartCalendar = TimeUtil.newGmtCalendar();
|
||||
expectedStartCalendar.setTime(decemberTenth.getTime());
|
||||
expectedStartCalendar.set(Calendar.DAY_OF_MONTH, 30);
|
||||
|
||||
Calendar expectedEndCalendar = TimeUtil.newGmtCalendar();
|
||||
expectedEndCalendar.setTime(decemberTenth.getTime());
|
||||
expectedEndCalendar.add(Calendar.YEAR, 1);
|
||||
expectedEndCalendar.set(Calendar.MONTH, Calendar.JANUARY);
|
||||
expectedEndCalendar.set(Calendar.DAY_OF_MONTH, 4);
|
||||
|
||||
verify(view).setActiveEndDate(
|
||||
argThat(yyyyMmDdMatches(expectedEndCalendar.getTime())));
|
||||
}
|
||||
|
||||
/**
|
||||
* Taken from the following tester comments:<br>
|
||||
* When creating a subscription, if the Active Period End date is set to a
|
||||
* month/day that is earlier than the month/day of the Active Period Start
|
||||
* date (e.g., Active Period Start date = 01/10/2013 and Active Period End
|
||||
* date = 01/01/2014), the subscription will go through successfully. Then,
|
||||
* when editing the subscription and clicking on the Select Date for both
|
||||
* the Active Period Start and End dates, the Active Period Start date
|
||||
* (01/10/2014) is after the Active Period End date (01/01/2014). A check
|
||||
* needs to be added such that if the Start date is after the End date, the
|
||||
* year for the End date needs to increase by 1 (year + 1). While the year
|
||||
* has no affect on the Active Period Start and End dates (and associated
|
||||
* functionality), there may be confusion with the end user.
|
||||
*
|
||||
* @throws ParseException
|
||||
*/
|
||||
@Test
|
||||
public void testActivePeriodWhereStartIsDayOfYearAfterEnd()
|
||||
throws ParseException {
|
||||
Calendar cal = new CalendarBuilder().withMonth(Calendar.JANUARY)
|
||||
.withDayOfMonth(10).withYear(2013).build();
|
||||
|
||||
final Date januaryTenth = cal.getTime();
|
||||
|
||||
cal.set(Calendar.YEAR, 1970);
|
||||
final Date startDate = cal.getTime();
|
||||
|
||||
Calendar cal2 = new CalendarBuilder().withMonth(Calendar.JANUARY)
|
||||
.withDayOfMonth(1).withYear(2014).build();
|
||||
final Date januaryFirstYearLater = cal2.getTime();
|
||||
|
||||
cal2.set(Calendar.YEAR, 1970);
|
||||
final Date endDate = cal2.getTime();
|
||||
|
||||
SiteSubscription subscription = new SubscriptionBuilder()
|
||||
.withActivePeriodStart(startDate).withActivePeriodEnd(endDate)
|
||||
.build();
|
||||
|
||||
// freeze time at start date plus a minute
|
||||
TimeUtilTest.freezeTime(januaryTenth.getTime()
|
||||
+ TimeUtil.MILLIS_PER_MINUTE);
|
||||
|
||||
CreateSubscriptionDlgPresenter presenter = new CreateSubscriptionDlgPresenter(
|
||||
view, dataSet, true, new SameThreadGuiTaskExecutor());
|
||||
presenter.setSubscriptionData(subscription);
|
||||
presenter.init();
|
||||
|
||||
verify(view).setActiveStartDate(argThat(yyyyMmDdMatches(januaryTenth)));
|
||||
verify(view).setActiveEndDate(
|
||||
argThat(yyyyMmDdMatches(januaryFirstYearLater)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void verifyCycleTimesSetToView() {
|
||||
presenter.open();
|
||||
verify(view).setCycleTimes(dataSet.getCycles());
|
||||
}
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
/**
|
||||
* 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.datadelivery.subscription.subset.presenter;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
|
||||
|
||||
/**
|
||||
* Test {@link GriddedTimingSelectionPresenter}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Sep 12, 2012 mpduff Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author mpduff
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
public class GriddedTimingSelectionPresenterTest {
|
||||
private final IGriddedTimingSelectionDlgView view = mock(IGriddedTimingSelectionDlgView.class);
|
||||
private GriddedTimingSelectionPresenter presenter;
|
||||
|
||||
private final GriddedDataSet dataSet = new OpenDapGriddedDataSet();
|
||||
{
|
||||
dataSet.setDataSetName("name");
|
||||
dataSet.setProviderName("provider");
|
||||
dataSet.setForecastHours(Sets.newHashSet(0, 3, 6));
|
||||
dataSet.setCycles(Sets.newHashSet(0, 6, 12));
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
List<String> cycles = new ArrayList<String>();
|
||||
cycles.add("20120501 - 00Z");
|
||||
presenter = new GriddedTimingSelectionPresenter(view, dataSet, cycles);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void initSetsLatestDataCheckBox() {
|
||||
presenter.init();
|
||||
verify(view).setLatestDataCheckBox(presenter.latestDataChkConf);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void initSetsDateCycleList() {
|
||||
presenter.init();
|
||||
verify(view).setDateCycleList(presenter.dateCycleListConf);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void initSetsOkButton() {
|
||||
presenter.init();
|
||||
verify(view).setOkButton(presenter.okBtnConf);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOpenCallsViewOpen() {
|
||||
presenter.open();
|
||||
verify(view).openDlg();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void uncheckLatestDateEnablesSpecificDateList() {
|
||||
when(view.isLatestDataEnabled()).thenReturn(false);
|
||||
|
||||
presenter.latestDataChkConf.getOnCheckedChangeAction().run();
|
||||
|
||||
verify(view).setDateCycleListEnabled();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkLatestDateEnablesSpecificDateList() {
|
||||
when(view.isLatestDataEnabled()).thenReturn(true);
|
||||
|
||||
presenter.latestDataChkConf.getOnCheckedChangeAction().run();
|
||||
|
||||
verify(view).setDateCycleListEnabled();
|
||||
}
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
/**
|
||||
* 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.datadelivery.subscription.subset.presenter;
|
||||
|
||||
import static org.mockito.Matchers.anyListOf;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||
import com.raytheon.uf.common.datadelivery.registry.OpenDapGriddedDataSet;
|
||||
|
||||
/**
|
||||
* Test {@link GriddedTimingSubsetPresenter}.
|
||||
*
|
||||
* <pre>
|
||||
*
|
||||
* SOFTWARE HISTORY
|
||||
*
|
||||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Aug 15, 2012 0743 djohnson Initial creation
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author djohnson
|
||||
* @version 1.0
|
||||
*/
|
||||
public class GriddedTimingSubsetPresenterTest {
|
||||
private final IGriddedDataTimingSubsetView view = mock(IGriddedDataTimingSubsetView.class);
|
||||
|
||||
private final GriddedDataSet dataSet = new OpenDapGriddedDataSet();
|
||||
{
|
||||
dataSet.setDataSetName("name");
|
||||
dataSet.setProviderName("provider");
|
||||
dataSet.setForecastHours(Sets.newHashSet(0, 3, 6));
|
||||
dataSet.setCycles(Sets.newHashSet(0, 6, 12));
|
||||
}
|
||||
|
||||
private final GriddedTimingSubsetPresenter presenter = new GriddedTimingSubsetPresenter(
|
||||
dataSet, view);
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
presenter.init();
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void initSetsForecastHours() {
|
||||
verify(view).setAvailableForecastHours(anyListOf(String.class));
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue