Merge branch 'development' of ssh://lightning.omaha.us.ray.com:29418/AWIPS2_baseline into development

Former-commit-id: e8eee3ee0c [formerly 9853e8c53b] [formerly b4bb93a2c4 [formerly 8a2bda87f34ec3c1129429604de7344732d46017]]
Former-commit-id: b4bb93a2c4
Former-commit-id: 3d88dcb2b8
This commit is contained in:
Steve Harris 2012-10-16 11:50:37 -05:00
commit 11c6dd5488
5 changed files with 125 additions and 49 deletions

View file

@ -38,6 +38,7 @@ import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.HistoryListDlg;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 13, 2007 chammack Initial Creation.
* Oct 16, 2012 1229 rferrel Changes for non-blocking HistoryListDlg.
*
* </pre>
*
@ -46,6 +47,8 @@ import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.HistoryListDlg;
*/
public class ShowHistoryList extends AbstractHandler {
private HistoryListDlg dialog;
/*
* (non-Javadoc)
*
@ -55,9 +58,12 @@ public class ShowHistoryList extends AbstractHandler {
*/
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
HistoryListDlg dlg = new HistoryListDlg(
HandlerUtil.getActiveShell(event));
dlg.open();
if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
dialog = new HistoryListDlg(HandlerUtil.getActiveShell(event));
dialog.open();
} else {
dialog.bringToTop();
}
return null;
}

View file

