Issue #1196 Changes for NewAlarmDlg.
Change-Id: I6dd6b3a2984bc0e1590ca199d16adc574c2fbae4 Former-commit-id:6f2804a40a
[formerlyd21f3fff14
] [formerly6f2804a40a
[formerlyd21f3fff14
] [formerly7efd9fa9fe
[formerly 3bb158124bceac8cb10b96bb09423ffee0674ba3]]] Former-commit-id:7efd9fa9fe
Former-commit-id:74400d5347
[formerly98d685f675
] Former-commit-id:2be355e672
This commit is contained in:
parent
5a3f210a14
commit
fc2f106f29
2 changed files with 100 additions and 70 deletions
|
@ -373,21 +373,27 @@ public class AlarmAlertDlg extends CaveSWTDialog {
|
|||
}
|
||||
proximityAlarmDlg = new NewAlarmDlg(shell, "ALARM",
|
||||
new AlarmAlertProduct(isOperationalMode()));
|
||||
AlarmAlertProduct prod = (AlarmAlertProduct) proximityAlarmDlg
|
||||
.open();
|
||||
if (proximityAlarmDlg.haveOkEvent()) {
|
||||
aapList.add(prod);
|
||||
String string = "";
|
||||
if (prod.isAlarm()) {
|
||||
string += " (Alarm)";
|
||||
proximityAlarmDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
AlarmAlertProduct prod = (AlarmAlertProduct) returnValue;
|
||||
if (proximityAlarmDlg.haveOkEvent()) {
|
||||
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()
|
||||
+ "\"";
|
||||
}
|
||||
aaList.add(prod.getProductId() + string);
|
||||
changeSaveState(true);
|
||||
}
|
||||
});
|
||||
proximityAlarmDlg.open();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -403,16 +409,24 @@ public class AlarmAlertDlg extends CaveSWTDialog {
|
|||
|
||||
proximityAlarmDlg = new NewAlarmDlg(shell, "PROXIMITY",
|
||||
new AlarmAlertProduct(isOperationalMode()));
|
||||
AlarmAlertProduct prod = (AlarmAlertProduct) proximityAlarmDlg
|
||||
.open();
|
||||
if (proximityAlarmDlg.haveOkEvent()) {
|
||||
prod.setOperationalMode(isOperationalMode());
|
||||
papList.add(prod);
|
||||
paList.add(prod.getProductId() + " " + prod.getAlarmType()
|
||||
+ " " + prod.getActionCmd() + " "
|
||||
+ AlarmAlertFunctions.buildDistance(prod));
|
||||
changeSaveState(true);
|
||||
}
|
||||
proximityAlarmDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
AlarmAlertProduct prod = (AlarmAlertProduct) returnValue;
|
||||
if (proximityAlarmDlg.haveOkEvent()) {
|
||||
prod.setOperationalMode(isOperationalMode());
|
||||
papList.add(prod);
|
||||
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) {
|
||||
// User might change selection while dialog is displayed.
|
||||
int index = aaList.getSelectionIndex();
|
||||
final int index = aaList.getSelectionIndex();
|
||||
proximityAlarmDlg = new NewAlarmDlg(shell, "ALARM", aapList
|
||||
.get(index - 1));
|
||||
AlarmAlertProduct prod = aapList.set(index - 1,
|
||||
(AlarmAlertProduct) proximityAlarmDlg.open());
|
||||
if (proximityAlarmDlg.haveOkEvent()) {
|
||||
String string = "";
|
||||
if (prod.isAlarm()) {
|
||||
string += " (Alarm)";
|
||||
proximityAlarmDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
AlarmAlertProduct prod = (AlarmAlertProduct) returnValue;
|
||||
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() + "\"";
|
||||
}
|
||||
aaList.setItem(index, prod.getProductId() + string);
|
||||
paList.deselectAll();
|
||||
aaList.select(index);
|
||||
aaList.showSelection();
|
||||
changeSaveState(true);
|
||||
}
|
||||
});
|
||||
proximityAlarmDlg.open();
|
||||
} else if (paList.getSelectionIndex() != -1) {
|
||||
// User might change selection while dialog is displayed.
|
||||
int index = paList.getSelectionIndex();
|
||||
final int index = paList.getSelectionIndex();
|
||||
proximityAlarmDlg = new NewAlarmDlg(shell, "PROXIMITY",
|
||||
papList.get(index - 1));
|
||||
AlarmAlertProduct prod = papList.set(index - 1,
|
||||
(AlarmAlertProduct) proximityAlarmDlg.open());
|
||||
if (proximityAlarmDlg.haveOkEvent()) {
|
||||
paList.setItem(
|
||||
paList.getSelectionIndex(),
|
||||
prod.getProductId()
|
||||
+ " "
|
||||
+ prod.getAlarmType()
|
||||
+ " "
|
||||
+ prod.getActionCmd()
|
||||
+ " "
|
||||
+ AlarmAlertFunctions
|
||||
.buildDistance(prod));
|
||||
aaList.deselectAll();
|
||||
paList.select(index);
|
||||
paList.showSelection();
|
||||
changeSaveState(true);
|
||||
}
|
||||
proximityAlarmDlg.setCloseCallback(new ICloseCallback() {
|
||||
|
||||
@Override
|
||||
public void dialogClosed(Object returnValue) {
|
||||
AlarmAlertProduct prod = (AlarmAlertProduct) returnValue;
|
||||
prod = papList.set(index - 1, prod);
|
||||
if (proximityAlarmDlg.haveOkEvent()) {
|
||||
paList.setItem(
|
||||
paList.getSelectionIndex(),
|
||||
prod.getProductId()
|
||||
+ " "
|
||||
+ prod.getAlarmType()
|
||||
+ " "
|
||||
+ prod.getActionCmd()
|
||||
+ " "
|
||||
+ AlarmAlertFunctions
|
||||
.buildDistance(prod));
|
||||
aaList.deselectAll();
|
||||
paList.select(index);
|
||||
paList.showSelection();
|
||||
changeSaveState(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
proximityAlarmDlg.open();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -55,6 +55,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
|||
* Sep 10, 2009 mnash Initial creation
|
||||
* 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.
|
||||
* Sep 20, 2012 1196 rferrel No longer Blocks
|
||||
* </pre>
|
||||
*
|
||||
* @author mnash
|
||||
|
@ -71,8 +72,7 @@ public class NewAlarmDlg extends CaveSWTDialog {
|
|||
e.text = e.text.toUpperCase();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
private Combo alarmAlert;
|
||||
|
||||
private Combo actionCmd;
|
||||
|
@ -108,8 +108,8 @@ public class NewAlarmDlg extends CaveSWTDialog {
|
|||
*/
|
||||
protected NewAlarmDlg(Shell parentShell, String alarm_or_alert,
|
||||
AlarmAlertProduct product) {
|
||||
super(parentShell, CAVE.PERSPECTIVE_INDEPENDENT | SWT.PRIMARY_MODAL
|
||||
| SWT.RESIZE);
|
||||
super(parentShell, SWT.PRIMARY_MODAL | SWT.RESIZE,
|
||||
CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK);
|
||||
if ("PROXIMITY".equals(alarm_or_alert)) {
|
||||
productType = ProductType.Proximity_Alarm;
|
||||
setText("New Proximity Alarm Product");
|
||||
|
@ -187,13 +187,13 @@ public class NewAlarmDlg extends CaveSWTDialog {
|
|||
*/
|
||||
private Text createProductIdField(Composite prods, String initValue) {
|
||||
Text prodIdField = new Text(prods, SWT.SINGLE | SWT.BORDER);
|
||||
if(initValue != null) {
|
||||
if (initValue != null) {
|
||||
prodIdField.setText(initValue);
|
||||
}
|
||||
prodIdField.addVerifyListener(productIdVerifier);
|
||||
return prodIdField;
|
||||
}
|
||||
|
||||
|
||||
private void createAlarmDialog() {
|
||||
Composite prods = new Composite(shellComp, SWT.NONE);
|
||||
GridLayout prodLayout = new GridLayout(3, false);
|
||||
|
@ -208,8 +208,8 @@ public class NewAlarmDlg extends CaveSWTDialog {
|
|||
prodLabelData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
prodId.setLayoutData(prodLabelData);
|
||||
|
||||
productId = createProductIdField(prods,prod.getProductId());
|
||||
|
||||
productId = createProductIdField(prods, prod.getProductId());
|
||||
|
||||
prodLabelData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
prodLabelData.grabExcessHorizontalSpace = true;
|
||||
prodLabelData.widthHint = 150;
|
||||
|
@ -260,8 +260,8 @@ public class NewAlarmDlg extends CaveSWTDialog {
|
|||
prodId.setText("Product ID:");
|
||||
|
||||
prodLabelData = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||
|
||||
productId = createProductIdField(prods,prod.getProductId());
|
||||
|
||||
productId = createProductIdField(prods, prod.getProductId());
|
||||
productId.setLayoutData(prodLabelData);
|
||||
|
||||
// separator
|
||||
|
@ -468,7 +468,7 @@ public class NewAlarmDlg extends CaveSWTDialog {
|
|||
} else {
|
||||
prod.setSearchString(searchString.getText());
|
||||
prod.setAlarm(alarmCheck.getSelection());
|
||||
if(alarmCheck.getSelection()) {
|
||||
if (alarmCheck.getSelection()) {
|
||||
prod.setAlarmType("Alarm");
|
||||
} else {
|
||||
prod.setAlarmType("Alert");
|
||||
|
|
Loading…
Add table
Reference in a new issue