Merge "ASM #17002 added a drop down button for PC and PP data in time step mode" into asm_16.1.1

Former-commit-id: e872d001f304e1fc168947b4dff85c0b8a90e665
This commit is contained in:
Juliya Dynina 2015-07-02 11:02:06 -05:00 committed by Gerrit Code Review
commit 59193b2fa6

View file

@ -73,6 +73,7 @@ import com.raytheon.viz.hydro.pointdatacontrol.db.PDCDataManager;
import com.raytheon.viz.hydro.pointdatacontrol.util.PDCUtils;
import com.raytheon.viz.hydro.resource.MultiPointResource;
import com.raytheon.viz.hydrocommon.HydroConstants;
import com.raytheon.viz.hydrocommon.HydroConstants.TimeStepDataElementType;
import com.raytheon.viz.hydrocommon.HydroDisplayManager;
import com.raytheon.viz.hydrocommon.colorscalemgr.HydroColorManager;
import com.raytheon.viz.hydrocommon.colorscalemgr.NamedColorSetGroup;
@ -112,12 +113,15 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Bug fix for non-blocking dialogs.
* 09 Mar 2015 13998 lbousaidi Changes to fix the precipitation data display.
* 22 Jun 2015 13892 lbousaidi Fixed the saved the preset String selection.
* 01 July 2015 17002 xwei Added drop down button for PC and PP
*
* </pre>
*
* @author lvenable
* @version 1.0
*
*/
public class PointDataControlDlg extends CaveSWTDialog {
/** Singleton instance. */
private static PointDataControlDlg instance = null;
@ -364,12 +368,12 @@ public class PointDataControlDlg extends CaveSWTDialog {
/**
* Stations label.
*/
private Label stationsLbl;
private Label stationsOrPELbl;
/**
* Stations label.
*/
private Combo stationsCbo;
private Combo stationsOrPECbo;
/**
* Service area check box.
@ -845,6 +849,9 @@ public class PointDataControlDlg extends CaveSWTDialog {
handleTimeStepElementComboSelection();
handleTsPhysicalElementSelection(physicalElementCbo
.getItem(physicalElementCbo.getSelectionIndex()));
handleStationsOrPE();
if ((physicalElementCbo.getSelectionIndex() == 0)
&& (elementTypeCbo.getSelectionIndex() == 1)) {
stackLayout.topControl = precipGroup;
@ -884,6 +891,9 @@ public class PointDataControlDlg extends CaveSWTDialog {
}
handleTsPhysicalElementSelection(physicalElementCbo
.getItem(physicalElementCbo.getSelectionIndex()));
handleStationsOrPE();
loadTimeInfo();
}
HydroDisplayManager.getInstance().setDataChanged(true);
@ -1214,23 +1224,28 @@ public class PointDataControlDlg extends CaveSWTDialog {
stationsComp.setLayoutData(gd);
gd = new GridData(70, SWT.DEFAULT);
stationsLbl = new Label(stationsComp, SWT.NONE | SWT.RIGHT);
stationsLbl.setText("Stations: ");
stationsLbl.setLayoutData(gd);
stationsOrPELbl = new Label(stationsComp, SWT.NONE | SWT.RIGHT);
stationsOrPELbl.setText("Stations: ");
stationsOrPELbl.setLayoutData(gd);
gd = new GridData(110, SWT.DEFAULT);
stationsCbo = new Combo(stationsComp, SWT.DROP_DOWN | SWT.READ_ONLY);
stationsCbo.add("All");
stationsCbo.add("Stream");
stationsCbo.add("Reservoir");
stationsCbo.select(0);
stationsCbo.setLayoutData(gd);
stationsCbo.addSelectionListener(new SelectionAdapter() {
stationsOrPECbo = new Combo(stationsComp, SWT.DROP_DOWN | SWT.READ_ONLY);
stationsOrPECbo.add("All");
stationsOrPECbo.add("Stream");
stationsOrPECbo.add("Reservoir");
stationsOrPECbo.select(0);
stationsOrPECbo.setLayoutData(gd);
stationsOrPECbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
PDCOptionData pcOptions = PDCOptionData.getInstance();
pcOptions.setRiverStationFilter(stationsCbo.getSelectionIndex());
setStationsOrPE( pcOptions );
shell.setCursor(waitCursor);
updateData = true;
drawMap();
shell.setCursor(null);
}
@ -1923,7 +1938,79 @@ public class PointDataControlDlg extends CaveSWTDialog {
// physicalElementCbo.select(pcOptions.getPeSelection());
physicalElementCbo.select(0);
}
private void handleStationsOrPE() {
if ( elementTypeCbo.getSelectionIndex() != TimeStepDataElementType.RAIN_TIME_STEP_TYPE.ordinal() ) {
stationsOrPELbl.setVisible(true);
stationsOrPECbo.setVisible(true);
stationsOrPELbl.setText("Stations: ");
stationsOrPECbo.removeAll();
stationsOrPECbo.add("All");
stationsOrPECbo.add("Stream");
stationsOrPECbo.add("Reservoir");
stationsOrPECbo.select(0);
}else{
if ( physicalElementCbo.getSelectionIndex() == 0 ) { // See TIMESTEP_DATA_ELEMENT_STRING_ARRAY for position
stationsOrPELbl.setVisible(false);
stationsOrPECbo.setVisible(false);
}else{
stationsOrPELbl.setVisible(true);
stationsOrPECbo.setVisible(true);
stationsOrPELbl.setText("Use PE: ");
stationsOrPECbo.removeAll();
stationsOrPECbo.add("PC and PP");
stationsOrPECbo.add("PC Only");
stationsOrPECbo.add("PP Only");
stationsOrPECbo.select(0);
}
}
}
private void setStationsOrPE( PDCOptionData pcOptions ) {
if ( elementTypeCbo.getSelectionIndex() != TimeStepDataElementType.RAIN_TIME_STEP_TYPE.ordinal() ) {
pcOptions.setRiverStationFilter( stationsOrPECbo.getSelectionIndex() );
}else{
if ( physicalElementCbo.getSelectionIndex() != 0 ) { // See TIMESTEP_DATA_ELEMENT_STRING_ARRAY for position
pcOptions.setPrecipPeFilter( stationsOrPECbo.getSelectionIndex() );
}
}
}
private void selectStationsOrPE( PDCOptionData pcOptions ) {
if ( elementTypeCbo.getSelectionIndex() != TimeStepDataElementType.RAIN_TIME_STEP_TYPE.ordinal() ) {
stationsOrPECbo.select(pcOptions.getRiverStationFilter());
}else{
if ( physicalElementCbo.getSelectionIndex() != 0 ) { // See TIMESTEP_DATA_ELEMENT_STRING_ARRAY for position
stationsOrPECbo.select(pcOptions.getPrecipPeFilter());
}
}
}
/**
* Perform updates for currently selected element type.
*/
@ -1998,8 +2085,8 @@ public class PointDataControlDlg extends CaveSWTDialog {
*/
private void showAdHocControls(boolean flag) {
// Time Step control
stationsLbl.setVisible(!flag);
stationsCbo.setVisible(!flag);
stationsOrPELbl.setVisible(!flag);
stationsOrPECbo.setVisible(!flag);
// Ad Hoc control
dataSourceChk.setVisible(flag);
@ -2305,6 +2392,9 @@ public class PointDataControlDlg extends CaveSWTDialog {
handleTimeStepElementComboSelection();
handleTsPhysicalElementSelection(physicalElementCbo
.getItem(physicalElementCbo.getSelectionIndex()));
handleStationsOrPE();
if ((physicalElementCbo.getSelectionIndex() == 0)
&& (elementTypeCbo.getSelectionIndex() == 1)) {
stackLayout.topControl = precipGroup;
@ -2895,8 +2985,8 @@ public class PointDataControlDlg extends CaveSWTDialog {
}
/* set the pc_pc_riverStationFilterOM based on river_station_filter */
stationsCbo.select(pcOptions.getRiverStationFilter());
selectStationsOrPE( pcOptions );
/* set the pc_precipPeOM based on precip_pe_filter */
pcOptions.getPrecipPeFilter();
// TODO - This is invisible if not a rain PE Verify with the vpn