Issue #1578 Changes for non-blocking GageLegend.

Change-Id: I5ae04e8eaf8ebf33bd6a6466925102cfd12f1550

Former-commit-id: a002b9119d [formerly a002b9119d [formerly 7bde6bde475269b700826ce699a2437ea6dc9cad]]
Former-commit-id: 845e05782c
Former-commit-id: 00b4dc560b
This commit is contained in:
Roger Ferrel 2013-02-07 09:05:51 -06:00
parent 7c4114c404
commit c9285492fd
2 changed files with 40 additions and 33 deletions

View file

@ -27,44 +27,49 @@ import com.raytheon.viz.ui.cmenu.AbstractRightClickAction;
* Action for clicking on the contextual menu for color legend.
*
* <pre>
*
*
* SOFTWARE HISTORY
*
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Jul 2, 2008 1194 mpduff Initial creation
* Feb 07, 2013 1578 Changes for non-blocking GageLegend.
*
* </pre>
*
*
* @author mpduff
* @version 1.0
* @version 1.0
*/
public class GageColorLegendAction extends AbstractRightClickAction {
/**
/** Text for the action. */
private final String displayText = "Display Gage Color Legend";
/** The dialog with the legend in it. */
private GageLegend dialog;
/**
* Returns the text for the action.
*
* @see org.eclipse.jface.action.Action#getText()
*/
@Override
public String getText() {
// TODO Auto-generated method stub
final String displayText = "Display Gage Color Legend";
return displayText;
}
/**
/**
* Launches the Gage Color Legend Dialog.
*
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
super.run();
// Display the swt dialog with the legend in it
GageLegend gl = new GageLegend(new Shell());
gl.open();
}
if (dialog == null) {
dialog = new GageLegend(new Shell());
}
dialog.open();
}
}

View file

@ -58,10 +58,17 @@ public class GageLegend extends CaveSWTDialog {
* Shell of the opener
*/
protected GageLegend(Shell parentShell) {
super(parentShell);
super(parentShell, SWT.DIALOG_TRIM, CAVE.DO_NOT_BLOCK);
setText("Gage Legend");
}
/*
* (non-Javadoc)
*
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
*/
@Override
protected void initializeComponents(final Shell shell) {
setReturnValue(false);
@ -72,8 +79,10 @@ public class GageLegend extends CaveSWTDialog {
try {
browser = new Browser(shell, SWT.NONE);
} catch (SWTError e) {
CorePlugin.getDefault().getLog().log(
new Status(Status.ERROR, CorePlugin.PLUGIN_NAME,
CorePlugin
.getDefault()
.getLog()
.log(new Status(Status.ERROR, CorePlugin.PLUGIN_NAME,
"Could not instantiate Browser", e));
return;
}
@ -94,7 +103,7 @@ public class GageLegend extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
shell.dispose();
close();
}
});
}
@ -108,26 +117,19 @@ public class GageLegend extends CaveSWTDialog {
StringBuilder sb = new StringBuilder("<html><head>");
sb.append("<title>Gage Color Legend</title>");
sb.append("</head><body>");
sb
.append("<table align=\"center\" width=\"90\" cellpadding=\"2\" cellspacing=\"0\" border=\"2\">");
sb.append("<table align=\"center\" width=\"90\" cellpadding=\"2\" cellspacing=\"0\" border=\"2\">");
sb.append("<tr>");
sb
.append(" <th align=\"center\" bgcolor=\"#E2E3FE\">Gage Color Legend</td>");
sb.append(" <th align=\"center\" bgcolor=\"#E2E3FE\">Gage Color Legend</td>");
sb.append("</tr><tr>");
sb
.append(" <td align=\"center\" bgcolor=\"#FF0000\">Above Flood Stage</td>");
sb.append(" <td align=\"center\" bgcolor=\"#FF0000\">Above Flood Stage</td>");
sb.append("</tr><tr>");
sb
.append(" <td align=\"center\" bgcolor=\"#FFFF00\">Above Action Stage</td>");
sb.append(" <td align=\"center\" bgcolor=\"#FFFF00\">Above Action Stage</td>");
sb.append("</tr><tr>");
sb
.append(" <td align=\"center\" bgcolor=\"#00FF00\">Below Action Stage</td>");
sb.append(" <td align=\"center\" bgcolor=\"#00FF00\">Below Action Stage</td>");
sb.append("</tr><tr>");
sb
.append(" <td align=\"center\" bgcolor=\"#C0C0C0\">Missing Data</td>");
sb.append(" <td align=\"center\" bgcolor=\"#C0C0C0\">Missing Data</td>");
sb.append("</tr><tr>");
sb
.append(" <td align=\"center\" bgcolor=\"#228B22\">Missing Stage Data</td>");
sb.append(" <td align=\"center\" bgcolor=\"#228B22\">Missing Stage Data</td>");
sb.append("</tr></table></html>");
return sb.toString();