Issue #1196 Changes for NewAlarmDlg.

Change-Id: I6dd6b3a2984bc0e1590ca199d16adc574c2fbae4

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

View file

@ -373,8 +373,11 @@ 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();
@Override
public void dialogClosed(Object returnValue) {
AlarmAlertProduct prod = (AlarmAlertProduct) returnValue;
if (proximityAlarmDlg.haveOkEvent()) { if (proximityAlarmDlg.haveOkEvent()) {
aapList.add(prod); aapList.add(prod);
String string = ""; String string = "";
@ -382,14 +385,17 @@ public class AlarmAlertDlg extends CaveSWTDialog {
string += " (Alarm)"; string += " (Alarm)";
} }
if (!"".equals(prod.getSearchString())) { if (!"".equals(prod.getSearchString())) {
string += " containing \"" + prod.getSearchString() string += " containing \""
+ "\""; + prod.getSearchString() + "\"";
} }
aaList.add(prod.getProductId() + string); aaList.add(prod.getProductId() + string);
changeSaveState(true); changeSaveState(true);
} }
} }
}); });
proximityAlarmDlg.open();
}
});
Button newPAEntry = new Button(entryButtons, SWT.PUSH); Button newPAEntry = new Button(entryButtons, SWT.PUSH);
newPAEntry.setText("New PA Entry"); newPAEntry.setText("New PA Entry");
@ -403,19 +409,27 @@ 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();
@Override
public void dialogClosed(Object returnValue) {
AlarmAlertProduct prod = (AlarmAlertProduct) returnValue;
if (proximityAlarmDlg.haveOkEvent()) { if (proximityAlarmDlg.haveOkEvent()) {
prod.setOperationalMode(isOperationalMode()); prod.setOperationalMode(isOperationalMode());
papList.add(prod); papList.add(prod);
paList.add(prod.getProductId() + " " + prod.getAlarmType() paList.add(prod.getProductId() + " "
+ " " + prod.getActionCmd() + " " + prod.getAlarmType() + " "
+ prod.getActionCmd() + " "
+ AlarmAlertFunctions.buildDistance(prod)); + AlarmAlertFunctions.buildDistance(prod));
changeSaveState(true); changeSaveState(true);
} }
} }
}); });
proximityAlarmDlg.open();
}
});
changeEntry = new Button(entryButtons, SWT.PUSH); changeEntry = new Button(entryButtons, SWT.PUSH);
changeEntry.setText("Change Entry"); changeEntry.setText("Change Entry");
changeEntry.setEnabled(false); changeEntry.setEnabled(false);
@ -429,32 +443,45 @@ 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());
@Override
public void dialogClosed(Object returnValue) {
AlarmAlertProduct prod = (AlarmAlertProduct) returnValue;
prod = aapList.set(index - 1, prod);
if (proximityAlarmDlg.haveOkEvent()) { if (proximityAlarmDlg.haveOkEvent()) {
String string = ""; String string = "";
if (prod.isAlarm()) { if (prod.isAlarm()) {
string += " (Alarm)"; string += " (Alarm)";
} }
if (!"".equals(prod.getSearchString())) { if (!"".equals(prod.getSearchString())) {
string += " \"" + prod.getSearchString() + "\""; string += " \"" + prod.getSearchString()
+ "\"";
} }
aaList.setItem(index, prod.getProductId() + string); aaList.setItem(index, prod.getProductId()
+ string);
paList.deselectAll(); paList.deselectAll();
aaList.select(index); aaList.select(index);
aaList.showSelection(); aaList.showSelection();
changeSaveState(true); changeSaveState(true);
} }
}
});
proximityAlarmDlg.open();
} 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());
@Override
public void dialogClosed(Object returnValue) {
AlarmAlertProduct prod = (AlarmAlertProduct) returnValue;
prod = papList.set(index - 1, prod);
if (proximityAlarmDlg.haveOkEvent()) { if (proximityAlarmDlg.haveOkEvent()) {
paList.setItem( paList.setItem(
paList.getSelectionIndex(), paList.getSelectionIndex(),
@ -472,6 +499,9 @@ public class AlarmAlertDlg extends CaveSWTDialog {
changeSaveState(true); 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
@ -72,7 +73,6 @@ public class NewAlarmDlg extends CaveSWTDialog {
} }
}; };
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");