Merge "Issue #1586 add color to area validation." into development
Former-commit-id:27ce3e37f2
[formerly f8a90106eef02f27f65a6a0eda5e92a5720adf90] Former-commit-id:761b02e93e
This commit is contained in:
commit
d26d8bbe31
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