Issue #2141 - Fix envelope validation for DD areal filter and selection dialogs

Change-Id: I401f44d9a8392f97e1b6ab7c769e3fbfb23a36d6

Former-commit-id: 4ed69f8195 [formerly cd9f3dc0e1] [formerly 9454dd76a7] [formerly acf1f266e3 [formerly 9454dd76a7 [formerly b1ca1bb2ceb576e8e8664289e83e06708532bc97]]]
Former-commit-id: acf1f266e3
Former-commit-id: 6a696cad457c573ed9799e8791c695202eed53e7 [formerly bad75bd14c]
Former-commit-id: f2c5343ee2
This commit is contained in:
Mike Duff 2013-07-12 16:12:41 -05:00
parent d201642eca
commit d8fed3e4aa
2 changed files with 16 additions and 11 deletions

View file

@ -50,6 +50,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Oct 31, 2012 1278 mpduff Change validation method call. * Oct 31, 2012 1278 mpduff Change validation method call.
* Dec 07, 2012 1278 bgonzale Coordinate Array initialization in ctor. * Dec 07, 2012 1278 bgonzale Coordinate Array initialization in ctor.
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes. * Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
* Jul 12, 2013 2141 mpduff Fix typo.
* *
* </pre> * </pre>
* *
@ -131,7 +132,7 @@ public class ArealSelectionDlg extends CaveSWTDialog implements IDataSize {
btnComp.setLayout(gl); btnComp.setLayout(gl);
btnComp.setLayoutData(gd); btnComp.setLayoutData(gd);
//OK button // OK button
Button okBtn = new Button(btnComp, SWT.PUSH); Button okBtn = new Button(btnComp, SWT.PUSH);
okBtn.setText("OK"); okBtn.setText("OK");
okBtn.setLayoutData(new GridData(70, SWT.DEFAULT)); okBtn.setLayoutData(new GridData(70, SWT.DEFAULT));
@ -139,9 +140,10 @@ public class ArealSelectionDlg extends CaveSWTDialog implements IDataSize {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
if (!areaComp.isEnvelopeValid()) { if (!areaComp.isEnvelopeValid()) {
DataDeliveryUtils.showMessage(getShell(), SWT.OK, DataDeliveryUtils
.showMessage(getShell(), SWT.OK,
"Validation Error", "Validation Error",
"The defined area area is invalid\nAdjust the selected area and try again."); "The defined area is invalid\nAdjust the selected area and try again.");
return; return;
} }
@ -154,14 +156,16 @@ public class ArealSelectionDlg extends CaveSWTDialog implements IDataSize {
} }
}); });
//Cancel button // Cancel button
Button cancelBtn = new Button(btnComp, SWT.PUSH); Button cancelBtn = new Button(btnComp, SWT.PUSH);
cancelBtn.setText("Cancel"); cancelBtn.setText("Cancel");
cancelBtn.setLayoutData(new GridData(70, SWT.DEFAULT)); cancelBtn.setLayoutData(new GridData(70, SWT.DEFAULT));
cancelBtn.addSelectionListener(new SelectionAdapter() { cancelBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
int answer = DataDeliveryUtils.showMessage(getShell(), SWT.YES | SWT.NO, "Cancel Changes?", int answer = DataDeliveryUtils
.showMessage(getShell(), SWT.YES | SWT.NO,
"Cancel Changes?",
"Are you sure you wish to close without selecting an area?"); "Are you sure you wish to close without selecting an area?");
if (answer == SWT.YES) { if (answer == SWT.YES) {
setReturnValue(false); setReturnValue(false);

View file

@ -92,6 +92,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Mar 21, 2013 1638 mschenke Changed map scales not tied to d2d * Mar 21, 2013 1638 mschenke Changed map scales not tied to d2d
* Jun 14, 2013 2064 mpduff Reset controls on load. * Jun 14, 2013 2064 mpduff Reset controls on load.
* Jun 21, 2013 2132 mpduff Swap target and source envelopes. * 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.
* *
* </pre> * </pre>
* *
@ -1016,7 +1017,7 @@ public class AreaComp extends Composite implements ISubset {
* @return the envelopeValid * @return the envelopeValid
*/ */
public boolean isEnvelopeValid() { public boolean isEnvelopeValid() {
return envelopeValid; return validateBoundsText();
} }
private class ValidatingFocusListener implements FocusListener { private class ValidatingFocusListener implements FocusListener {