Issue #1586 add color to area validation.
Former-commit-id:d260e22e12
[formerly80f8dc50f9
] [formerlyf073984ce6
] [formerly8a233105bc
[formerlyf073984ce6
[formerly 452ba74bb84a2531b617675c4ee80ef4b008cd34]]] Former-commit-id:8a233105bc
Former-commit-id: 8617b0020084a72df53b21c781d2f609f4483a61 [formerly6a8bd463a6
] Former-commit-id:45b75823ac
This commit is contained in:
parent
3ee627253f
commit
cf95a2159d
2 changed files with 27 additions and 5 deletions
|
@ -139,6 +139,9 @@ public class ArealSelectionDlg extends CaveSWTDialog implements IDataSize {
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if (!areaComp.isEnvelopeValid()) {
|
||||
DataDeliveryUtils.showMessage(getShell(), SWT.OK,
|
||||
"Validation Error",
|
||||
"The defined area area is invalid\nAdjust the selected area and try again.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -805,29 +805,48 @@ public class AreaComp extends Composite implements ISubset {
|
|||
lr, 0.05);
|
||||
|
||||
envelopeValid = ulValid && lrValid;
|
||||
|
||||
int lrColor = SWT.COLOR_WHITE;
|
||||
int ulColor = SWT.COLOR_WHITE;
|
||||
StringBuilder errorText = null;
|
||||
|
||||
if (envelopeValid) {
|
||||
subEnvelope = EnvelopeUtils.createSubenvelopeFromLatLon(
|
||||
fullEnvelope, ul, lr);
|
||||
updateDataSize();
|
||||
} else {
|
||||
StringBuilder errorText = new StringBuilder();
|
||||
errorText = new StringBuilder();
|
||||
errorText.append("The ");
|
||||
if (ulValid) {
|
||||
errorText.append("Lower Right Coordinate is");
|
||||
lrColor = SWT.COLOR_RED;
|
||||
} else if (lrValid) {
|
||||
errorText.append("Upper Left Coordinate is");
|
||||
ulColor = SWT.COLOR_RED;
|
||||
} else {
|
||||
lrColor = SWT.COLOR_RED;
|
||||
ulColor = SWT.COLOR_RED;
|
||||
errorText.append("Lower Right and Upper Left Coordinates are");
|
||||
}
|
||||
errorText.append(" not within the dataset area.");
|
||||
}
|
||||
|
||||
// Set the background color before displaying an error message.
|
||||
Color color = getDisplay().getSystemColor(lrColor);
|
||||
lowerRightLatTxt.setBackground(color);
|
||||
lowerRightLonTxt.setBackground(color);
|
||||
if (lrColor != ulColor) {
|
||||
color = getDisplay().getSystemColor(ulColor);
|
||||
}
|
||||
upperLeftLatTxt.setBackground(color);
|
||||
upperLeftLonTxt.setBackground(color);
|
||||
|
||||
if (errorText != null) {
|
||||
DataDeliveryUtils.showMessage(getShell(), SWT.OK,
|
||||
"Validation Error", errorText.toString());
|
||||
}
|
||||
|
||||
// Entries are valid so save them off.
|
||||
this.envelopeValid = true;
|
||||
|
||||
return true;
|
||||
return envelopeValid;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue