Merge "Issue #1578 Changes for non-blocking GageLegend." into development

Former-commit-id: 09cb9bbc55 [formerly 4915d89fb8] [formerly f0cdda345d [formerly e00c153669b699e2d2dd63fec85b9f891688a5d9]]
Former-commit-id: f0cdda345d
Former-commit-id: 6e9094a27e
This commit is contained in:
Lee Venable 2013-02-07 12:37:22 -06:00 committed by Gerrit Code Review
commit 77bb92dd26
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();