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

Former-commit-id: e8eee3ee0c [formerly 9853e8c53b] [formerly e8eee3ee0c [formerly 9853e8c53b] [formerly b4bb93a2c4 [formerly 8a2bda87f34ec3c1129429604de7344732d46017]]]
Former-commit-id: b4bb93a2c4
Former-commit-id: 11c6dd5488 [formerly 3d88dcb2b8]
Former-commit-id: 8caedc3cec
This commit is contained in:
Steve Harris 2012-10-16 11:50:37 -05:00
commit 5e8d96cf17
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 * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 13, 2007 chammack Initial Creation. * Sep 13, 2007 chammack Initial Creation.
* Oct 16, 2012 1229 rferrel Changes for non-blocking HistoryListDlg.
* *
* </pre> * </pre>
* *
@ -46,6 +47,8 @@ import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.HistoryListDlg;
*/ */
public class ShowHistoryList extends AbstractHandler { public class ShowHistoryList extends AbstractHandler {
private HistoryListDlg dialog;
/* /*
* (non-Javadoc) * (non-Javadoc)
* *
@ -55,9 +58,12 @@ public class ShowHistoryList extends AbstractHandler {
*/ */
@Override @Override
public Object execute(ExecutionEvent event) throws ExecutionException { public Object execute(ExecutionEvent event) throws ExecutionException {
HistoryListDlg dlg = new HistoryListDlg( if (dialog == null || dialog.getShell() == null || dialog.isDisposed()) {
HandlerUtil.getActiveShell(event)); dialog = new HistoryListDlg(HandlerUtil.getActiveShell(event));
dlg.open(); dialog.open();
} else {
dialog.bringToTop();
}
return null; return null;
} }

View file

@ -52,7 +52,7 @@ import com.raytheon.viz.ui.dialogs.colordialog.ColorData;
import com.raytheon.viz.ui.dialogs.colordialog.IColorBarAction; 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> * <pre>
* *
@ -60,6 +60,8 @@ import com.raytheon.viz.ui.dialogs.colordialog.IColorBarAction;
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* Sep 13, 2010 mschenke Initial creation * Sep 13, 2010 mschenke Initial creation
* Oct 16, 2012 1229 rferrel Updated to use bringToTop to
* activate existing dialog.
* *
* </pre> * </pre>
* *
@ -92,18 +94,36 @@ public class ImageBlinkDialog extends CaveSWTDialog implements
private static Map<AbstractVizResource<?, ?>, ImageBlinkDialog> dialogMap = new HashMap<AbstractVizResource<?, ?>, ImageBlinkDialog>(); 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, public static synchronized void openDialog(float[] rates, float currRate,
AbstractVizResource<?, ?> resource, ResourceProperties rscProps, AbstractVizResource<?, ?> resource, ResourceProperties rscProps,
D2DMapRenderableDisplay[] displays) { D2DMapRenderableDisplay[] displays) {
ImageBlinkDialog dlg = dialogMap.get(resource); ImageBlinkDialog dlg = dialogMap.get(resource);
if (dlg == null) { if (dlg == null || dlg.getShell() == null || dlg.isDisposed()) {
dlg = new ImageBlinkDialog(new Shell(Display.getCurrent()), rates, dlg = new ImageBlinkDialog(new Shell(Display.getCurrent()), rates,
currRate, resource, rscProps, displays); currRate, resource, rscProps, displays);
dialogMap.put(resource, dlg); 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( public static synchronized void removeDialog(
AbstractVizResource<?, ?> resource) { AbstractVizResource<?, ?> resource) {
dialogMap.remove(resource); dialogMap.remove(resource);
@ -146,10 +166,8 @@ public class ImageBlinkDialog extends CaveSWTDialog implements
@Override @Override
public void widgetDisposed(DisposeEvent e) { public void widgetDisposed(DisposeEvent e) {
removeDialog(resource); removeDialog(resource);
resource resource.unregisterListener((IDisposeListener) ImageBlinkDialog.this);
.unregisterListener((IDisposeListener) ImageBlinkDialog.this); resource.unregisterListener((IPaintListener) ImageBlinkDialog.this);
resource
.unregisterListener((IPaintListener) ImageBlinkDialog.this);
} }
}); });
Composite mainComp = new Composite(shell, SWT.NONE); Composite mainComp = new Composite(shell, SWT.NONE);
@ -186,9 +204,8 @@ public class ImageBlinkDialog extends CaveSWTDialog implements
cbo.add(BlinkToggleAction.NO_BLINK); cbo.add(BlinkToggleAction.NO_BLINK);
cbo cbo.setText(rate == BlinkToggleAction.NO_BLINK_VALUE ? BlinkToggleAction.NO_BLINK
.setText(rate == BlinkToggleAction.NO_BLINK_VALUE ? BlinkToggleAction.NO_BLINK : "" + rate);
: "" + rate);
cbo.addSelectionListener(new SelectionAdapter() { cbo.addSelectionListener(new SelectionAdapter() {
@Override @Override

View file

@ -66,7 +66,8 @@ import com.raytheon.viz.ui.widgets.MenuButton;
* trying to perform a load. * trying to perform a load.
* Jul 31, 2012 #875 rferrel Use MenuButton to organize entries * Jul 31, 2012 #875 rferrel Use MenuButton to organize entries
* in menus. * 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> * </pre>
* *
@ -74,16 +75,16 @@ import com.raytheon.viz.ui.widgets.MenuButton;
* @version 1.0 * @version 1.0
*/ */
public class AlterBundleDlg extends CaveSWTDialog { public class AlterBundleDlg extends CaveSWTDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(AlterBundleDlg.class); .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 { private static class AlterBundleEntry {
@ -110,7 +111,7 @@ public class AlterBundleDlg extends CaveSWTDialog {
private Map<String, MenuButton> menuButtonMap; private Map<String, MenuButton> menuButtonMap;
protected AlterBundleDlg(Bundle bundle, Shell parentShell) { protected AlterBundleDlg(Bundle bundle, Shell parentShell) {
super(parentShell); super(parentShell, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText("Alter Bundle on Loading"); setText("Alter Bundle on Loading");
this.bundle = bundle; 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.LoadSerializedXml;
import com.raytheon.viz.ui.actions.SaveBundle; import com.raytheon.viz.ui.actions.SaveBundle;
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.editor.AbstractEditor; 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 { public class HistoryListDlg extends CaveSWTDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(HistoryListDlg.class); .getHandler(HistoryListDlg.class);
private List dataList; private List dataList;
@ -72,8 +91,10 @@ public class HistoryListDlg extends CaveSWTDialog {
private Button closeBtn; private Button closeBtn;
private AlterBundleDlg alterDlg;
public HistoryListDlg(Shell parent) { 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"); setText("History List");
try { try {
@ -273,7 +294,7 @@ public class HistoryListDlg extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() { closeBtn.addSelectionListener(new SelectionAdapter() {
@Override @Override
public void widgetSelected(SelectionEvent event) { public void widgetSelected(SelectionEvent event) {
shell.dispose(); close();
} }
}); });
} }
@ -284,14 +305,24 @@ public class HistoryListDlg extends CaveSWTDialog {
} }
try { try {
Bundle b = HistoryList.getInstance().getBundle( if (mustCreate(alterDlg)) {
dataList.getSelectionIndex(), false); Bundle b = HistoryList.getInstance().getBundle(
AlterBundleDlg dlg = new AlterBundleDlg(b, getParent()); dataList.getSelectionIndex(), false);
b = (Bundle) dlg.open(); alterDlg = new AlterBundleDlg(b, getShell());
alterDlg.setCloseCallback(new ICloseCallback() {
if (b != null) { @Override
// Load was issued in alterBundleDlg public void dialogClosed(Object returnValue) {
loadAlterBundle(b); if (returnValue instanceof Bundle) {
// Load was issued in alterBundleDlg
Bundle b = (Bundle) returnValue;
loadAlterBundle(b);
}
}
});
alterDlg.open();
} else {
alterDlg.bringToTop();
} }
} catch (VizException e) { } catch (VizException e) {
final String err = "Error altering bundle"; 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.UiUtil;
import com.raytheon.viz.ui.actions.SaveBundle; import com.raytheon.viz.ui.actions.SaveBundle;
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.editor.AbstractEditor; import com.raytheon.viz.ui.editor.AbstractEditor;
/** /**
@ -89,20 +90,22 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
* Dialog for loading or modifying procedures. * Dialog for loading or modifying procedures.
* *
* <pre> * <pre>
* *
* SOFTWARE HISTORY * SOFTWARE HISTORY
* *
* Date Ticket# Engineer Description * Date Ticket# Engineer Description
* ------------ ---------- ----------- -------------------------- * ------------ ---------- ----------- --------------------------
* * Initial Creation
* Oct 16, 2012 1229 rferrel Changes for non-blocking AlterBundleDlg.
*
* </pre> * </pre>
* *
* @author unknown * @author unknown
* @version 1.0 * @version 1.0
*/ */
public class ProcedureDlg extends CaveSWTDialog { public class ProcedureDlg extends CaveSWTDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus private final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(ProcedureDlg.class); .getHandler(ProcedureDlg.class);
public static final String ORIGINAL = "Original Location"; public static final String ORIGINAL = "Original Location";
@ -131,9 +134,9 @@ public class ProcedureDlg extends CaveSWTDialog {
private Button firstNextBtn; 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; private Button loadBtn;
@ -167,6 +170,8 @@ public class ProcedureDlg extends CaveSWTDialog {
private final java.util.List<BundlePair> bundles; private final java.util.List<BundlePair> bundles;
private AlterBundleDlg alterDlg;
private ProcedureDlg(String fileName, Procedure p, Shell parent) { private ProcedureDlg(String fileName, Procedure p, Shell parent) {
// Win32 // Win32
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.INDEPENDENT_SHELL super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.INDEPENDENT_SHELL
@ -877,19 +882,34 @@ public class ProcedureDlg extends CaveSWTDialog {
return; return;
} }
try { try {
BundlePair bp = new BundlePair(); if (mustCreate(alterDlg)) {
bp.name = bundles.get(dataList.getSelectionIndex()).name; final BundlePair bp = new BundlePair();
bp.xml = bundles.get(dataList.getSelectionIndex()).xml; bp.name = bundles.get(dataList.getSelectionIndex()).name;
Bundle b = Bundle.unmarshalBundle(bp.xml, null); bp.xml = bundles.get(dataList.getSelectionIndex()).xml;
Bundle b = Bundle.unmarshalBundle(bp.xml, null);
AlterBundleDlg dlg = new AlterBundleDlg(b, getParent()); alterDlg = new AlterBundleDlg(b, getShell());
b = (Bundle) dlg.open(); alterDlg.setCloseCallback(new ICloseCallback() {
if (b != null) { @Override
// Load was issued in alterBundleDlg public void dialogClosed(Object returnValue) {
bp.xml = b.toXML(); if (returnValue instanceof Bundle) {
saveProcedure(); Bundle b = (Bundle) returnValue;
load(b); 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) { } catch (VizException e) {
final String err = "Error altering bundle"; 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 fileName
* @param p * @param p