Merge branch 'Dialog_Refactor' into development
Former-commit-id:0bd99c3637
[formerly0bd99c3637
[formerly bedeaaf67ed189fa84f3f5a8399aeae5c200d1cc]] Former-commit-id:702576bbac
Former-commit-id:7f9e89cc79
This commit is contained in:
commit
ede743f659
11 changed files with 662 additions and 448 deletions
|
@ -57,6 +57,7 @@ import com.raytheon.viz.texteditor.alarmalert.util.AAPACombined;
|
||||||
import com.raytheon.viz.texteditor.alarmalert.util.AlarmAlertFunctions;
|
import com.raytheon.viz.texteditor.alarmalert.util.AlarmAlertFunctions;
|
||||||
import com.raytheon.viz.texteditor.alarmalert.util.AlarmAlertLists;
|
import com.raytheon.viz.texteditor.alarmalert.util.AlarmAlertLists;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
import com.raytheon.viz.ui.dialogs.ModeListener;
|
import com.raytheon.viz.ui.dialogs.ModeListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -69,6 +70,7 @@ import com.raytheon.viz.ui.dialogs.ModeListener;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Sep 9, 2009 mnash Initial creation
|
* Sep 9, 2009 mnash Initial creation
|
||||||
* Oct 31,2011 8510 rferrel Cleaned up code made more robust
|
* Oct 31,2011 8510 rferrel Cleaned up code made more robust
|
||||||
|
* Sep 20,2011 1196 rferrel Change dialogs so they do not block.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -133,7 +135,8 @@ public class AlarmAlertDlg extends CaveSWTDialog {
|
||||||
* @param parentShell
|
* @param parentShell
|
||||||
*/
|
*/
|
||||||
protected AlarmAlertDlg(Shell parentShell) {
|
protected AlarmAlertDlg(Shell parentShell) {
|
||||||
super(parentShell, SWT.RESIZE, CAVE.PERSPECTIVE_INDEPENDENT);
|
super(parentShell, SWT.RESIZE, CAVE.PERSPECTIVE_INDEPENDENT
|
||||||
|
| CAVE.DO_NOT_BLOCK);
|
||||||
setText("(init) Alarm/Alert and Proximity Alarm Products");
|
setText("(init) Alarm/Alert and Proximity Alarm Products");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,8 +181,6 @@ public class AlarmAlertDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
preOpened();
|
preOpened();
|
||||||
|
|
||||||
// shell.open();
|
|
||||||
|
|
||||||
opened();
|
opened();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,29 +271,14 @@ public class AlarmAlertDlg extends CaveSWTDialog {
|
||||||
// open dialog
|
// open dialog
|
||||||
AlarmAlertSaveLoadDlg dialog = new AlarmAlertSaveLoadDlg(shell,
|
AlarmAlertSaveLoadDlg dialog = new AlarmAlertSaveLoadDlg(shell,
|
||||||
SaveOrLoad.SAVE);
|
SaveOrLoad.SAVE);
|
||||||
dialog.open();
|
dialog.setCloseCallback(new ICloseCallback() {
|
||||||
String fname = dialog.getFileName();
|
|
||||||
fname = validateFileName(fname);
|
|
||||||
// AlarmAlertFunctions.validateName(fname);
|
|
||||||
|
|
||||||
if (fname != null && !fname.isEmpty()) {
|
@Override
|
||||||
setShellText(fname);
|
public void dialogClosed(Object returnValue) {
|
||||||
setLastFile(fname);
|
doSaveAs(returnValue.toString());
|
||||||
// save alert products
|
|
||||||
LocalizationFile lFile = AlarmAlertFunctions.getFile(
|
|
||||||
AlarmAlertFunctions.initUserLocalization(), fname);
|
|
||||||
if (lFile != null) {
|
|
||||||
AlarmAlertFunctions.saveAlarms(
|
|
||||||
aapList.subList(siteAdminNumberAA - 1,
|
|
||||||
aapList.size()),
|
|
||||||
papList.subList(siteAdminNumberPA - 1,
|
|
||||||
papList.size()), lFile);
|
|
||||||
} else {
|
|
||||||
statusHandler.handle(Priority.SIGNIFICANT,
|
|
||||||
"Null localization file", new VizException(
|
|
||||||
"Null localization file"));
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
dialog.open();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -303,43 +289,72 @@ public class AlarmAlertDlg extends CaveSWTDialog {
|
||||||
// open dialog
|
// open dialog
|
||||||
AlarmAlertSaveLoadDlg dialog = new AlarmAlertSaveLoadDlg(shell,
|
AlarmAlertSaveLoadDlg dialog = new AlarmAlertSaveLoadDlg(shell,
|
||||||
SaveOrLoad.LOAD);
|
SaveOrLoad.LOAD);
|
||||||
dialog.open();
|
dialog.setCloseCallback(new ICloseCallback() {
|
||||||
// load file
|
|
||||||
String fname = dialog.getFileName();
|
|
||||||
fname = validateFileName(fname);
|
|
||||||
// AlarmAlertFunctions.validateName(fname);
|
|
||||||
if (fname != null && !fname.isEmpty()) {
|
|
||||||
|
|
||||||
// load alert products
|
@Override
|
||||||
LocalizationFile lFile = AlarmAlertFunctions.getFile(
|
public void dialogClosed(Object returnValue) {
|
||||||
AlarmAlertFunctions.initUserLocalization(), fname);
|
doLoad(returnValue.toString());
|
||||||
if (lFile != null) {
|
|
||||||
File file = lFile.getFile();
|
|
||||||
setShellText(fname);
|
|
||||||
setLastFile(fname);
|
|
||||||
currentFile = file;
|
|
||||||
AAPACombined combined = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
combined = AlarmAlertFunctions.loadFile(file);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
combined = AlarmAlertFunctions
|
|
||||||
.createDefaultAAPACombined();
|
|
||||||
}
|
|
||||||
if (combined != null) {
|
|
||||||
populateLists(combined.getAaList(),
|
|
||||||
combined.getPaList());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
statusHandler.handle(Priority.SIGNIFICANT,
|
|
||||||
"Null localization file", new VizException(
|
|
||||||
"Null localization file"));
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
|
dialog.open();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void doSaveAs(String fname) {
|
||||||
|
fname = validateFileName(fname);
|
||||||
|
// AlarmAlertFunctions.validateName(fname);
|
||||||
|
|
||||||
|
if (fname != null && !fname.isEmpty()) {
|
||||||
|
setShellText(fname);
|
||||||
|
setLastFile(fname);
|
||||||
|
// save alert products
|
||||||
|
LocalizationFile lFile = AlarmAlertFunctions.getFile(
|
||||||
|
AlarmAlertFunctions.initUserLocalization(), fname);
|
||||||
|
if (lFile != null) {
|
||||||
|
AlarmAlertFunctions.saveAlarms(
|
||||||
|
aapList.subList(siteAdminNumberAA - 1, aapList.size()),
|
||||||
|
papList.subList(siteAdminNumberPA - 1, papList.size()),
|
||||||
|
lFile);
|
||||||
|
} else {
|
||||||
|
statusHandler.handle(Priority.SIGNIFICANT,
|
||||||
|
"Null localization file", new VizException(
|
||||||
|
"Null localization file"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void doLoad(String fname) {
|
||||||
|
fname = validateFileName(fname);
|
||||||
|
// AlarmAlertFunctions.validateName(fname);
|
||||||
|
if (fname != null && !fname.isEmpty()) {
|
||||||
|
|
||||||
|
// load alert products
|
||||||
|
LocalizationFile lFile = AlarmAlertFunctions.getFile(
|
||||||
|
AlarmAlertFunctions.initUserLocalization(), fname);
|
||||||
|
if (lFile != null) {
|
||||||
|
File file = lFile.getFile();
|
||||||
|
setShellText(fname);
|
||||||
|
setLastFile(fname);
|
||||||
|
currentFile = file;
|
||||||
|
AAPACombined combined = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
combined = AlarmAlertFunctions.loadFile(file);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
combined = AlarmAlertFunctions.createDefaultAAPACombined();
|
||||||
|
}
|
||||||
|
if (combined != null) {
|
||||||
|
populateLists(combined.getAaList(), combined.getPaList());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
statusHandler.handle(Priority.SIGNIFICANT,
|
||||||
|
"Null localization file", new VizException(
|
||||||
|
"Null localization file"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the buttons right below the menu
|
* Create the buttons right below the menu
|
||||||
*/
|
*/
|
||||||
|
@ -359,21 +374,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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -389,16 +410,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();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -415,48 +444,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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -602,11 +647,11 @@ public class AlarmAlertDlg extends CaveSWTDialog {
|
||||||
lists.getFilteredProducts().clear();
|
lists.getFilteredProducts().clear();
|
||||||
lists.getFilteredProducts().addAll(aapList);
|
lists.getFilteredProducts().addAll(aapList);
|
||||||
lists.getFilteredProducts().addAll(papList);
|
lists.getFilteredProducts().addAll(papList);
|
||||||
|
|
||||||
LocalizationFile lFile = AlarmAlertFunctions.getFile(
|
LocalizationFile lFile = AlarmAlertFunctions.getFile(
|
||||||
AlarmAlertFunctions.initUserLocalization(),
|
AlarmAlertFunctions.initUserLocalization(),
|
||||||
currentFile.getName());
|
currentFile.getName());
|
||||||
|
|
||||||
AlarmAlertFunctions.saveAlarms(
|
AlarmAlertFunctions.saveAlarms(
|
||||||
aapList.subList(siteAdminNumberAA - 1, aapList.size()),
|
aapList.subList(siteAdminNumberAA - 1, aapList.size()),
|
||||||
papList.subList(siteAdminNumberPA - 1, papList.size()), lFile);
|
papList.subList(siteAdminNumberPA - 1, papList.size()), lFile);
|
||||||
|
|
|
@ -58,6 +58,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* AWIPS2 DR Work
|
* AWIPS2 DR Work
|
||||||
* 07/25/2012 953 jkorman Modified file "search" to return LocalizationFile
|
* 07/25/2012 953 jkorman Modified file "search" to return LocalizationFile
|
||||||
* instead of File so references are deleted in all locations.
|
* instead of File so references are deleted in all locations.
|
||||||
|
* 09/20/2012 1196 rferrel Setup fileName now in return value for
|
||||||
|
* use with close callback.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -74,8 +76,6 @@ public class AlarmAlertSaveLoadDlg extends CaveSWTDialog {
|
||||||
|
|
||||||
private Composite shellComp;
|
private Composite shellComp;
|
||||||
|
|
||||||
private static AlarmAlertSaveLoadDlg saveLoadDlg = null;
|
|
||||||
|
|
||||||
private static String fileName = "";
|
private static String fileName = "";
|
||||||
|
|
||||||
private SaveOrLoad saveLoad;
|
private SaveOrLoad saveLoad;
|
||||||
|
@ -91,7 +91,7 @@ public class AlarmAlertSaveLoadDlg extends CaveSWTDialog {
|
||||||
*/
|
*/
|
||||||
protected AlarmAlertSaveLoadDlg(Shell parentShell, SaveOrLoad saveLoad) {
|
protected AlarmAlertSaveLoadDlg(Shell parentShell, SaveOrLoad saveLoad) {
|
||||||
super(parentShell, SWT.APPLICATION_MODAL | SWT.CLOSE | SWT.TITLE,
|
super(parentShell, SWT.APPLICATION_MODAL | SWT.CLOSE | SWT.TITLE,
|
||||||
CAVE.PERSPECTIVE_INDEPENDENT);
|
CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK);
|
||||||
if (saveLoad == SaveOrLoad.SAVE) {
|
if (saveLoad == SaveOrLoad.SAVE) {
|
||||||
setText("Save Lists As...");
|
setText("Save Lists As...");
|
||||||
} else {
|
} else {
|
||||||
|
@ -148,7 +148,7 @@ public class AlarmAlertSaveLoadDlg extends CaveSWTDialog {
|
||||||
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
|
||||||
lists.setLayoutData(gd);
|
lists.setLayoutData(gd);
|
||||||
LocalizationContext lc = AlarmAlertFunctions.initUserLocalization();
|
LocalizationContext lc = AlarmAlertFunctions.initUserLocalization();
|
||||||
|
|
||||||
// Get a list of localization files!
|
// Get a list of localization files!
|
||||||
LocalizationFile[] fList = PathManagerFactory.getPathManager()
|
LocalizationFile[] fList = PathManagerFactory.getPathManager()
|
||||||
.listFiles(lc, "alarms", new String[] { "xml" }, false, true);
|
.listFiles(lc, "alarms", new String[] { "xml" }, false, true);
|
||||||
|
@ -191,7 +191,12 @@ public class AlarmAlertSaveLoadDlg extends CaveSWTDialog {
|
||||||
loadButton.addSelectionListener(new SelectionAdapter() {
|
loadButton.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
// Set the filename to be returned through getFileName()
|
// Set the filename to be returned through getFileName()
|
||||||
fileName = lists.getSelection()[0];
|
if (lists.getSelectionCount() > 0) {
|
||||||
|
fileName = lists.getSelection()[0];
|
||||||
|
} else {
|
||||||
|
fileName = "";
|
||||||
|
}
|
||||||
|
setReturnValue(fileName);
|
||||||
shell.close();
|
shell.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -285,6 +290,7 @@ public class AlarmAlertSaveLoadDlg extends CaveSWTDialog {
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
// Set the filename to be returned through getFileName()
|
// Set the filename to be returned through getFileName()
|
||||||
fileName = textBox.getText();
|
fileName = textBox.getText();
|
||||||
|
setReturnValue(fileName);
|
||||||
shell.close();
|
shell.close();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -311,12 +317,4 @@ public class AlarmAlertSaveLoadDlg extends CaveSWTDialog {
|
||||||
public String getFileName() {
|
public String getFileName() {
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param args
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
saveLoadDlg = new AlarmAlertSaveLoadDlg(new Shell(), SaveOrLoad.LOAD);
|
|
||||||
saveLoadDlg.open();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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");
|
||||||
|
|
|
@ -23,6 +23,7 @@ package com.raytheon.viz.texteditor.dialogs;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.custom.StyledText;
|
||||||
import org.eclipse.swt.events.DisposeEvent;
|
import org.eclipse.swt.events.DisposeEvent;
|
||||||
import org.eclipse.swt.events.DisposeListener;
|
import org.eclipse.swt.events.DisposeListener;
|
||||||
import org.eclipse.swt.events.FocusEvent;
|
import org.eclipse.swt.events.FocusEvent;
|
||||||
|
@ -46,7 +47,6 @@ import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Layout;
|
import org.eclipse.swt.widgets.Layout;
|
||||||
import org.eclipse.swt.widgets.MessageBox;
|
import org.eclipse.swt.widgets.MessageBox;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
|
||||||
|
|
||||||
import com.raytheon.uf.common.dataplugin.text.AfosWmoIdDataContainer;
|
import com.raytheon.uf.common.dataplugin.text.AfosWmoIdDataContainer;
|
||||||
import com.raytheon.uf.common.dataplugin.text.db.AfosToAwips;
|
import com.raytheon.uf.common.dataplugin.text.db.AfosToAwips;
|
||||||
|
@ -64,6 +64,7 @@ import com.raytheon.viz.texteditor.msgs.IAfosIdSelectionCallback;
|
||||||
import com.raytheon.viz.texteditor.msgs.IWmoIdSelectionCallback;
|
import com.raytheon.viz.texteditor.msgs.IWmoIdSelectionCallback;
|
||||||
import com.raytheon.viz.texteditor.util.TextEditorUtil;
|
import com.raytheon.viz.texteditor.util.TextEditorUtil;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dialog that allows the user to edit the AWIPS header block.
|
* Dialog that allows the user to edit the AWIPS header block.
|
||||||
|
@ -72,8 +73,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
*
|
*
|
||||||
* SOFTWARE HISTORY
|
* SOFTWARE HISTORY
|
||||||
*
|
*
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 9/13/07 368 lvenable Initial creation.
|
* 9/13/07 368 lvenable Initial creation.
|
||||||
* 10/11/2007 482 grichard Reformatted file.
|
* 10/11/2007 482 grichard Reformatted file.
|
||||||
* 10/18/2007 482 grichard Implemented build 9 features.
|
* 10/18/2007 482 grichard Implemented build 9 features.
|
||||||
|
@ -91,7 +92,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* 05/30/2012 15046 D.Friedman Always set addressee field to ALL.
|
* 05/30/2012 15046 D.Friedman Always set addressee field to ALL.
|
||||||
* 06/19/2012 14975 D.Friedman Run callback when dialog is dismissed.
|
* 06/19/2012 14975 D.Friedman Run callback when dialog is dismissed.
|
||||||
* 07/26/2012 15171 rferrel Disable editor's send and clear AFOS PIL fields when
|
* 07/26/2012 15171 rferrel Disable editor's send and clear AFOS PIL fields when
|
||||||
* invalid product Id and user want to edit it anyway,
|
* invalid product Id and user want to edit it anyway.
|
||||||
|
* 09/20/2012 1196 rferrel Changing dialogs being called to not block.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author lvenable
|
* @author lvenable
|
||||||
|
@ -104,12 +106,12 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
/**
|
/**
|
||||||
* WMO data type and area indicator text field.
|
* WMO data type and area indicator text field.
|
||||||
*/
|
*/
|
||||||
private Text wmoTtaaiiTF;
|
private StyledText wmoTtaaiiTF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* International location indicator text field.
|
* International location indicator text field.
|
||||||
*/
|
*/
|
||||||
private Text ccccTF;
|
private StyledText ccccTF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Combo box Type of message/indicator group.
|
* Combo box Type of message/indicator group.
|
||||||
|
@ -124,23 +126,23 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
/**
|
/**
|
||||||
* AFOS site ID text field.
|
* AFOS site ID text field.
|
||||||
*/
|
*/
|
||||||
private Text wsfoIdTF;
|
private StyledText wsfoIdTF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Product category text field.
|
* Product category text field.
|
||||||
*/
|
*/
|
||||||
private Text prodCatTF;
|
private StyledText prodCatTF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Product designator text field.
|
* Product designator text field.
|
||||||
*/
|
*/
|
||||||
private Text prodDesignatorTF;
|
private StyledText prodDesignatorTF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address text field. Defines the site where a text product or message is
|
* Address text field. Defines the site where a text product or message is
|
||||||
* sent.
|
* sent.
|
||||||
*/
|
*/
|
||||||
private Text addresseeTF;
|
private StyledText addresseeTF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zeros button. Puts "000" into the addressee text field. Zeros indicates
|
* Zeros button. Puts "000" into the addressee text field. Zeros indicates
|
||||||
|
@ -247,7 +249,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
|
|
||||||
// Create the WMO ID text field.
|
// Create the WMO ID text field.
|
||||||
GridData gd = new GridData(55, SWT.DEFAULT);
|
GridData gd = new GridData(55, SWT.DEFAULT);
|
||||||
wmoTtaaiiTF = new Text(wmoIdComp, SWT.BORDER);
|
wmoTtaaiiTF = new StyledText(wmoIdComp, SWT.BORDER);
|
||||||
wmoTtaaiiTF.setTextLimit(6);
|
wmoTtaaiiTF.setTextLimit(6);
|
||||||
wmoTtaaiiTF.setLayoutData(gd);
|
wmoTtaaiiTF.setLayoutData(gd);
|
||||||
|
|
||||||
|
@ -264,7 +266,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
|
|
||||||
// Create the international location indicator text field.
|
// Create the international location indicator text field.
|
||||||
gd = new GridData(45, SWT.DEFAULT);
|
gd = new GridData(45, SWT.DEFAULT);
|
||||||
ccccTF = new Text(wmoIdComp, SWT.BORDER);
|
ccccTF = new StyledText(wmoIdComp, SWT.BORDER);
|
||||||
ccccTF.setTextLimit(4);
|
ccccTF.setTextLimit(4);
|
||||||
ccccTF.setLayoutData(gd);
|
ccccTF.setLayoutData(gd);
|
||||||
if (textProd != null && textProd.getSite() != null) {
|
if (textProd != null && textProd.getSite() != null) {
|
||||||
|
@ -377,7 +379,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
|
|
||||||
// Create the WSFO ID text field.
|
// Create the WSFO ID text field.
|
||||||
GridData gd = new GridData(45, SWT.DEFAULT);
|
GridData gd = new GridData(45, SWT.DEFAULT);
|
||||||
wsfoIdTF = new Text(afosIdComp, SWT.BORDER);
|
wsfoIdTF = new StyledText(afosIdComp, SWT.BORDER);
|
||||||
wsfoIdTF.setTextLimit(3);
|
wsfoIdTF.setTextLimit(3);
|
||||||
wsfoIdTF.setLayoutData(gd);
|
wsfoIdTF.setLayoutData(gd);
|
||||||
|
|
||||||
|
@ -386,7 +388,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
|
|
||||||
// Create the Product category text field.
|
// Create the Product category text field.
|
||||||
gd = new GridData(45, SWT.DEFAULT);
|
gd = new GridData(45, SWT.DEFAULT);
|
||||||
prodCatTF = new Text(afosIdComp, SWT.BORDER);
|
prodCatTF = new StyledText(afosIdComp, SWT.BORDER);
|
||||||
prodCatTF.setTextLimit(3);
|
prodCatTF.setTextLimit(3);
|
||||||
prodCatTF.setLayoutData(gd);
|
prodCatTF.setLayoutData(gd);
|
||||||
|
|
||||||
|
@ -395,7 +397,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
|
|
||||||
// Create the product designator text field.
|
// Create the product designator text field.
|
||||||
gd = new GridData(45, SWT.DEFAULT);
|
gd = new GridData(45, SWT.DEFAULT);
|
||||||
prodDesignatorTF = new Text(afosIdComp, SWT.BORDER);
|
prodDesignatorTF = new StyledText(afosIdComp, SWT.BORDER);
|
||||||
prodDesignatorTF.setTextLimit(3);
|
prodDesignatorTF.setTextLimit(3);
|
||||||
prodDesignatorTF.setLayoutData(gd);
|
prodDesignatorTF.setLayoutData(gd);
|
||||||
prodDesignatorTF.addFocusListener(new FocusListener() {
|
prodDesignatorTF.addFocusListener(new FocusListener() {
|
||||||
|
@ -409,7 +411,13 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
while (sb.length() < 3) {
|
while (sb.length() < 3) {
|
||||||
sb.append(' ');
|
sb.append(' ');
|
||||||
}
|
}
|
||||||
prodDesignatorTF.setText(sb.toString());
|
|
||||||
|
// Only trigger the modification listener when there is a
|
||||||
|
// real change.
|
||||||
|
String value = sb.toString();
|
||||||
|
if (!value.equals(prodDesignatorTF.getText())) {
|
||||||
|
prodDesignatorTF.setText(value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +468,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
addresseeComp.setLayout(rowLayout);
|
addresseeComp.setLayout(rowLayout);
|
||||||
|
|
||||||
RowData rd = new RowData(45, SWT.DEFAULT);
|
RowData rd = new RowData(45, SWT.DEFAULT);
|
||||||
addresseeTF = new Text(addresseeComp, SWT.BORDER);
|
addresseeTF = new StyledText(addresseeComp, SWT.BORDER);
|
||||||
addresseeTF.setTextLimit(4);
|
addresseeTF.setTextLimit(4);
|
||||||
addresseeTF.setLayoutData(rd);
|
addresseeTF.setLayoutData(rd);
|
||||||
// Set the "default" addressee to "ALL".
|
// Set the "default" addressee to "ALL".
|
||||||
|
@ -471,8 +479,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
// text field.
|
// text field.
|
||||||
addresseeTF.addModifyListener(new ModifyListener() {
|
addresseeTF.addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent event) {
|
public void modifyText(ModifyEvent event) {
|
||||||
if (addresseeTF.getCaretPosition() == addresseeTF
|
if (addresseeTF.getCaretOffset() == addresseeTF.getTextLimit()) {
|
||||||
.getTextLimit()) {
|
|
||||||
wmoTtaaiiTF.setFocus();
|
wmoTtaaiiTF.setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,13 +571,17 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
} else {
|
} else {
|
||||||
lookupWmoIDs();
|
lookupWmoIDs();
|
||||||
|
|
||||||
if (prodDesignatorTF.getCaretPosition() == prodDesignatorTF
|
if (!isDisposed()) {
|
||||||
.getTextLimit()) {
|
if (prodDesignatorTF.getCaretOffset() == prodDesignatorTF
|
||||||
addresseeTF.setFocus();
|
.getTextLimit()) {
|
||||||
|
addresseeTF.setFocus();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checkEnableEnter();
|
if (!isDisposed()) {
|
||||||
|
checkEnableEnter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -755,8 +766,16 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
|
|
||||||
AfosIdSelectionDialog dlg = new AfosIdSelectionDialog(
|
AfosIdSelectionDialog dlg = new AfosIdSelectionDialog(
|
||||||
shell, this, afosIds);
|
shell, this, afosIds);
|
||||||
dlg.setBlockOnOpen(true);
|
dlg.setCloseCallback(new ICloseCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dialogClosed(Object returnValue) {
|
||||||
|
lookupAllowed = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dlg.setBlockOnOpen(false);
|
||||||
dlg.open();
|
dlg.open();
|
||||||
|
return;
|
||||||
} else if (list.size() == 1) {
|
} else if (list.size() == 1) {
|
||||||
setAfosId(list.get(0).getAfosid());
|
setAfosId(list.get(0).getAfosid());
|
||||||
} else {
|
} else {
|
||||||
|
@ -820,8 +839,16 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
|
|
||||||
WmoIdSelectionDialog dlg = new WmoIdSelectionDialog(
|
WmoIdSelectionDialog dlg = new WmoIdSelectionDialog(
|
||||||
shell, this, ttaaiiIds, ccccIds);
|
shell, this, ttaaiiIds, ccccIds);
|
||||||
dlg.setBlockOnOpen(true);
|
dlg.setBlockOnOpen(false);
|
||||||
|
dlg.setCloseCallback(new ICloseCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dialogClosed(Object returnValue) {
|
||||||
|
lookupAllowed = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
dlg.open();
|
dlg.open();
|
||||||
|
return;
|
||||||
} else if (list.size() == 1) {
|
} else if (list.size() == 1) {
|
||||||
AfosToAwips id = list.get(0);
|
AfosToAwips id = list.get(0);
|
||||||
setWmoId(id.getWmottaaii(), id.getWmocccc());
|
setWmoId(id.getWmottaaii(), id.getWmocccc());
|
||||||
|
@ -839,7 +866,6 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Error occurred looking up WMO IDs", e);
|
"Error occurred looking up WMO IDs", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
lookupAllowed = true;
|
lookupAllowed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -889,8 +915,8 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
enterBtn.setEnabled(enable);
|
enterBtn.setEnabled(enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void textFieldKeyListener(final Text tf, final Text previousTF,
|
private void textFieldKeyListener(final StyledText tf,
|
||||||
final Text nextTF) {
|
final StyledText previousTF, final StyledText nextTF) {
|
||||||
tf.addKeyListener(new KeyAdapter() {
|
tf.addKeyListener(new KeyAdapter() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -898,7 +924,7 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
char c = e.character;
|
char c = e.character;
|
||||||
|
|
||||||
if (Character.isLetterOrDigit(c) || Character.isSpaceChar(c)) {
|
if (Character.isLetterOrDigit(c) || Character.isSpaceChar(c)) {
|
||||||
int pos = tf.getCaretPosition();
|
int pos = tf.getCaretOffset();
|
||||||
String text = tf.getText();
|
String text = tf.getText();
|
||||||
|
|
||||||
if (text.length() > pos) {
|
if (text.length() > pos) {
|
||||||
|
@ -909,16 +935,16 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
}
|
}
|
||||||
} else if (e.keyCode == SWT.ARROW_UP) {
|
} else if (e.keyCode == SWT.ARROW_UP) {
|
||||||
previousTF.setFocus();
|
previousTF.setFocus();
|
||||||
previousTF.setSelection(0);
|
previousTF.selectAll();
|
||||||
} else if (e.keyCode == SWT.ARROW_DOWN) {
|
} else if (e.keyCode == SWT.ARROW_DOWN) {
|
||||||
nextTF.setFocus();
|
nextTF.setFocus();
|
||||||
nextTF.setSelection(0);
|
nextTF.selectAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void textFieldVerifyListener(final Text tf) {
|
private void textFieldVerifyListener(final StyledText tf) {
|
||||||
tf.addVerifyListener(new VerifyListener() {
|
tf.addVerifyListener(new VerifyListener() {
|
||||||
@Override
|
@Override
|
||||||
public void verifyText(VerifyEvent e) {
|
public void verifyText(VerifyEvent e) {
|
||||||
|
@ -944,8 +970,8 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void textFieldModifyListener(final Text tf, final Text nextTF,
|
private void textFieldModifyListener(final StyledText tf,
|
||||||
final boolean callAfosLookup) {
|
final StyledText nextTF, final boolean callAfosLookup) {
|
||||||
tf.addModifyListener(new ModifyListener() {
|
tf.addModifyListener(new ModifyListener() {
|
||||||
public void modifyText(ModifyEvent event) {
|
public void modifyText(ModifyEvent event) {
|
||||||
if (tf.getCharCount() == tf.getTextLimit()) {
|
if (tf.getCharCount() == tf.getTextLimit()) {
|
||||||
|
@ -956,12 +982,14 @@ public class AWIPSHeaderBlockDlg extends CaveSWTDialog implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tf.getCaretPosition() == tf.getTextLimit()) {
|
if (!isDisposed()) {
|
||||||
nextTF.setFocus();
|
if (tf.getCaretOffset() == tf.getTextLimit()) {
|
||||||
nextTF.setSelection(0);
|
nextTF.setFocus();
|
||||||
}
|
nextTF.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
checkEnableEnter();
|
checkEnableEnter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -43,6 +44,8 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Aug 28, 2009 2924 rjpeter Initial creation.
|
* Aug 28, 2009 2924 rjpeter Initial creation.
|
||||||
|
* Sep 20, 1010 1196 rferrel Scroll bar now displays and limit placed
|
||||||
|
* on the height of the dialog.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author rjpeter
|
* @author rjpeter
|
||||||
|
@ -120,7 +123,7 @@ public class AfosIdSelectionDialog extends CaveJFACEDialog {
|
||||||
label.setLayoutData(data);
|
label.setLayoutData(data);
|
||||||
|
|
||||||
afosIdList = new List(top, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
|
afosIdList = new List(top, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
|
||||||
data = new GridData(SWT.BEGINNING, SWT.DEFAULT, true, false);
|
data = new GridData(SWT.CENTER, SWT.FILL, false, true);
|
||||||
afosIdList.setLayoutData(data);
|
afosIdList.setLayoutData(data);
|
||||||
|
|
||||||
for (String id : afosIds) {
|
for (String id : afosIds) {
|
||||||
|
@ -158,4 +161,13 @@ public class AfosIdSelectionDialog extends CaveJFACEDialog {
|
||||||
top.layout();
|
top.layout();
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Point getInitialSize() {
|
||||||
|
Point point = super.getInitialSize();
|
||||||
|
if (point.y > 500) {
|
||||||
|
point.y = 500;
|
||||||
|
}
|
||||||
|
return point;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,12 +27,15 @@ import java.util.List;
|
||||||
import java.util.TimeZone;
|
import java.util.TimeZone;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.FocusAdapter;
|
import org.eclipse.swt.custom.StyledText;
|
||||||
import org.eclipse.swt.events.FocusEvent;
|
import org.eclipse.swt.events.KeyAdapter;
|
||||||
|
import org.eclipse.swt.events.KeyEvent;
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
import org.eclipse.swt.events.ModifyEvent;
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
import org.eclipse.swt.events.ModifyListener;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.events.VerifyEvent;
|
||||||
|
import org.eclipse.swt.events.VerifyListener;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Button;
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
@ -40,7 +43,6 @@ import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Label;
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Layout;
|
import org.eclipse.swt.widgets.Layout;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.swt.widgets.Text;
|
|
||||||
|
|
||||||
import com.raytheon.uf.common.dataplugin.text.AfosWmoIdDataContainer;
|
import com.raytheon.uf.common.dataplugin.text.AfosWmoIdDataContainer;
|
||||||
import com.raytheon.uf.common.dataplugin.text.db.AfosToAwips;
|
import com.raytheon.uf.common.dataplugin.text.db.AfosToAwips;
|
||||||
|
@ -58,6 +60,7 @@ import com.raytheon.viz.texteditor.command.CommandFailedException;
|
||||||
import com.raytheon.viz.texteditor.msgs.IWmoIdSelectionCallback;
|
import com.raytheon.viz.texteditor.msgs.IWmoIdSelectionCallback;
|
||||||
import com.raytheon.viz.texteditor.util.TextEditorUtil;
|
import com.raytheon.viz.texteditor.util.TextEditorUtil;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Remote Site Request dialog.
|
* The Remote Site Request dialog.
|
||||||
|
@ -70,39 +73,50 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* 9/13/07 368 lvenable Initial creation.
|
* 9/13/07 368 lvenable Initial creation.
|
||||||
* 10/11/2007 482 grichard Reformatted file.
|
* 10/11/2007 482 grichard Reformatted file.
|
||||||
|
* 09/20/2012 1196 rferrel Changing dialogs being called to not block.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author lvenable
|
* @author lvenable
|
||||||
*/
|
*/
|
||||||
public class RemoteSiteRequestDlg extends CaveSWTDialog {
|
public class RemoteSiteRequestDlg extends CaveSWTDialog implements
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(RemoteSiteRequestDlg.class);
|
IWmoIdSelectionCallback {
|
||||||
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(RemoteSiteRequestDlg.class);
|
||||||
|
|
||||||
|
private StyledText ttaaiiTF;
|
||||||
|
|
||||||
|
private StyledText ccccTF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AFOS site ID text field.
|
* AFOS site ID text field.
|
||||||
*/
|
*/
|
||||||
private Text wsfoIdTF;
|
private StyledText wsfoIdTF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Product category text field.
|
* Product category text field.
|
||||||
*/
|
*/
|
||||||
private Text productCatTF;
|
private StyledText productCatTF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Product designator text field.
|
* Product designator text field.
|
||||||
*/
|
*/
|
||||||
private Text prodDesignatorTF;
|
private StyledText prodDesignatorTF;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Address text field. Defines the site where a text product or message is
|
* Address text field. Defines the site where a text product or message is
|
||||||
* sent.
|
* sent.
|
||||||
*/
|
*/
|
||||||
private Text addresseeTF;
|
private StyledText addresseeTF;
|
||||||
|
|
||||||
private Button enterBtn;
|
private Button enterBtn;
|
||||||
|
|
||||||
private String initialAfosID;
|
private String initialAfosID;
|
||||||
|
|
||||||
|
private WmoIdSelectionDialog wmoIdSelectionDialog;
|
||||||
|
|
||||||
|
boolean lookupAllowed = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor.
|
* Constructor.
|
||||||
*
|
*
|
||||||
|
@ -110,7 +124,8 @@ public class RemoteSiteRequestDlg extends CaveSWTDialog {
|
||||||
* Parent shell.
|
* Parent shell.
|
||||||
*/
|
*/
|
||||||
public RemoteSiteRequestDlg(Shell parent) {
|
public RemoteSiteRequestDlg(Shell parent) {
|
||||||
super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT);
|
super(parent, SWT.DIALOG_TRIM, CAVE.PERSPECTIVE_INDEPENDENT
|
||||||
|
| CAVE.DO_NOT_BLOCK);
|
||||||
setText("Send Request");
|
setText("Send Request");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +143,7 @@ public class RemoteSiteRequestDlg extends CaveSWTDialog {
|
||||||
protected void initializeComponents(Shell shell) {
|
protected void initializeComponents(Shell shell) {
|
||||||
createInputFields();
|
createInputFields();
|
||||||
createBottomButtons();
|
createBottomButtons();
|
||||||
validate();
|
checkEnableEnter();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -141,137 +156,84 @@ public class RemoteSiteRequestDlg extends CaveSWTDialog {
|
||||||
gridLayout.marginTop = 1;
|
gridLayout.marginTop = 1;
|
||||||
gridLayout.horizontalSpacing = 20;
|
gridLayout.horizontalSpacing = 20;
|
||||||
topComp.setLayout(gridLayout);
|
topComp.setLayout(gridLayout);
|
||||||
|
GridData gd = null;
|
||||||
|
Label sepLbl = null;
|
||||||
|
|
||||||
|
gd = new GridData(70, SWT.DEFAULT);
|
||||||
|
ttaaiiTF = new StyledText(topComp, SWT.BORDER | SWT.READ_ONLY);
|
||||||
|
ttaaiiTF.setTextLimit(6);
|
||||||
|
ttaaiiTF.setLayoutData(gd);
|
||||||
|
ttaaiiTF.setEnabled(false);
|
||||||
|
ttaaiiTF.setEditable(false);
|
||||||
|
ttaaiiTF.setBackground(shell.getBackground());
|
||||||
|
|
||||||
|
Label ttaaiiLbl = new Label(topComp, SWT.NONE);
|
||||||
|
ttaaiiLbl.setText("TTAAii");
|
||||||
|
|
||||||
|
gd = new GridData(45, SWT.DEFAULT);
|
||||||
|
ccccTF = new StyledText(topComp, SWT.BORDER | SWT.READ_ONLY);
|
||||||
|
ccccTF.setEnabled(false);
|
||||||
|
ccccTF.setEditable(false);
|
||||||
|
ccccTF.setLayoutData(gd);
|
||||||
|
ccccTF.setBackground(shell.getBackground());
|
||||||
|
Label ccccLbl = new Label(topComp, SWT.NONE);
|
||||||
|
ccccLbl.setText("CCCC");
|
||||||
|
|
||||||
|
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
|
gd.horizontalSpan = 2;
|
||||||
|
sepLbl = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL);
|
||||||
|
sepLbl.setLayoutData(gd);
|
||||||
|
|
||||||
ModifyListener validator = new ModifyListener() {
|
|
||||||
@Override
|
|
||||||
public void modifyText(ModifyEvent e) {
|
|
||||||
validate();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Create the WSFO ID text field.
|
// Create the WSFO ID text field.
|
||||||
GridData gd = new GridData(45, SWT.DEFAULT);
|
gd = new GridData(45, SWT.DEFAULT);
|
||||||
wsfoIdTF = new Text(topComp, SWT.BORDER);
|
wsfoIdTF = new StyledText(topComp, SWT.BORDER);
|
||||||
wsfoIdTF.setTextLimit(3);
|
wsfoIdTF.setTextLimit(3);
|
||||||
wsfoIdTF.setLayoutData(gd);
|
wsfoIdTF.setLayoutData(gd);
|
||||||
wsfoIdTF.addFocusListener(new FocusAdapter() {
|
|
||||||
public void focusLost(FocusEvent event) {
|
|
||||||
wsfoIdTF.setText(wsfoIdTF.getText().toUpperCase());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// When the number of characters enter reaches the max limit and
|
|
||||||
// the caret position is at the end then switch focus to another
|
|
||||||
// text field.
|
|
||||||
wsfoIdTF.addModifyListener(new ModifyListener() {
|
|
||||||
public void modifyText(ModifyEvent event) {
|
|
||||||
if (wsfoIdTF.getCaretPosition() == wsfoIdTF.getTextLimit()) {
|
|
||||||
productCatTF.setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
wsfoIdTF.addModifyListener(validator);
|
|
||||||
|
|
||||||
Label wsfoIdLbl = new Label(topComp, SWT.NONE);
|
Label wsfoIdLbl = new Label(topComp, SWT.NONE);
|
||||||
wsfoIdLbl.setText("WSFO Identification");
|
wsfoIdLbl.setText("WSFO Identification");
|
||||||
|
|
||||||
// Create the product category text field.
|
// Create the product category text field.
|
||||||
gd = new GridData(45, SWT.DEFAULT);
|
gd = new GridData(45, SWT.DEFAULT);
|
||||||
productCatTF = new Text(topComp, SWT.BORDER);
|
productCatTF = new StyledText(topComp, SWT.BORDER);
|
||||||
productCatTF.setTextLimit(3);
|
productCatTF.setTextLimit(3);
|
||||||
productCatTF.setLayoutData(gd);
|
productCatTF.setLayoutData(gd);
|
||||||
productCatTF.addFocusListener(new FocusAdapter() {
|
|
||||||
public void focusLost(FocusEvent event) {
|
|
||||||
productCatTF.setText(productCatTF.getText().toUpperCase());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// When the number of characters enter reaches the max limit and
|
|
||||||
// the caret position is at the end then switch focus to another
|
|
||||||
// text field.
|
|
||||||
productCatTF.addModifyListener(new ModifyListener() {
|
|
||||||
public void modifyText(ModifyEvent event) {
|
|
||||||
if (productCatTF.getCaretPosition() == productCatTF
|
|
||||||
.getTextLimit()) {
|
|
||||||
prodDesignatorTF.setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
productCatTF.addModifyListener(validator);
|
|
||||||
|
|
||||||
Label productCatLbl = new Label(topComp, SWT.NONE);
|
Label productCatLbl = new Label(topComp, SWT.NONE);
|
||||||
productCatLbl.setText("Product Category");
|
productCatLbl.setText("Product Category");
|
||||||
|
|
||||||
// Create the product designator text field.
|
// Create the product designator text field.
|
||||||
gd = new GridData(45, SWT.DEFAULT);
|
gd = new GridData(45, SWT.DEFAULT);
|
||||||
prodDesignatorTF = new Text(topComp, SWT.BORDER);
|
prodDesignatorTF = new StyledText(topComp, SWT.BORDER);
|
||||||
prodDesignatorTF.setTextLimit(3);
|
prodDesignatorTF.setTextLimit(3);
|
||||||
prodDesignatorTF.setLayoutData(gd);
|
prodDesignatorTF.setLayoutData(gd);
|
||||||
prodDesignatorTF.addFocusListener(new FocusAdapter() {
|
|
||||||
public void focusLost(FocusEvent event) {
|
|
||||||
prodDesignatorTF.setText(prodDesignatorTF.getText()
|
|
||||||
.toUpperCase());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// When the number of characters enter reaches the max limit and
|
|
||||||
// the caret position is at the end then switch focus to another
|
|
||||||
// text field.
|
|
||||||
prodDesignatorTF.addModifyListener(new ModifyListener() {
|
|
||||||
public void modifyText(ModifyEvent event) {
|
|
||||||
if (prodDesignatorTF.getCaretPosition() == prodDesignatorTF
|
|
||||||
.getTextLimit()) {
|
|
||||||
addresseeTF.setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
prodDesignatorTF.addModifyListener(validator);
|
|
||||||
|
|
||||||
Label prodDesignatorLbl = new Label(topComp, SWT.NONE);
|
Label prodDesignatorLbl = new Label(topComp, SWT.NONE);
|
||||||
prodDesignatorLbl.setText("Product Designator");
|
prodDesignatorLbl.setText("Product Designator");
|
||||||
|
|
||||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
gd.horizontalSpan = 2;
|
gd.horizontalSpan = 2;
|
||||||
Label sepLbl = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL);
|
sepLbl = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL);
|
||||||
sepLbl.setLayoutData(gd);
|
sepLbl.setLayoutData(gd);
|
||||||
|
|
||||||
// Create the addressee text field.
|
// Create the addressee text field.
|
||||||
gd = new GridData(45, SWT.DEFAULT);
|
gd = new GridData(45, SWT.DEFAULT);
|
||||||
addresseeTF = new Text(topComp, SWT.BORDER);
|
addresseeTF = new StyledText(topComp, SWT.BORDER);
|
||||||
addresseeTF.setTextLimit(4);
|
addresseeTF.setTextLimit(4);
|
||||||
addresseeTF.setText("DEF");
|
addresseeTF.setText("DEF");
|
||||||
addresseeTF.setLayoutData(gd);
|
addresseeTF.setLayoutData(gd);
|
||||||
addresseeTF.addFocusListener(new FocusAdapter() {
|
|
||||||
public void focusLost(FocusEvent event) {
|
|
||||||
addresseeTF.setText(addresseeTF.getText().toUpperCase());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// When the number of characters enter reaches the max limit and
|
|
||||||
// the caret position is at the end then switch focus to another
|
|
||||||
// text field.
|
|
||||||
addresseeTF.addModifyListener(new ModifyListener() {
|
|
||||||
public void modifyText(ModifyEvent event) {
|
|
||||||
if (addresseeTF.getCaretPosition() == addresseeTF
|
|
||||||
.getTextLimit()) {
|
|
||||||
wsfoIdTF.setFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
addresseeTF.addModifyListener(validator);
|
|
||||||
|
|
||||||
Label addresseeLbl = new Label(topComp, SWT.NONE);
|
Label addresseeLbl = new Label(topComp, SWT.NONE);
|
||||||
addresseeLbl.setText("Addressee");
|
addresseeLbl.setText("Addressee");
|
||||||
|
|
||||||
|
setupTextFieldListeners();
|
||||||
|
|
||||||
gd = new GridData(GridData.FILL_HORIZONTAL);
|
gd = new GridData(GridData.FILL_HORIZONTAL);
|
||||||
gd.horizontalSpan = 2;
|
gd.horizontalSpan = 2;
|
||||||
sepLbl = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL);
|
sepLbl = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL);
|
||||||
sepLbl.setLayoutData(gd);
|
sepLbl.setLayoutData(gd);
|
||||||
|
|
||||||
|
// TODO set fields should be moved to preOpen()
|
||||||
String ccc = "";
|
String ccc = "";
|
||||||
String nnn = "";
|
String nnn = "";
|
||||||
String xxx = "";
|
String xxx = "";
|
||||||
|
@ -287,6 +249,24 @@ public class RemoteSiteRequestDlg extends CaveSWTDialog {
|
||||||
prodDesignatorTF.setText(xxx);
|
prodDesignatorTF.setText(xxx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setupTextFieldListeners() {
|
||||||
|
// forces all fields to uppercase and only allows numbers/digits
|
||||||
|
textFieldVerifyListener(wsfoIdTF);
|
||||||
|
textFieldVerifyListener(productCatTF);
|
||||||
|
textFieldVerifyListener(prodDesignatorTF);
|
||||||
|
textFieldVerifyListener(addresseeTF);
|
||||||
|
|
||||||
|
// forces overwrite and arrow key traversal
|
||||||
|
textFieldKeyListener(wsfoIdTF, addresseeTF, productCatTF);
|
||||||
|
textFieldKeyListener(productCatTF, wsfoIdTF, prodDesignatorTF);
|
||||||
|
textFieldKeyListener(prodDesignatorTF, productCatTF, addresseeTF);
|
||||||
|
textFieldKeyListener(addresseeTF, prodDesignatorTF, wsfoIdTF);
|
||||||
|
|
||||||
|
textFieldModifyListener(wsfoIdTF, productCatTF, true);
|
||||||
|
textFieldModifyListener(productCatTF, prodDesignatorTF, true);
|
||||||
|
textFieldModifyListener(prodDesignatorTF, addresseeTF, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the bottom Enter and Cancel buttons.
|
* Create the bottom Enter and Cancel buttons.
|
||||||
*/
|
*/
|
||||||
|
@ -323,79 +303,9 @@ public class RemoteSiteRequestDlg extends CaveSWTDialog {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validate() {
|
|
||||||
if (enterBtn != null)
|
|
||||||
enterBtn.setEnabled(createReturnValue(true));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copied from AWIPSHeaderBlockDlg.lookupWmoIDs()
|
private Calendar createCalRelativeTo(Calendar relative,
|
||||||
private boolean lookupWmoId(final RemoteRetrievalRequest rrRequest) {
|
WMOHeader wmoHeader, int monthAdjustment) {
|
||||||
GetWmoIdRequest request = new GetWmoIdRequest();
|
|
||||||
request.setAfosId(rrRequest.getAfosID());
|
|
||||||
|
|
||||||
try {
|
|
||||||
Object response = ThriftClient.sendRequest(request);
|
|
||||||
if (response != null) {
|
|
||||||
if (response instanceof AfosWmoIdDataContainer) {
|
|
||||||
AfosWmoIdDataContainer container = (AfosWmoIdDataContainer) response;
|
|
||||||
if (container.getErrorMessage() != null) {
|
|
||||||
statusHandler.handle(
|
|
||||||
Priority.PROBLEM,
|
|
||||||
"Error occurred looking up WMO IDs\nMessage from server["
|
|
||||||
+ container
|
|
||||||
.getErrorMessage()
|
|
||||||
+ "]");
|
|
||||||
}
|
|
||||||
|
|
||||||
List<AfosToAwips> list = container.getIdList();
|
|
||||||
|
|
||||||
if (list.size() > 1) {
|
|
||||||
ArrayList<String> ttaaiiIds = new ArrayList<String>(
|
|
||||||
list.size());
|
|
||||||
ArrayList<String> ccccIds = new ArrayList<String>(
|
|
||||||
list.size());
|
|
||||||
for (AfosToAwips id : list) {
|
|
||||||
ttaaiiIds.add(id.getWmottaaii());
|
|
||||||
ccccIds.add(id.getWmocccc());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
IWmoIdSelectionCallback cb = new IWmoIdSelectionCallback() {
|
|
||||||
@Override
|
|
||||||
public void setWmoId(String ttaaii, String cccc) {
|
|
||||||
rrRequest.setWmoHeader(ttaaii + ' ' + cccc);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
WmoIdSelectionDialog dlg = new WmoIdSelectionDialog(
|
|
||||||
shell, cb, ttaaiiIds, ccccIds);
|
|
||||||
dlg.setBlockOnOpen(true);
|
|
||||||
dlg.open();
|
|
||||||
return rrRequest.getWmoHeader() != null &&
|
|
||||||
rrRequest.getWmoHeader().length() > 0;
|
|
||||||
} else if (list.size() == 1) {
|
|
||||||
AfosToAwips id = list.get(0);
|
|
||||||
rrRequest.setWmoHeader(id.getWmottaaii() + ' ' + id.getWmocccc());
|
|
||||||
} else {
|
|
||||||
rrRequest.setWmoHeader("");
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
|
||||||
"Received unhandled WMO Id lookup response from server. Received obj of type ["
|
|
||||||
+ response.getClass() + "], contents["
|
|
||||||
+ response + "]");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (VizException e) {
|
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
|
||||||
"Error occurred looking up WMO IDs", e);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Calendar createCalRelativeTo(Calendar relative, WMOHeader wmoHeader, int monthAdjustment) {
|
|
||||||
Calendar c = new GregorianCalendar(relative.getTimeZone());
|
Calendar c = new GregorianCalendar(relative.getTimeZone());
|
||||||
c.setTimeInMillis(relative.getTimeInMillis());
|
c.setTimeInMillis(relative.getTimeInMillis());
|
||||||
c.add(GregorianCalendar.MONTH, monthAdjustment);
|
c.add(GregorianCalendar.MONTH, monthAdjustment);
|
||||||
|
@ -406,11 +316,11 @@ public class RemoteSiteRequestDlg extends CaveSWTDialog {
|
||||||
c.set(GregorianCalendar.MILLISECOND, 0);
|
c.set(GregorianCalendar.MILLISECOND, 0);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Calendar getCloserCalendar(Calendar reference, Calendar a, Calendar b) {
|
private Calendar getCloserCalendar(Calendar reference, Calendar a,
|
||||||
return Math.abs(a.getTimeInMillis() - reference.getTimeInMillis()) <
|
Calendar b) {
|
||||||
Math.abs(b.getTimeInMillis() - reference.getTimeInMillis()) ?
|
return Math.abs(a.getTimeInMillis() - reference.getTimeInMillis()) < Math
|
||||||
a : b;
|
.abs(b.getTimeInMillis() - reference.getTimeInMillis()) ? a : b;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean createReturnValue(boolean validateOnly) {
|
private boolean createReturnValue(boolean validateOnly) {
|
||||||
|
@ -418,41 +328,41 @@ public class RemoteSiteRequestDlg extends CaveSWTDialog {
|
||||||
String nnn = productCatTF.getText();
|
String nnn = productCatTF.getText();
|
||||||
String xxx = prodDesignatorTF.getText();
|
String xxx = prodDesignatorTF.getText();
|
||||||
String addr = addresseeTF.getText();
|
String addr = addresseeTF.getText();
|
||||||
if (ccc.length() != 3 || nnn.length() != 3 ||
|
if (ccc.length() != 3 || nnn.length() != 3 || xxx.length() < 1
|
||||||
xxx.length() < 1 || xxx.length() > 3 ||
|
|| xxx.length() > 3 || addr.length() < 1)
|
||||||
addr.length() < 1)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (validateOnly)
|
if (validateOnly)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
String afosID = ccc + nnn + xxx;
|
String afosID = ccc + nnn + xxx;
|
||||||
GetWmoIdRequest request = new GetWmoIdRequest();
|
GetWmoIdRequest request = new GetWmoIdRequest();
|
||||||
request.setAfosId(afosID);
|
request.setAfosId(afosID);
|
||||||
|
|
||||||
RemoteRetrievalRequest req = new RemoteRetrievalRequest();
|
RemoteRetrievalRequest req = new RemoteRetrievalRequest();
|
||||||
// TODO: Translate addr via awipsSites.txt or siteDistLists.txt
|
// TODO: Translate addr via awipsSites.txt or siteDistLists.txt
|
||||||
req.setAddressee(addr);
|
req.setAddressee(addr);
|
||||||
req.setAfosID(afosID);
|
req.setAfosID(afosID);
|
||||||
|
|
||||||
List<StdTextProduct> latest = null;
|
List<StdTextProduct> latest = null;
|
||||||
try {
|
try {
|
||||||
latest = CommandFactory.getAfosCommand(req.getAfosID()).executeCommand(TextEditorUtil
|
latest = CommandFactory.getAfosCommand(req.getAfosID())
|
||||||
.getTextDbsrvTransport());
|
.executeCommand(TextEditorUtil.getTextDbsrvTransport());
|
||||||
} catch (CommandFailedException e) {
|
} catch (CommandFailedException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Error retrieving metatdata", e);
|
"Error retrieving metatdata", e);
|
||||||
// but keep going...
|
// but keep going...
|
||||||
}
|
}
|
||||||
|
|
||||||
if (latest != null && latest.size() > 0) {
|
if (latest != null && latest.size() > 0) {
|
||||||
Calendar c = new GregorianCalendar(TimeZone
|
Calendar c = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
|
||||||
.getTimeZone("GMT"));
|
|
||||||
c.setTimeInMillis(latest.get(0).getRefTime());
|
c.setTimeInMillis(latest.get(0).getRefTime());
|
||||||
req.setMostRecentTime(c.getTimeInMillis()); // default
|
req.setMostRecentTime(c.getTimeInMillis()); // default
|
||||||
try {
|
try {
|
||||||
WMOHeader wmo = new WMOHeader(latest.get(0).getProduct().getBytes());
|
WMOHeader wmo = new WMOHeader(latest.get(0).getProduct()
|
||||||
Calendar t = getCloserCalendar(c, createCalRelativeTo(c, wmo, 0),
|
.getBytes());
|
||||||
|
Calendar t = getCloserCalendar(c,
|
||||||
|
createCalRelativeTo(c, wmo, 0),
|
||||||
createCalRelativeTo(c, wmo, 1));
|
createCalRelativeTo(c, wmo, 1));
|
||||||
t = getCloserCalendar(c, t, createCalRelativeTo(c, wmo, -1));
|
t = getCloserCalendar(c, t, createCalRelativeTo(c, wmo, -1));
|
||||||
req.setMostRecentTime(t.getTimeInMillis());
|
req.setMostRecentTime(t.getTimeInMillis());
|
||||||
|
@ -463,18 +373,205 @@ public class RemoteSiteRequestDlg extends CaveSWTDialog {
|
||||||
} else
|
} else
|
||||||
req.setMostRecentTime(0);
|
req.setMostRecentTime(0);
|
||||||
|
|
||||||
if (! lookupWmoId(req))
|
String ttaaii = ttaaiiTF.getText();
|
||||||
return false;
|
String cccc = ccccTF.getText();
|
||||||
|
if (ttaaii.length() > 0 && cccc.length() > 0) {
|
||||||
req.setValidTime(System.currentTimeMillis() + 600 * 1000); // Current time plus 10 minutes
|
req.setWmoHeader(ttaaii + " " + cccc);
|
||||||
|
} else {
|
||||||
|
req.setWmoHeader("");
|
||||||
|
}
|
||||||
|
|
||||||
|
req.setValidTime(System.currentTimeMillis() + 600 * 1000); // Current
|
||||||
|
// time plus
|
||||||
|
// 10 minutes
|
||||||
|
|
||||||
setReturnValue(req);
|
setReturnValue(req);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void textFieldKeyListener(final StyledText tf,
|
||||||
|
final StyledText previousTF, final StyledText nextTF) {
|
||||||
|
tf.addKeyListener(new KeyAdapter() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void keyPressed(KeyEvent e) {
|
||||||
|
char c = e.character;
|
||||||
|
|
||||||
|
if (Character.isLetterOrDigit(c) || Character.isSpaceChar(c)) {
|
||||||
|
int pos = tf.getCaretOffset();
|
||||||
|
String text = tf.getText();
|
||||||
|
|
||||||
|
if (text.length() > pos) {
|
||||||
|
StringBuilder b = new StringBuilder(text);
|
||||||
|
b.deleteCharAt(pos);
|
||||||
|
tf.setText(b.toString());
|
||||||
|
tf.setSelection(pos);
|
||||||
|
}
|
||||||
|
} else if (e.keyCode == SWT.ARROW_UP) {
|
||||||
|
previousTF.setFocus();
|
||||||
|
previousTF.selectAll();
|
||||||
|
} else if (e.keyCode == SWT.ARROW_DOWN) {
|
||||||
|
nextTF.setFocus();
|
||||||
|
nextTF.selectAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void textFieldVerifyListener(final StyledText tf) {
|
||||||
|
tf.addVerifyListener(new VerifyListener() {
|
||||||
|
@Override
|
||||||
|
public void verifyText(VerifyEvent e) {
|
||||||
|
e.text = e.text.toUpperCase();
|
||||||
|
StringBuilder b = null;
|
||||||
|
int posMod = 0;
|
||||||
|
char[] chars = e.text.toCharArray();
|
||||||
|
for (int i = 0; i < chars.length; i++) {
|
||||||
|
char c = chars[i];
|
||||||
|
if (!Character.isLetterOrDigit(c)
|
||||||
|
&& !Character.isSpaceChar(c)) {
|
||||||
|
if (b == null) {
|
||||||
|
b = new StringBuilder(e.text);
|
||||||
|
}
|
||||||
|
b.deleteCharAt(i - posMod++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (b != null) {
|
||||||
|
e.text = b.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void textFieldModifyListener(final StyledText tf,
|
||||||
|
final StyledText nextTF, final boolean limitCheck) {
|
||||||
|
tf.addModifyListener(new ModifyListener() {
|
||||||
|
public void modifyText(ModifyEvent event) {
|
||||||
|
if (!limitCheck || tf.getCharCount() == tf.getTextLimit()) {
|
||||||
|
if (wmoIdSelectionDialog == null) {
|
||||||
|
lookupWmoIDs();
|
||||||
|
} else {
|
||||||
|
wmoIdSelectionDialog.close();
|
||||||
|
wmoIdSelectionDialog = null;
|
||||||
|
lookupWmoIDs();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (wmoIdSelectionDialog != null) {
|
||||||
|
wmoIdSelectionDialog.close();
|
||||||
|
wmoIdSelectionDialog = null;
|
||||||
|
}
|
||||||
|
setWmoId("", "");
|
||||||
|
checkEnableEnter();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isDisposed()) {
|
||||||
|
if (tf.getCaretOffset() == tf.getTextLimit()) {
|
||||||
|
nextTF.setFocus();
|
||||||
|
nextTF.selectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
checkEnableEnter();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lookupWmoIDs() {
|
||||||
|
if (lookupAllowed && wsfoIdTF.getCharCount() == wsfoIdTF.getTextLimit()
|
||||||
|
&& productCatTF.getCharCount() == productCatTF.getTextLimit()
|
||||||
|
&& prodDesignatorTF.getText().length() > 0) {
|
||||||
|
GetWmoIdRequest request = new GetWmoIdRequest();
|
||||||
|
request.setAfosId(wsfoIdTF.getText() + productCatTF.getText()
|
||||||
|
+ prodDesignatorTF.getText());
|
||||||
|
lookupAllowed = false;
|
||||||
|
|
||||||
|
try {
|
||||||
|
Object response = ThriftClient.sendRequest(request);
|
||||||
|
if (response != null) {
|
||||||
|
if (response instanceof AfosWmoIdDataContainer) {
|
||||||
|
AfosWmoIdDataContainer container = (AfosWmoIdDataContainer) response;
|
||||||
|
if (container.getErrorMessage() != null) {
|
||||||
|
statusHandler
|
||||||
|
.handle(Priority.PROBLEM,
|
||||||
|
"Error occurred looking up WMO IDs\nMessage from server["
|
||||||
|
+ container
|
||||||
|
.getErrorMessage()
|
||||||
|
+ "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
java.util.List<AfosToAwips> list = container
|
||||||
|
.getIdList();
|
||||||
|
|
||||||
|
if (list.size() > 1) {
|
||||||
|
ArrayList<String> ttaaiiIds = new ArrayList<String>(
|
||||||
|
list.size());
|
||||||
|
ArrayList<String> ccccIds = new ArrayList<String>(
|
||||||
|
list.size());
|
||||||
|
for (AfosToAwips id : list) {
|
||||||
|
ttaaiiIds.add(id.getWmottaaii());
|
||||||
|
ccccIds.add(id.getWmocccc());
|
||||||
|
}
|
||||||
|
|
||||||
|
wmoIdSelectionDialog = new WmoIdSelectionDialog(
|
||||||
|
shell, this, ttaaiiIds, ccccIds);
|
||||||
|
wmoIdSelectionDialog
|
||||||
|
.setCloseCallback(new ICloseCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dialogClosed(
|
||||||
|
Object returnValue) {
|
||||||
|
lookupAllowed = true;
|
||||||
|
wmoIdSelectionDialog = null;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
wmoIdSelectionDialog.setBlockOnOpen(false);
|
||||||
|
wmoIdSelectionDialog.open();
|
||||||
|
return;
|
||||||
|
} else if (list.size() == 1) {
|
||||||
|
AfosToAwips id = list.get(0);
|
||||||
|
setWmoId(id.getWmottaaii(), id.getWmocccc());
|
||||||
|
} else {
|
||||||
|
setWmoId("", "");
|
||||||
|
}
|
||||||
|
checkEnableEnter();
|
||||||
|
} else {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"Received unhandled WMO Id lookup response from server. Received obj of type ["
|
||||||
|
+ response.getClass() + "], contents["
|
||||||
|
+ response + "]");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (VizException e) {
|
||||||
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
|
"Error occurred looking up WMO IDs", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
lookupAllowed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setRequest(RemoteRetrievalRequest lastRemoteRetrievalRequest) {
|
public void setRequest(RemoteRetrievalRequest lastRemoteRetrievalRequest) {
|
||||||
initialAfosID = null;
|
initialAfosID = null;
|
||||||
if (lastRemoteRetrievalRequest != null)
|
if (lastRemoteRetrievalRequest != null)
|
||||||
initialAfosID = lastRemoteRetrievalRequest.getAfosID();
|
initialAfosID = lastRemoteRetrievalRequest.getAfosID();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkEnableEnter() {
|
||||||
|
boolean enabled = false;
|
||||||
|
if (enterBtn != null && !isDisposed()) {
|
||||||
|
if (ttaaiiTF.getCharCount() > 0 && ccccTF.getCharCount() > 0
|
||||||
|
&& addresseeTF.getCharCount() > 0) {
|
||||||
|
enabled = true;
|
||||||
|
}
|
||||||
|
enterBtn.setEnabled(enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setWmoId(String ttaaii, String cccc) {
|
||||||
|
ttaaiiTF.setText(ttaaii);
|
||||||
|
ccccTF.setText(cccc);
|
||||||
|
checkEnableEnter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -158,7 +158,6 @@ import com.raytheon.viz.texteditor.command.CommandFailedException;
|
||||||
import com.raytheon.viz.texteditor.command.CommandHistory;
|
import com.raytheon.viz.texteditor.command.CommandHistory;
|
||||||
import com.raytheon.viz.texteditor.command.CommandType;
|
import com.raytheon.viz.texteditor.command.CommandType;
|
||||||
import com.raytheon.viz.texteditor.command.ICommand;
|
import com.raytheon.viz.texteditor.command.ICommand;
|
||||||
import com.raytheon.viz.texteditor.dialogs.WarnGenConfirmationDlg.SessionDelegate;
|
|
||||||
import com.raytheon.viz.texteditor.fax.dialogs.FaxMessageDlg;
|
import com.raytheon.viz.texteditor.fax.dialogs.FaxMessageDlg;
|
||||||
import com.raytheon.viz.texteditor.fax.dialogs.LdadFaxSitesDlg;
|
import com.raytheon.viz.texteditor.fax.dialogs.LdadFaxSitesDlg;
|
||||||
import com.raytheon.viz.texteditor.msgs.IAfosBrowserCallback;
|
import com.raytheon.viz.texteditor.msgs.IAfosBrowserCallback;
|
||||||
|
@ -180,6 +179,7 @@ import com.raytheon.viz.texteditor.util.TextEditorUtil;
|
||||||
import com.raytheon.viz.texteditor.util.VtecObject;
|
import com.raytheon.viz.texteditor.util.VtecObject;
|
||||||
import com.raytheon.viz.texteditor.util.VtecUtil;
|
import com.raytheon.viz.texteditor.util.VtecUtil;
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
import com.raytheon.viz.ui.dialogs.ICloseCallback;
|
||||||
import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -288,6 +288,7 @@ import com.raytheon.viz.ui.dialogs.SWTMessageBox;
|
||||||
* 10Sep2012 15103 M.Gamazaychikov DR15103 -do not clear AFOS command from the text box
|
* 10Sep2012 15103 M.Gamazaychikov DR15103 -do not clear AFOS command from the text box
|
||||||
* when obs are updated and refactored executeCommand
|
* when obs are updated and refactored executeCommand
|
||||||
* 10SEP2012 15401 D.Friedman Fix QC problem caused by DR 15340.
|
* 10SEP2012 15401 D.Friedman Fix QC problem caused by DR 15340.
|
||||||
|
* 20SEP2012 1196 rferrel Refactor dialogs to prevent blocking.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author lvenable
|
* @author lvenable
|
||||||
|
@ -1447,14 +1448,21 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
public void widgetSelected(SelectionEvent event) {
|
public void widgetSelected(SelectionEvent event) {
|
||||||
RemoteSiteRequestDlg requestDlg = new RemoteSiteRequestDlg(
|
RemoteSiteRequestDlg requestDlg = new RemoteSiteRequestDlg(
|
||||||
shell);
|
shell);
|
||||||
if (lastRemoteRetrievalRequest != null)
|
if (lastRemoteRetrievalRequest != null) {
|
||||||
requestDlg.setRequest(lastRemoteRetrievalRequest);
|
requestDlg.setRequest(lastRemoteRetrievalRequest);
|
||||||
RemoteRetrievalRequest req = (RemoteRetrievalRequest) requestDlg
|
|
||||||
.open();
|
|
||||||
if (req != null) {
|
|
||||||
lastRemoteRetrievalRequest = req;
|
|
||||||
sendRemoteRetrievalRequest(req);
|
|
||||||
}
|
}
|
||||||
|
requestDlg.setCloseCallback(new ICloseCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dialogClosed(Object returnValue) {
|
||||||
|
RemoteRetrievalRequest req = (RemoteRetrievalRequest) returnValue;
|
||||||
|
if (req != null) {
|
||||||
|
lastRemoteRetrievalRequest = req;
|
||||||
|
sendRemoteRetrievalRequest(req);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
requestDlg.open();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -4400,22 +4408,36 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
WarnGenConfirmationDlg wgcd = new WarnGenConfirmationDlg(shell,
|
WarnGenConfirmationDlg wgcd = new WarnGenConfirmationDlg(shell,
|
||||||
"Problem Detected by QC", qcCheck.getErrorMessage(),
|
"Problem Detected by QC", qcCheck.getErrorMessage(),
|
||||||
"Do you really want to Send?\n", mode);
|
"Do you really want to Send?\n", mode);
|
||||||
wgcd.open(new SessionDelegate() {
|
wgcd.setCloseCallback(new ICloseCallback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dialogDismissed(Object dialogResult) {
|
public void dialogClosed(Object returnValue) {
|
||||||
if (Boolean.TRUE.equals(dialogResult))
|
if (Boolean.TRUE.equals(returnValue))
|
||||||
finishSendProduct1(resend, title, mode,
|
finishSendProduct(resend, title, mode,
|
||||||
productMessage, modeMessage);
|
productMessage, modeMessage);
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
wgcd.open();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finishSendProduct1(resend, title, mode, productMessage, modeMessage);
|
finishSendProduct(resend, title, mode, productMessage, modeMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finishSendProduct1(final boolean resend, String title,
|
/**
|
||||||
|
* This finishes preparing to send a product as part of normal compleation
|
||||||
|
* of sendProduct or as part of the call back when there is a problem with
|
||||||
|
* the WarnGen being sent.
|
||||||
|
*
|
||||||
|
* @param resend
|
||||||
|
* @param title
|
||||||
|
* @param mode
|
||||||
|
* @param productMessage
|
||||||
|
* @param modeMessage
|
||||||
|
*/
|
||||||
|
private void finishSendProduct(final boolean resend, String title,
|
||||||
CAVEMode mode, StringBuilder productMessage,
|
CAVEMode mode, StringBuilder productMessage,
|
||||||
StringBuilder modeMessage) {
|
StringBuilder modeMessage) {
|
||||||
Pattern p = Pattern.compile(".\\%[s].");
|
Pattern p = Pattern.compile(".\\%[s].");
|
||||||
|
@ -4450,16 +4472,26 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
|
|
||||||
WarnGenConfirmationDlg wgcd = new WarnGenConfirmationDlg(shell, title,
|
WarnGenConfirmationDlg wgcd = new WarnGenConfirmationDlg(shell, title,
|
||||||
productMessage.toString(), modeMessage.toString(), mode);
|
productMessage.toString(), modeMessage.toString(), mode);
|
||||||
wgcd.open(new SessionDelegate() {
|
wgcd.setCloseCallback(new ICloseCallback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dialogDismissed(Object dialogResult) {
|
public void dialogClosed(Object returnValue) {
|
||||||
if (Boolean.TRUE.equals(dialogResult))
|
if (Boolean.TRUE.equals(returnValue)) {
|
||||||
finishSendProduct2(resend, result);
|
warngenCloseCallback(resend, result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
wgcd.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finishSendProduct2(boolean resend, boolean result) {
|
/**
|
||||||
|
* This is used by finishedSendProduct as the call back to the warnGen
|
||||||
|
* confirmaiton Dialog.
|
||||||
|
*
|
||||||
|
* @param resend
|
||||||
|
* @param result
|
||||||
|
*/
|
||||||
|
private void warngenCloseCallback(boolean resend, boolean result) {
|
||||||
|
|
||||||
// DR14553 (make upper case in product)
|
// DR14553 (make upper case in product)
|
||||||
String body = textEditor.getText().toUpperCase();
|
String body = textEditor.getText().toUpperCase();
|
||||||
|
@ -5245,9 +5277,9 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
public String getAddressee() {
|
public String getAddressee() {
|
||||||
return addressee;
|
return addressee;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void executeCommand(ICommand command) {
|
public void executeCommand(ICommand command) {
|
||||||
executeCommand(command, false);
|
executeCommand(command, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void executeCommand(ICommand command, boolean isObsUpdated) {
|
public void executeCommand(ICommand command, boolean isObsUpdated) {
|
||||||
|
@ -5355,11 +5387,11 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
w, siteNode);
|
w, siteNode);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* DR15103 - do not clear AFOS command from the text box
|
* DR15103 - do not clear AFOS command from the text box when
|
||||||
* when obs are updated
|
* obs are updated
|
||||||
*/
|
*/
|
||||||
if ( !isObsUpdated ) {
|
if (!isObsUpdated) {
|
||||||
clearAfosCmdTF();
|
clearAfosCmdTF();
|
||||||
}
|
}
|
||||||
clearWmoTF();
|
clearWmoTF();
|
||||||
clearAwipsIdTF();
|
clearAwipsIdTF();
|
||||||
|
@ -6469,11 +6501,10 @@ public class TextEditorDialog extends CaveSWTDialog implements VerifyListener,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
/*
|
/*
|
||||||
* DR15103 - set the flag to 'true' before executing
|
* DR15103 - set the flag to 'true' before executing AFOS command so
|
||||||
* AFOS command so the AFOS command box is not cleared
|
* the AFOS command box is not cleared when obs are updated
|
||||||
* when obs are updated
|
*/
|
||||||
*/
|
|
||||||
executeCommand(command, true);
|
executeCommand(command, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@ package com.raytheon.viz.texteditor.dialogs;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.DisposeEvent;
|
|
||||||
import org.eclipse.swt.events.DisposeListener;
|
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
@ -51,6 +49,8 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* 10Aug2010 2187 cjeanbap Removed warnGenFlag.
|
* 10Aug2010 2187 cjeanbap Removed warnGenFlag.
|
||||||
* 10Nov2011 11552 rferrel returnvalue no longer null
|
* 10Nov2011 11552 rferrel returnvalue no longer null
|
||||||
* 08/20/2012 DR 15340 D. Friedman Use callbacks for closing
|
* 08/20/2012 DR 15340 D. Friedman Use callbacks for closing
|
||||||
|
* 09/24/2012 1196 rferrel Refactored to use close callback
|
||||||
|
* added to CaveSWTDialog.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -69,17 +69,11 @@ public class WarnGenConfirmationDlg extends CaveSWTDialog {
|
||||||
private String IMAGE_TEST = "res/images/twsTest.gif";
|
private String IMAGE_TEST = "res/images/twsTest.gif";
|
||||||
|
|
||||||
private String IMAGE_PRACTICE = "res/images/twsPractice.gif";
|
private String IMAGE_PRACTICE = "res/images/twsPractice.gif";
|
||||||
|
|
||||||
public static interface SessionDelegate {
|
|
||||||
void dialogDismissed(Object result);
|
|
||||||
}
|
|
||||||
|
|
||||||
private SessionDelegate sessionDelegate;
|
|
||||||
|
|
||||||
protected WarnGenConfirmationDlg(Shell parentShell, String title,
|
protected WarnGenConfirmationDlg(Shell parentShell, String title,
|
||||||
String productMessage, String modeMessage, CAVEMode mode) {
|
String productMessage, String modeMessage, CAVEMode mode) {
|
||||||
super(parentShell, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL,
|
super(parentShell, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL, CAVE.NONE
|
||||||
CAVE.NONE | CAVE.DO_NOT_BLOCK);
|
| CAVE.DO_NOT_BLOCK);
|
||||||
|
|
||||||
setText(title);
|
setText(title);
|
||||||
|
|
||||||
|
@ -88,13 +82,6 @@ public class WarnGenConfirmationDlg extends CaveSWTDialog {
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
setReturnValue(Boolean.FALSE);
|
setReturnValue(Boolean.FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void open(SessionDelegate sessionDelegate) {
|
|
||||||
if (sessionDelegate != null && isOpen())
|
|
||||||
throw new RuntimeException(String.format("Dialog \"%s\" already open", getText()));
|
|
||||||
this.sessionDelegate = sessionDelegate;
|
|
||||||
super.open();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void initializeComponents(Shell shell) {
|
protected void initializeComponents(Shell shell) {
|
||||||
|
@ -103,13 +90,6 @@ public class WarnGenConfirmationDlg extends CaveSWTDialog {
|
||||||
createImage(mainComposite);
|
createImage(mainComposite);
|
||||||
createMessageLabel(mainComposite);
|
createMessageLabel(mainComposite);
|
||||||
createButtonRow(mainComposite);
|
createButtonRow(mainComposite);
|
||||||
shell.addDisposeListener(new DisposeListener() {
|
|
||||||
@Override
|
|
||||||
public void widgetDisposed(DisposeEvent e) {
|
|
||||||
if (sessionDelegate != null)
|
|
||||||
sessionDelegate.dialogDismissed(getReturnValue());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createImage(Composite mainComposite) {
|
private void createImage(Composite mainComposite) {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.events.SelectionListener;
|
import org.eclipse.swt.events.SelectionListener;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -43,6 +44,8 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Aug 28, 2009 2924 rjpeter Initial creation.
|
* Aug 28, 2009 2924 rjpeter Initial creation.
|
||||||
|
* Sep 19, 2012 1196 rferrel Scroll bar now displays and limit placed
|
||||||
|
* on the height of the dialog.
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author rjpeter
|
* @author rjpeter
|
||||||
|
@ -124,7 +127,7 @@ public class WmoIdSelectionDialog extends CaveJFACEDialog {
|
||||||
label.setLayoutData(data);
|
label.setLayoutData(data);
|
||||||
|
|
||||||
wmoIdList = new List(top, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
|
wmoIdList = new List(top, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL);
|
||||||
data = new GridData(SWT.BEGINNING, SWT.DEFAULT, true, false);
|
data = new GridData(SWT.CENTER, SWT.FILL, false, true);
|
||||||
wmoIdList.setLayoutData(data);
|
wmoIdList.setLayoutData(data);
|
||||||
|
|
||||||
for (int i = 0; i < ttaaiiIds.size(); i++) {
|
for (int i = 0; i < ttaaiiIds.size(); i++) {
|
||||||
|
@ -160,4 +163,13 @@ public class WmoIdSelectionDialog extends CaveJFACEDialog {
|
||||||
top.layout();
|
top.layout();
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Point getInitialSize() {
|
||||||
|
Point point = super.getInitialSize();
|
||||||
|
if (point.y > 500) {
|
||||||
|
point.y = 500;
|
||||||
|
}
|
||||||
|
return point;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,6 @@ import com.raytheon.uf.common.localization.PathManagerFactory;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
import com.raytheon.uf.common.status.UFStatus;
|
import com.raytheon.uf.common.status.UFStatus;
|
||||||
import com.raytheon.uf.common.status.UFStatus.Priority;
|
import com.raytheon.uf.common.status.UFStatus.Priority;
|
||||||
import com.raytheon.uf.viz.core.status.StatusConstants;
|
|
||||||
import com.raytheon.viz.texteditor.Activator;
|
|
||||||
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -53,6 +51,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
* Date Ticket# Engineer Description
|
* Date Ticket# Engineer Description
|
||||||
* ------------ ---------- ----------- --------------------------
|
* ------------ ---------- ----------- --------------------------
|
||||||
* Jun 30, 2009 mfegan Initial creation
|
* Jun 30, 2009 mfegan Initial creation
|
||||||
|
* Sep 20, 2012 1196 rferrel Added DO_NOT_BLOCK to constructor
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -61,7 +60,9 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class HelpRequestDlg extends CaveSWTDialog implements SelectionListener {
|
public class HelpRequestDlg extends CaveSWTDialog implements SelectionListener {
|
||||||
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(HelpRequestDlg.class);
|
private static final transient IUFStatusHandler statusHandler = UFStatus
|
||||||
|
.getHandler(HelpRequestDlg.class);
|
||||||
|
|
||||||
private static final String DLG_TITLE = "Command Help";
|
private static final String DLG_TITLE = "Command Help";
|
||||||
|
|
||||||
/** the selection list */
|
/** the selection list */
|
||||||
|
@ -104,7 +105,7 @@ public class HelpRequestDlg extends CaveSWTDialog implements SelectionListener {
|
||||||
*/
|
*/
|
||||||
public HelpRequestDlg(Shell parent, EnumHelpTypes type, String token) {
|
public HelpRequestDlg(Shell parent, EnumHelpTypes type, String token) {
|
||||||
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.FILL,
|
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.FILL,
|
||||||
CAVE.PERSPECTIVE_INDEPENDENT);
|
CAVE.PERSPECTIVE_INDEPENDENT | CAVE.DO_NOT_BLOCK);
|
||||||
setText(DLG_TITLE);
|
setText(DLG_TITLE);
|
||||||
|
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
@ -126,6 +127,7 @@ public class HelpRequestDlg extends CaveSWTDialog implements SelectionListener {
|
||||||
shell.setSize(size);
|
shell.setSize(size);
|
||||||
|
|
||||||
createClientArea();
|
createClientArea();
|
||||||
|
// TODO Move to preOpened and limit the height of the dialog.
|
||||||
loadCommandList();
|
loadCommandList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,8 +148,9 @@ public class HelpRequestDlg extends CaveSWTDialog implements SelectionListener {
|
||||||
selections.add(command);
|
selections.add(command);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
statusHandler.handle(Priority.PROBLEM, "Unable to load commands file "
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
+ this.type.getFileName(), e);
|
"Unable to load commands file " + this.type.getFileName(),
|
||||||
|
e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
|
||||||
* 04/22/08 1088 chammack Added dialog event propagation fix
|
* 04/22/08 1088 chammack Added dialog event propagation fix
|
||||||
* 09/13/12 1165 lvenable Update for the initial process
|
* 09/13/12 1165 lvenable Update for the initial process
|
||||||
* of removing the dialog blocking capability.
|
* of removing the dialog blocking capability.
|
||||||
|
* 09/20/12 1196 rferrel Changes to setBlockOnOpen.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -93,6 +94,9 @@ public class CaveJFACEDialog extends Dialog implements
|
||||||
mgr.addPerspectiveDialog(this);
|
mgr.addPerspectiveDialog(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Eventually this will be the default but for now do not know what this
|
||||||
|
// will break.
|
||||||
|
// setBlockOnOpen(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -234,17 +238,21 @@ public class CaveJFACEDialog extends Dialog implements
|
||||||
* @param blockOnOpen
|
* @param blockOnOpen
|
||||||
* Flag indicating if the dialog should block when opened.
|
* Flag indicating if the dialog should block when opened.
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void setBlockOnOpen(boolean blockOnOpen) {
|
public void setBlockOnOpen(boolean blockOnOpen) {
|
||||||
/*
|
// TODO investigate eventually should never allow blocking?
|
||||||
* If the dialog is already opened then just return because setting the
|
// /*
|
||||||
* block won't work. In JFACE the setBlockOnOpen needs to be set before
|
// * If the dialog is already opened then just return because setting
|
||||||
* the open() call, otherwise it is ignored.
|
// the
|
||||||
*/
|
// * block won't work. In JFACE the setBlockOnOpen needs to be set
|
||||||
if (isOpen()) {
|
// before
|
||||||
return;
|
// * the open() call, otherwise it is ignored.
|
||||||
}
|
// */
|
||||||
|
// if (isOpen()) {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
super.setBlockOnOpen(blockOnOpen);
|
super.setBlockOnOpen(blockOnOpen);
|
||||||
blockedOnOpen = blockOnOpen;
|
// blockedOnOpen = blockOnOpen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue