Issue #1196 Changes for NewAlarmDlg.

Change-Id: I6dd6b3a2984bc0e1590ca199d16adc574c2fbae4

Former-commit-id: 6f2804a40a [formerly d21f3fff14] [formerly 6f2804a40a [formerly d21f3fff14] [formerly 7efd9fa9fe [formerly 3bb158124bceac8cb10b96bb09423ffee0674ba3]]]
Former-commit-id: 7efd9fa9fe
Former-commit-id: 74400d5347 [formerly 98d685f675]
Former-commit-id: 2be355e672
This commit is contained in:
Roger Ferrel 2012-09-24 08:44:01 -05:00
parent 5a3f210a14
commit fc2f106f29
2 changed files with 100 additions and 70 deletions

View file

@ -373,21 +373,27 @@ public class AlarmAlertDlg extends CaveSWTDialog {
} }
proximityAlarmDlg = new NewAlarmDlg(shell, "ALARM", proximityAlarmDlg = new NewAlarmDlg(shell, "ALARM",
new AlarmAlertProduct(isOperationalMode())); new AlarmAlertProduct(isOperationalMode()));
AlarmAlertProduct prod = (AlarmAlertProduct) proximityAlarmDlg proximityAlarmDlg.setCloseCallback(new ICloseCallback() {
.open();
if (proximityAlarmDlg.haveOkEvent()) { @Override
aapList.add(prod); public void dialogClosed(Object returnValue) {
String string = ""; AlarmAlertProduct prod = (AlarmAlertProduct) returnValue;
if (prod.isAlarm()) { if (proximityAlarmDlg.haveOkEvent()) {
string += " (Alarm)"; aapList.add(prod);
String string = "";
if (prod.isAlarm()) {
string += " (Alarm)";
}
if (!"".equals(prod.getSearchString())) {
string += " containing \""
+ prod.getSearchString() + "\"";
}
aaList.add(prod.getProductId() + string);
changeSaveState(true);
}
} }
if (!"".equals(prod.getSearchString())) { });
string += " containing \"" + prod.getSearchString() proximityAlarmDlg.open();
+ "\"";
}
aaList.add(prod.getProductId() + string);
changeSaveState(true);
}
} }
}); });
@ -403,16 +409,24 @@ public class AlarmAlertDlg extends CaveSWTDialog {
proximityAlarmDlg = new NewAlarmDlg(shell, "PROXIMITY", proximityAlarmDlg = new NewAlarmDlg(shell, "PROXIMITY",
new AlarmAlertProduct(isOperationalMode())); new AlarmAlertProduct(isOperationalMode()));
AlarmAlertProduct prod = (AlarmAlertProduct) proximityAlarmDlg proximityAlarmDlg.setCloseCallback(new ICloseCallback() {
.open();
if (proximityAlarmDlg.haveOkEvent()) { @Override
prod.setOperationalMode(isOperationalMode()); public void dialogClosed(Object returnValue) {
papList.add(prod); AlarmAlertProduct prod = (AlarmAlertProduct) returnValue;
paList.add(prod.getProductId() + " " + prod.getAlarmType() if (proximityAlarmDlg.haveOkEvent()) {
+ " " + prod.getActionCmd() + " " prod.setOperationalMode(isOperationalMode());
+ AlarmAlertFunctions.buildDistance(prod)); papList.add(prod);
changeSaveState(true); paList.add(prod.getProductId() + " "
} + prod.getAlarmType() + " "
+ prod.getActionCmd() + " "
+ AlarmAlertFunctions.buildDistance(prod));
changeSaveState(true);
}
}
});
proximityAlarmDlg.open();
} }
}); });
@ -429,48 +443,64 @@ public class AlarmAlertDlg extends CaveSWTDialog {
} }
if (aaList.getSelectionIndex() != -1) { if (aaList.getSelectionIndex() != -1) {
// User might change selection while dialog is displayed. // User might change selection while dialog is displayed.
int index = aaList.getSelectionIndex(); final int index = aaList.getSelectionIndex();
proximityAlarmDlg = new NewAlarmDlg(shell, "ALARM", aapList proximityAlarmDlg = new NewAlarmDlg(shell, "ALARM", aapList
.get(index - 1)); .get(index - 1));
AlarmAlertProduct prod = aapList.set(index - 1, proximityAlarmDlg.setCloseCallback(new ICloseCallback() {
(AlarmAlertProduct) proximityAlarmDlg.open());
if (proximityAlarmDlg.haveOkEvent()) { @Override
String string = ""; public void dialogClosed(Object returnValue) {
if (prod.isAlarm()) { AlarmAlertProduct prod = (AlarmAlertProduct) returnValue;
string += " (Alarm)"; prod = aapList.set(index - 1, prod);
if (proximityAlarmDlg.haveOkEvent()) {
String string = "";
if (prod.isAlarm()) {
string += " (Alarm)";
}
if (!"".equals(prod.getSearchString())) {
string += " \"" + prod.getSearchString()
+ "\"";
}
aaList.setItem(index, prod.getProductId()
+ string);
paList.deselectAll();
aaList.select(index);
aaList.showSelection();
changeSaveState(true);
}
} }
if (!"".equals(prod.getSearchString())) { });
string += " \"" + prod.getSearchString() + "\""; proximityAlarmDlg.open();
}
aaList.setItem(index, prod.getProductId() + string);
paList.deselectAll();
aaList.select(index);
aaList.showSelection();
changeSaveState(true);
}
} else if (paList.getSelectionIndex() != -1) { } else if (paList.getSelectionIndex() != -1) {
// User might change selection while dialog is displayed. // User might change selection while dialog is displayed.
int index = paList.getSelectionIndex(); final int index = paList.getSelectionIndex();
proximityAlarmDlg = new NewAlarmDlg(shell, "PROXIMITY", proximityAlarmDlg = new NewAlarmDlg(shell, "PROXIMITY",
papList.get(index - 1)); papList.get(index - 1));
AlarmAlertProduct prod = papList.set(index - 1, proximityAlarmDlg.setCloseCallback(new ICloseCallback() {
(AlarmAlertProduct) proximityAlarmDlg.open());
if (proximityAlarmDlg.haveOkEvent()) { @Override
paList.setItem( public void dialogClosed(Object returnValue) {
paList.getSelectionIndex(), AlarmAlertProduct prod = (AlarmAlertProduct) returnValue;
prod.getProductId() prod = papList.set(index - 1, prod);
+ " " if (proximityAlarmDlg.haveOkEvent()) {
+ prod.getAlarmType() paList.setItem(
+ " " paList.getSelectionIndex(),
+ prod.getActionCmd() prod.getProductId()
+ " " + " "
+ AlarmAlertFunctions + prod.getAlarmType()
.buildDistance(prod)); + " "
aaList.deselectAll(); + prod.getActionCmd()
paList.select(index); + " "
paList.showSelection(); + AlarmAlertFunctions
changeSaveState(true); .buildDistance(prod));
} aaList.deselectAll();
paList.select(index);
paList.showSelection();
changeSaveState(true);
}
}
});
proximityAlarmDlg.open();
} }
} }
}); });