@ -52,7 +52,7 @@ import com.raytheon.viz.ui.dialogs.colordialog.ColorData;
import com.raytheon.viz.ui.dialogs.colordialog.IColorBarAction;
/**
* TODO Add Description
* This is a dialog to determine what range of a rendered display should blink.
*
* <pre>
*
@ -60,6 +60,8 @@ import com.raytheon.viz.ui.dialogs.colordialog.IColorBarAction;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Sep 13, 2010 mschenke Initial creation
* Oct 16, 2012 1229 rferrel Updated to use bringToTop to
* activate existing dialog.
*
* </pre>
*
@ -92,18 +94,36 @@ public class ImageBlinkDialog extends CaveSWTDialog implements
private static Map<AbstractVizResource<?, ?>, ImageBlinkDialog> dialogMap = new HashMap<AbstractVizResource<?, ?>, ImageBlinkDialog>();
/**
* If needed creates an instance of this dialog and associates it with the
* resource and opens the dialog or activates the dialog if one already
* exists for the resource.
*
* @param rates
* @param currRate
* @param resource
* @param rscProps
* @param displays
*/
public static synchronized void openDialog(float[] rates, float currRate,
AbstractVizResource<?, ?> resource, ResourceProperties rscProps,
D2DMapRenderableDisplay[] displays) {
ImageBlinkDialog dlg = dialogMap.get(resource);
if (dlg == null) {
if (dlg == null || dlg.getShell() == null || dlg.isDisposed()) {
dlg = new ImageBlinkDialog(new Shell(Display.getCurrent()), rates,
currRate, resource, rscProps, displays);
dialogMap.put(resource, dlg);
dlg.open();
} else {
dlg.bringToTop();
}
dlg.open();
}
/**
* Removes the dialog associated with the resource.
*
* @param resource
*/
public static synchronized void removeDialog(
AbstractVizResource<?, ?> resource) {
dialogMap.remove(resource);
@ -146,10 +166,8 @@ public class ImageBlinkDialog extends CaveSWTDialog implements
@Override
public void widgetDisposed(DisposeEvent e) {
removeDialog(resource);
resource
.unregisterListener((IDisposeListener) ImageBlinkDialog.this);
resource
.unregisterListener((IPaintListener) ImageBlinkDialog.this);
resource.unregisterListener((IDisposeListener) ImageBlinkDialog.this);
resource.unregisterListener((IPaintListener) ImageBlinkDialog.this);
}
});
Composite mainComp = new Composite(shell, SWT.NONE);
@ -186,9 +204,8 @@ public class ImageBlinkDialog extends CaveSWTDialog implements
cbo.add(BlinkToggleAction.NO_BLINK);
cbo
.setText(rate == BlinkToggleAction.NO_BLINK_VALUE ? BlinkToggleAction.NO_BLINK
: "" + rate);
cbo.setText(rate == BlinkToggleAction.NO_BLINK_VALUE ? BlinkToggleAction.NO_BLINK
: "" + rate);
cbo.addSelectionListener(new SelectionAdapter() {
@Override

View file

@ -66,7 +66,8 @@ import com.raytheon.viz.ui.widgets.MenuButton;
* trying to perform a load.
* Jul 31, 2012 #875 rferrel Use MenuButton to organize entries
* in menus.
* Oct 03, 2012 #1248 rferrel Bundle change listners added.
* Oct 03, 2012 #1248 rferrel Bundle change listeners added.
* Oct 16, 2012 #1229 rferrel Made dialog non-blocking.
*
* </pre>
*
@ -74,16 +75,16 @@ import com.raytheon.viz.ui.widgets.MenuButton;
* @version 1.0
*/
public class AlterBundleDlg extends CaveSWTDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus
private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AlterBundleDlg.class);
private static final String Top_MENU_KEY = "<top>";
private final String Top_MENU_KEY = "<top>";
private static final String MENU_SEP = IAlterBundleContributor.MENU_SEPARATOR;
private final String MENU_SEP = IAlterBundleContributor.MENU_SEPARATOR;
private static final String MI_SEP = IAlterBundleContributor.MI_SEPARATOR;
private final String MI_SEP = IAlterBundleContributor.MI_SEPARATOR;
private static final int MENU_SEP_LEN = MENU_SEP.length();
private final int MENU_SEP_LEN = MENU_SEP.length();
private static class AlterBundleEntry {
@ -110,7 +111,7 @@ public class AlterBundleDlg extends CaveSWTDialog {
private Map<String, MenuButton> menuButtonMap;
protected AlterBundleDlg(Bundle bundle, Shell parentShell) {
super(parentShell);
super(parentShell, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText("Alter Bundle on Loading");
this.bundle = bundle;

View file

@ -50,10 +50,29 @@ import com.raytheon.viz.ui.UiUtil;
import com.raytheon.viz.ui.actions.LoadSerializedXml;
import com.raytheon.viz.ui.actions.SaveBundle;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
* Dialog to get user options on history to display.
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Initial creation
* Oct 16, 2012 1229 rferrel Changes for non-blocking AlterBundleDlg.
* Oct 16, 2012 1229 rferrel Make dialog non-blocking.
*
* </pre>
*
* @author rferrel
* @version 1.0
*/
public class HistoryListDlg extends CaveSWTDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus
private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(HistoryListDlg.class);
private List dataList;
@ -72,8 +91,10 @@ public class HistoryListDlg extends CaveSWTDialog {
private Button closeBtn;
private AlterBundleDlg alterDlg;
public HistoryListDlg(Shell parent) {
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
setText("History List");
try {
@ -273,7 +294,7 @@ public class HistoryListDlg extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
shell.dispose();
close();
}
});
}
@ -284,14 +305,24 @@ public class HistoryListDlg extends CaveSWTDialog {
}
try {
Bundle b = HistoryList.getInstance().getBundle(
dataList.getSelectionIndex(), false);
AlterBundleDlg dlg = new AlterBundleDlg(b, getParent());
b = (Bundle) dlg.open();
if (mustCreate(alterDlg)) {
Bundle b = HistoryList.getInstance().getBundle(
dataList.getSelectionIndex(), false);
alterDlg = new AlterBundleDlg(b, getShell());
alterDlg.setCloseCallback(new ICloseCallback() {
if (b != null) {
// Load was issued in alterBundleDlg
loadAlterBundle(b);
@Override
public void dialogClosed(Object returnValue) {
if (returnValue instanceof Bundle) {
// Load was issued in alterBundleDlg
Bundle b = (Bundle) returnValue;
loadAlterBundle(b);
}
}
});
alterDlg.open();
} else {
alterDlg.bringToTop();
}
} catch (VizException e) {
final String err = "Error altering bundle";

View file

@ -82,6 +82,7 @@ import com.raytheon.viz.ui.HistoryList;
import com.raytheon.viz.ui.UiUtil;
import com.raytheon.viz.ui.actions.SaveBundle;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.editor.AbstractEditor;
/**
@ -89,20 +90,22 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
* Dialog for loading or modifying procedures.
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
*
* Initial Creation
* Oct 16, 2012 1229 rferrel Changes for non-blocking AlterBundleDlg.
*
* </pre>
*
*
* @author unknown
* @version 1.0
*/
public class ProcedureDlg extends CaveSWTDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus
private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ProcedureDlg.class);
public static final String ORIGINAL = "Original Location";
@ -131,9 +134,9 @@ public class ProcedureDlg extends CaveSWTDialog {
private Button firstNextBtn;
private static final String FIRST = "First";
private final String FIRST = "First";
private static final String NEXT = "Next";
private final String NEXT = "Next";
private Button loadBtn;
@ -167,6 +170,8 @@ public class ProcedureDlg extends CaveSWTDialog {
private final java.util.List<BundlePair> bundles;
private AlterBundleDlg alterDlg;
private ProcedureDlg(String fileName, Procedure p, Shell parent) {
// Win32
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.INDEPENDENT_SHELL
@ -877,19 +882,34 @@ public class ProcedureDlg extends CaveSWTDialog {
return;
}
try {
BundlePair bp = new BundlePair();
bp.name = bundles.get(dataList.getSelectionIndex()).name;
bp.xml = bundles.get(dataList.getSelectionIndex()).xml;
Bundle b = Bundle.unmarshalBundle(bp.xml, null);
if (mustCreate(alterDlg)) {
final BundlePair bp = new BundlePair();
bp.name = bundles.get(dataList.getSelectionIndex()).name;
bp.xml = bundles.get(dataList.getSelectionIndex()).xml;
Bundle b = Bundle.unmarshalBundle(bp.xml, null);
AlterBundleDlg dlg = new AlterBundleDlg(b, getParent());
b = (Bundle) dlg.open();
alterDlg = new AlterBundleDlg(b, getShell());
alterDlg.setCloseCallback(new ICloseCallback() {
if (b != null) {
// Load was issued in alterBundleDlg
bp.xml = b.toXML();
saveProcedure();
load(b);
@Override
public void dialogClosed(Object returnValue) {
if (returnValue instanceof Bundle) {
Bundle b = (Bundle) returnValue;
try {
// Load was issued in alterBundleDlg
bp.xml = b.toXML();
saveProcedure();
load(b);
} catch (VizException e) {
final String err = "Error altering bundle";
statusHandler.handle(Priority.PROBLEM, err, e);
}
}
}
});
alterDlg.open();
} else {
alterDlg.bringToTop();
}
} catch (VizException e) {
final String err = "Error altering bundle";
@ -1033,7 +1053,8 @@ public class ProcedureDlg extends CaveSWTDialog {
}
/**
* Get the ProcedureDlg for the given fileName. If the fileName is null or if there is no open dialog, create a new ProcedureDlg.
* Get the ProcedureDlg for the given fileName. If the fileName is null or
* if there is no open dialog, create a new ProcedureDlg.
*
* @param fileName
* @param p