View file

@ -55,6 +55,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Sep 10, 2009 mnash Initial creation * Sep 10, 2009 mnash Initial creation
* Jun 08, 2010 5851 cjeanbap Properly stop alarm/alert observer listener; shellComp is null. * Jun 08, 2010 5851 cjeanbap Properly stop alarm/alert observer listener; shellComp is null.
* Oct 31, 2011 8510 rferrel made PRIMARY_MODEL and add check for nonblank productID. * Oct 31, 2011 8510 rferrel made PRIMARY_MODEL and add check for nonblank productID.
* Sep 20, 2012 1196 rferrel No longer Blocks
* </pre> * </pre>
* *
* @author mnash * @author mnash
@ -71,8 +72,7 @@ public class NewAlarmDlg extends CaveSWTDialog {
e.text = e.text.toUpperCase(); e.text = e.text.toUpperCase();
} }
}; };
private Combo alarmAlert; private Combo alarmAlert;
private Combo actionCmd; private Combo actionCmd;
@ -108,8 +108,8 @@ public class NewAlarmDlg extends CaveSWTDialog {
*/ */
protected NewAlarmDlg(Shell parentShell, String alarm_or_alert, protected NewAlarmDlg(Shell parentShell, String alarm_or_alert,
AlarmAlertProduct product) { AlarmAlertProduct product) {
super(parentShell, CAVE.PERSPECTIVE_INDEPENDENT | SWT.PRIMARY_MODAL super(parentShell, SWT.PRIMARY_MODAL | SWT.RESIZE,
| SWT.RESIZE); CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK);
if ("PROXIMITY".equals(alarm_or_alert)) { if ("PROXIMITY".equals(alarm_or_alert)) {
productType = ProductType.Proximity_Alarm; productType = ProductType.Proximity_Alarm;
setText("New Proximity Alarm Product"); setText("New Proximity Alarm Product");
@ -187,13 +187,13 @@ public class NewAlarmDlg extends CaveSWTDialog {
*/ */
private Text createProductIdField(Composite prods, String initValue) { private Text createProductIdField(Composite prods, String initValue) {
Text prodIdField = new Text(prods, SWT.SINGLE | SWT.BORDER); Text prodIdField = new Text(prods, SWT.SINGLE | SWT.BORDER);
if(initValue != null) { if (initValue != null) {
prodIdField.setText(initValue); prodIdField.setText(initValue);
} }
prodIdField.addVerifyListener(productIdVerifier); prodIdField.addVerifyListener(productIdVerifier);
return prodIdField; return prodIdField;
} }
private void createAlarmDialog() { private void createAlarmDialog() {
Composite prods = new Composite(shellComp, SWT.NONE); Composite prods = new Composite(shellComp, SWT.NONE);
GridLayout prodLayout = new GridLayout(3, false); GridLayout prodLayout = new GridLayout(3, false);
@ -208,8 +208,8 @@ public class NewAlarmDlg extends CaveSWTDialog {
prodLabelData = new GridData(SWT.FILL, SWT.DEFAULT, true, false); prodLabelData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
prodId.setLayoutData(prodLabelData); prodId.setLayoutData(prodLabelData);
productId = createProductIdField(prods,prod.getProductId()); productId = createProductIdField(prods, prod.getProductId());
prodLabelData = new GridData(SWT.FILL, SWT.DEFAULT, true, false); prodLabelData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
prodLabelData.grabExcessHorizontalSpace = true; prodLabelData.grabExcessHorizontalSpace = true;
prodLabelData.widthHint = 150; prodLabelData.widthHint = 150;
@ -260,8 +260,8 @@ public class NewAlarmDlg extends CaveSWTDialog {
prodId.setText("Product ID:"); prodId.setText("Product ID:");
prodLabelData = new GridData(SWT.FILL, SWT.DEFAULT, true, false); prodLabelData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
productId = createProductIdField(prods,prod.getProductId()); productId = createProductIdField(prods, prod.getProductId());
productId.setLayoutData(prodLabelData); productId.setLayoutData(prodLabelData);
// separator // separator
@ -468,7 +468,7 @@ public class NewAlarmDlg extends CaveSWTDialog {
} else { } else {
prod.setSearchString(searchString.getText()); prod.setSearchString(searchString.getText());
prod.setAlarm(alarmCheck.getSelection()); prod.setAlarm(alarmCheck.getSelection());
if(alarmCheck.getSelection()) { if (alarmCheck.getSelection()) {
prod.setAlarmType("Alarm"); prod.setAlarmType("Alarm");
} else { } else {
prod.setAlarmType("Alert"); prod.setAlarmType("Alert");