Issue #1492 Made GFE's GhgFontDlg and volume browser's InventoryDlg non-blocking; removed no longer needed "original" classes. No code changes merge conflict?

Change-Id: I28676d7b6d016e3f4f61fcc667c2e1d2af9e53d1

Former-commit-id: 413e9beda4 [formerly fbf6bc87c4] [formerly 5250a0addf] [formerly cabdfd569f [formerly 5250a0addf [formerly 5444e7653c0cf488eb424a16816beb2e6a9335b1]]]
Former-commit-id: cabdfd569f
Former-commit-id: 4ee08f43125d4ae99c00e0d968468d22822b0fc2 [formerly e8d8dcc795]
Former-commit-id: 5187be10ca
This commit is contained in:
Roger Ferrel 2013-01-16 08:42:33 -06:00
parent bda3371aef
commit 9e9eaa3d4a
6 changed files with 44 additions and 854 deletions

View file

@ -113,6 +113,7 @@ import com.raytheon.viz.ui.statusline.StatusStore;
* Changes for non-blocking GhgAlertDlg.
* 03 Dec 2012 1353 rferrel Changes for non-blocking GhgFilterDlg.
* Changes for non-blocking GhgSaveDeleteFilterDlg.
* 16 Jan 2013 1492 rferrel Changes for non-blocking GhgFontDlg.
*
* </pre>
*
@ -134,6 +135,8 @@ public class GhgMonitorDlg extends CaveSWTDialog implements
private GhgFilterDlg filterDlg;
private GhgFontDlg fontDlg;
private GhgSaveDeleteFilterDlg deleteFilterDlg;
private GhgSaveDeleteFilterDlg saveFilterDlg;
@ -1163,14 +1166,22 @@ public class GhgMonitorDlg extends CaveSWTDialog implements
* Display the Font dialog.
*/
private void showFontDialog() {
GhgFontDlg fontDlg = new GhgFontDlg(getShell(),
GhgConfigData.getInstance());
currentFontData = (FontData) fontDlg.open();
if (fontDlg == null) {
fontDlg = new GhgFontDlg(getShell(), GhgConfigData.getInstance());
fontDlg.setCloseCallback(new ICloseCallback() {
// Update the data fonts in the table.
if (currentFontData != null) {
ghgTableComp.updateTableFont(currentFontData);
@Override
public void dialogClosed(Object returnValue) {
if (returnValue instanceof FontData) {
// Update the data fonts in the table.
currentFontData = (FontData) returnValue;
ghgTableComp.updateTableFont(currentFontData);
}
fontDlg = null;
}
});
}
fontDlg.open();
}
/**

View file

@ -27,20 +27,6 @@
name="Volume Browser">
</command>
</extension>
<extension
point="org.eclipse.ui.commands">
<command
id="com.raytheon.viz.volumebrowser.originalVolumeBrowser"
name="Volume Browser">
</command>
</extension>
<extension
point="org.eclipse.ui.handlers">
<handler
class="com.raytheon.viz.volumebrowser.ui.OriginalVolumeBrowserAction"
commandId="com.raytheon.viz.volumebrowser.originalVolumeBrowser">
</handler>
</extension>
<extension
point="org.eclipse.ui.commands">
<command

View file

@ -1,208 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.volumebrowser.ui;
import java.util.ArrayList;
import java.util.Map;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.drawables.IRenderableDisplay;
import com.raytheon.uf.viz.core.map.IMapDescriptor;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.LoadProperties;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.editor.EditorInput;
import com.raytheon.viz.ui.jobs.RequestJob;
import com.raytheon.viz.volumebrowser.Activator;
/**
* Run from the volume browser.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 11/20/2006 brockwoo Initial Creation.
*
* </pre>
*
* @author brockwoo
* @version 1
*/
public class OriginalVolumeBrowserAction extends AbstractHandler {
protected IMapDescriptor theDescriptor;
protected AbstractEditor theEditor;
protected IGraphicsTarget theTarget;
// private String referenceTime;
private RequestJob[] jobList;
// private void createPlot(String refTime) {
// theEditor = (AbstractEditor) VizApp.getCurrentEditor();
// theTarget = theEditor.getActiveDisplayPane().getTarget();
// theDescriptor = (IMapDescriptor) theEditor.getActiveDisplayPane()
// .getRenderableDisplay();
// // referenceTime = refTime;
// Job j = new Job("Add Layer") {
// /*
// * (non-Javadoc)
// *
// * @see
// * org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime
// * .IProgressMonitor)
// */
// @Override
// protected IStatus run(IProgressMonitor aMonitor) {
// aMonitor.beginTask("Loading layer...", 1);
// try {
// AbstractVizResource plot = new PlotResource();
// theDescriptor.getResourceList().add(plot);
// } catch (WrongProjectionException e) {
// return new Status(Status.ERROR, Activator.PLUGIN_ID,
// Status.ERROR, "Projection does not match:: "
// + e.getMessage(), e);
// } catch (VizException e) {
// return new Status(Status.ERROR, Activator.PLUGIN_ID,
// Status.ERROR, "Error loading layer", e);
// }
// aMonitor.done();
// VizApp.runSync(new Runnable() {
// public void run() {
// theEditor.refresh();
// }
// });
// return Status.OK_STATUS;
// }
// };
// j.setRule(new RequestJobSchedulingRule());
// j.schedule();
// }
/*
* (non-Javadoc)
*
* @see
* org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands
* .ExecutionEvent)
*/
@Override
public Object execute(ExecutionEvent arg0) throws ExecutionException {
Shell shell = new Shell(SWT.DIALOG_TRIM); // Win32
VolumeBrowserDialog id = null;
try {
id = new VolumeBrowserDialog(shell, "Volume Browser");
if (id.open() == VolumeBrowserDialog.OK) {
ArrayList<AbstractRequestableResourceData> entries = id
.getLayers();
ArrayList<RequestJob.Request> imageLayers = new ArrayList<RequestJob.Request>();
// Get the editor type for the data to load
Map<String, String> editorConfig = id.getEditorConfig();
// ArrayList<LayerProperty> contourLayers = new
// ArrayList<LayerProperty>();
// ArrayList<AbstractRequestableResourceData> plotLayers = new
// ArrayList<AbstractRequestableResourceData>();
jobList = new RequestJob[entries.size()];
// Sort the various layers into their basic types
for (int i = 0; i < entries.size(); i++) {
AbstractRequestableResourceData entry = entries.get(i);
RequestJob.Request r = new RequestJob.Request();
r.loadProperties = new LoadProperties();
r.resourceData = entry;
imageLayers.add(r);
// if (entry.getDesiredProduct().matches("Image")) {
// imageLayers.add(entry);
// } else if (entry.getDesiredProduct().matches("Contour"))
// {
// contourLayers.add(entry);
// } else if (entry.getDesiredProduct().matches("Plot")) {
// plotLayers.add(entry);
// }
}
// Now, schedule the layers per type with images first, then
// contour, then plot
int layerCounter = 0;
// for (LayerProperty imageLayer : imageLayers) {
// // String script =
// // ScriptCreator.createImageScript(imageLayer);
// jobList[layerCounter] = new RequestJob(imageLayer, 60000);
// jobList[layerCounter].schedule();
// layerCounter++;
// }
AbstractEditor editor;
if (EditorUtil.getActiveEditor() != null
&& EditorUtil.getActiveEditor().getClass().getName()
.equals(editorConfig.get("editor"))) {
editor = ((AbstractEditor) EditorUtil.getActiveEditor());
} else {
EditorInput cont = new EditorInput(
(IRenderableDisplay) Class.forName(
editorConfig.get("editorInput"))
.newInstance());
editor = (AbstractEditor) PlatformUI
.getWorkbench()
.getActiveWorkbenchWindow()
.getActivePage()
.openEditor(cont, editorConfig.get("editor"), false);
}
jobList[layerCounter] = new RequestJob(60000, editor,
imageLayers.toArray(new RequestJob.Request[imageLayers
.size()]));
jobList[layerCounter].schedule();
layerCounter++;
// for (LayerProperty plotLayer : plotLayers) {
// createPlot(plotLayer.getSelectedEntryTime()[0].toString());
// layerCounter++;
// }
}
} catch (Exception e) {
e.printStackTrace();
Status status = new Status(Status.ERROR, Activator.PLUGIN_ID, 0,
"Error occurred during volume browser action.", e);
ErrorDialog.openError(Display.getCurrent().getActiveShell(),
"ERROR", "Error occurred during volume browser action",
status);
throw new ExecutionException(
"Error occurred volume browser action", e);
}
return null;
}
}

View file

@ -1,624 +0,0 @@
/**
* This software was developed and / or modified by Raytheon Company,
* pursuant to Contract DG133W-05-CQ-1067 with the US Government.
*
* U.S. EXPORT CONTROLLED TECHNICAL DATA
* This software product contains export-restricted data whose
* export/transfer/disclosure is restricted by U.S. law. Dissemination
* to non-U.S. persons whether in the United States or abroad requires
* an export license or other authorization.
*
* Contractor Name: Raytheon Company
* Contractor Address: 6825 Pine Street, Suite 340
* Mail Stop B8
* Omaha, NE 68106
* 402.291.0100
*
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
package com.raytheon.viz.volumebrowser.ui;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.ListViewer;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.localization.LocalizationContext;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.common.time.DataTime;
import com.raytheon.uf.viz.core.drawables.ColorMapLoader;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.ResourceType;
import com.raytheon.uf.viz.core.status.StatusConstants;
import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
import com.raytheon.viz.volumebrowser.Activator;
import com.raytheon.viz.volumebrowser.catalog.GridDataCatalog;
import com.raytheon.viz.volumebrowser.catalog.IDataCatalog;
import com.raytheon.viz.volumebrowser.catalog.ObservationDataCatalog;
import com.raytheon.viz.volumebrowser.catalog.RadarDataCatalog;
import com.raytheon.viz.volumebrowser.catalog.RedbookDataCatalog;
import com.raytheon.viz.volumebrowser.catalog.SatelliteDataCatalog;
/**
* Volume browser dialog.
*
* <pre>
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* 11/22/06 brockwoo Initial Creation.
* 12/08/06 103 brockwoo Removed Spinner control and replaced with text boxes
* </pre>
*
* @author brockwoo
* @version 1
*/
public class VolumeBrowserDialog extends CaveJFACEDialog {
private static final transient IUFStatusHandler statusHandler = UFStatus.getHandler(VolumeBrowserDialog.class);
private Shell parentShell = null;
private String title;
private Composite top = null;
private Composite dataSourceSelector = null;
private Composite parameters = null;
private Label parameter1 = null;
private Label parameter2 = null;
private Label parameter3 = null;
private ListViewer lParameter1 = null;
private ListViewer lParameter2 = null;
private ListViewer lParameter3 = null;
private Button addButton = null;
private List currentList = null;
private List currentTimes = null;
private Combo currentProductType = null;
private Combo currentProductColormap = null;
private Text lowerValue = null;
private Text upperValue = null;
private Text interval = null;
private ArrayList<AbstractRequestableResourceData> productEntries;
private String currentProduct;
private Map<String, String> editorConfig = new HashMap<String, String>();
private IDataCatalog currentDataCatalog = null;
private Label wxSelectorLabel = null;
// private String colormap = "";
public VolumeBrowserDialog(Shell parShell, String dialogTitle)
throws VizException {
super(parShell);
parentShell = parShell;
this.title = dialogTitle;
productEntries = new ArrayList<AbstractRequestableResourceData>();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
*/
@Override
protected void buttonPressed(int buttonId) {
if (buttonId == IDialogConstants.OK_ID) {
}
super.buttonPressed(buttonId);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets
* .Shell)
*/
@Override
protected void configureShell(Shell shell) {
super.configureShell(shell);
if (title != null) {
shell.setText(title);
}
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets
* .Composite)
*/
@Override
public Control createDialogArea(Composite parent) {
top = (Composite) super.createDialogArea(parent);
createDataTypeSelector();
createParameterFields();
createAddButton();
createCatalogArea();
createProductDefinition();
return top;
}
/**
* Returns the defined layers to be displayed by CAVE.
*
* @return An array list of layer properties which can be used to create the
* proper EDEX scripts
*/
public ArrayList<AbstractRequestableResourceData> getLayers() {
return productEntries;
}
private void createDataTypeSelector() {
dataSourceSelector = new Composite(top, SWT.NONE);
dataSourceSelector.setLayout(new GridLayout(2, false));
wxSelectorLabel = new Label(dataSourceSelector, SWT.NONE);
wxSelectorLabel.setBounds(new Rectangle(10, 10, 200, 16));
wxSelectorLabel.setText("Data Source:");
ComboViewer testCombo = new ComboViewer(dataSourceSelector,
SWT.READ_ONLY);
testCombo.setContentProvider(new IStructuredContentProvider() {
public void dispose() {
}
public void inputChanged(Viewer viewer, Object oldInput,
Object newInput) {
}
public Object[] getElements(Object inputElement) {
return (IDataCatalog[]) inputElement;
}
});
testCombo.setLabelProvider(new LabelProvider() {
@Override
public Image getImage(Object element) {
return null;
}
@Override
public String getText(Object element) {
return ((IDataCatalog) element).getDataType();
}
});
testCombo.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
StructuredSelection test = (StructuredSelection) event
.getSelection();
IDataCatalog info = (IDataCatalog) test.getFirstElement();
if (currentDataCatalog != null) {
currentDataCatalog.dispose();
}
currentProductType.select(0);
currentProduct = info.getDataType();
currentDataCatalog = info;
currentDataCatalog.initDataCatalog(parameter1, parameter2,
parameter3, lParameter1, lParameter2, lParameter3,
addButton);
parameters.layout();
}
});
IDataCatalog[] testRadar = new IDataCatalog[5];
testRadar[0] = new GridDataCatalog();
testRadar[1] = new ObservationDataCatalog();
testRadar[2] = new RadarDataCatalog();
testRadar[3] = new SatelliteDataCatalog();
testRadar[4] = new RedbookDataCatalog();
testCombo.setInput(testRadar);
testCombo.refresh();
}
private void createParameterFields() {
parameters = new Composite(top, SWT.NONE);
parameters.setLayout(new GridLayout(3, true));
parameter1 = new Label(parameters, SWT.NONE);
parameter1.setBounds(new Rectangle(10, 10, 200, 16));
parameter1.setText("Data Provider 1");
parameter2 = new Label(parameters, SWT.NONE);
parameter2.setBounds(new Rectangle(10, 10, 200, 16));
parameter2.setText("Data Provider 2");
parameter3 = new Label(parameters, SWT.NONE);
parameter3.setBounds(new Rectangle(10, 10, 200, 16));
parameter3.setText("Data Provider 3");
lParameter1 = new ListViewer(parameters, SWT.SINGLE | SWT.BORDER
| SWT.V_SCROLL);
lParameter1.getList().setLayoutData(
new GridData(IDataCatalog.THREEPANEWIDTH,
IDataCatalog.DEFAULTPANEHEIGHT));
lParameter2 = new ListViewer(parameters, SWT.SINGLE | SWT.BORDER
| SWT.V_SCROLL);
lParameter2.getList().setLayoutData(
new GridData(IDataCatalog.THREEPANEWIDTH,
IDataCatalog.DEFAULTPANEHEIGHT));
lParameter3 = new ListViewer(parameters, SWT.SINGLE | SWT.BORDER
| SWT.V_SCROLL);
lParameter3.getList().setLayoutData(
new GridData(IDataCatalog.THREEPANEWIDTH,
IDataCatalog.DEFAULTPANEHEIGHT));
}
private void createAddButton() {
Composite addButtonComposite = new Composite(top, SWT.NONE);
GridLayout positionRight = new GridLayout(1, true);
positionRight.marginLeft = 675;
addButtonComposite.setLayout(positionRight);
addButton = new Button(addButtonComposite, SWT.PUSH);
addButton.setText("Add Product");
addButton.setEnabled(false);
addButton.addMouseListener(new MouseListener() {
public void mouseDoubleClick(MouseEvent e) {
}
public void mouseDown(MouseEvent e) {
}
public void mouseUp(MouseEvent e) {
// productEntries = new ArrayList<LayerProperty>();
// currentList.removeAll();
int selected = currentList.getItemCount();
AbstractRequestableResourceData rd = currentDataCatalog
.getResourceData();
productEntries.add(selected, rd);
// productEntries.get(selected).setColorMap(colormap);
StringBuffer displayName = new StringBuffer();
displayName.append(currentProduct + " - ");
Set<String> parameterKeys = rd.getMetadataMap().keySet();
for (String key : parameterKeys) {
displayName.append(rd.getMetadataMap().get(key)
.getConstraintValue()
+ " ");
}
currentList.add(displayName.toString());
// Set the editor type for the specified data
setEditorType(currentDataCatalog.getEditorConfig());
}
});
}
private void createCatalogArea() {
Composite catalogArea = new Composite(top, SWT.NONE);
catalogArea.setLayout(new GridLayout(2, false));
Label catalogLabel = new Label(catalogArea, SWT.NONE);
catalogLabel.setBounds(new Rectangle(10, 10, 200, 16));
catalogLabel.setText("Selected Product");
Label timeLabel = new Label(catalogArea, SWT.NONE);
timeLabel.setBounds(new Rectangle(10, 10, 200, 16));
timeLabel.setText("Product Times");
currentList = new List(catalogArea, SWT.SINGLE | SWT.BORDER
| SWT.V_SCROLL);
currentList.setLayoutData(new GridData(500, 150));
currentList.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// TODO Auto-generated method stub
}
public void widgetSelected(SelectionEvent e) {
AbstractRequestableResourceData thisEntry = productEntries
.get(currentList.getSelectionIndex());
currentTimes.removeAll();
DataTime[] hours;
try {
hours = thisEntry.getAvailableTimes();
} catch (VizException e1) {
statusHandler.handle(Priority.SIGNIFICANT,
"Error retrieving data times", e1);
return;
}
int counter = 0;
int selectedIndex = 0;
for (DataTime hour : hours) {
// if (thisEntry.getSelectedEntryTime()[0].equals(hour))
// selectedIndex = counter;
currentTimes.add(hour.toString());
counter++;
}
currentTimes.select(selectedIndex);
// TODO
String productType = ""; // thisEntry.getEntryDataType();
currentProductType.removeAll();
if ("Grid".matches(productType)
|| "Satellite".matches(productType)
|| "Radar".matches(productType)) {
currentProductType.add("Image");
}
if ("Grid".matches(productType)) {
currentProductType.add("Contour");
}
if ("Observations".matches(productType)) {
currentProductType.add("Plot");
}
// TODO: fix
// String entryDisplayType = thisEntry.getDesiredProduct()
// .toString();
// for (int i = 0; i < currentProductType.getItems().length;
// i++) {
// if (currentProductType.getItems()[i]
// .matches(entryDisplayType)) {
// currentProductType.select(i);
// break;
// }
// }
String entryColormap = ""; // thisEntry.getColorMap();
for (int i = 0; i < currentProductColormap.getItems().length; i++) {
if (currentProductColormap.getItems()[i]
.matches(entryColormap)) {
currentProductColormap.select(i);
break;
}
}
}
});
currentTimes = new List(catalogArea, SWT.SINGLE | SWT.BORDER
| SWT.V_SCROLL);
currentTimes.setLayoutData(new GridData(200, 150));
currentTimes.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
// TODO Auto-generated method stub
}
public void widgetSelected(SelectionEvent e) {
// TODO: ?
// DataTime[] hours = ((AbstractRequestableResourceData)
// productEntries
// .get(currentList.getSelectionIndex()))
// .getAvailableTimes();
// String selectedHour = hours[currentTimes.getSelectionIndex()]
// .toString();
}
});
}
private void createProductDefinition() {
Composite definitionArea = new Composite(top, SWT.NONE);
definitionArea.setLayout(new GridLayout(4, false));
Label typeDef = new Label(definitionArea, SWT.NONE);
typeDef.setText("Product Type: ");
currentProductType = new Combo(definitionArea, SWT.READ_ONLY
| SWT.BORDER);
ResourceType[] vals = ResourceType.values();
for (ResourceType t : vals) {
currentProductType.add(t.toString());
}
// currentProductType.add("Contour");
// currentProductType.add("Image");
// currentProductType.add("Plot");
currentProductType.select(0);
currentProductType.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
// if (currentList.getSelectionIndex() > -1) {
// String desiredProduct = currentProductType
// .getItem(currentProductType.getSelectionIndex());
// productEntries.get(currentList.getSelectionIndex())
// .setDesiredProduct(
// ResourceType.valueOf(desiredProduct));
// }
}
});
Label colorDef = new Label(definitionArea, SWT.NONE);
colorDef.setText(" Colormap: ");
currentProductColormap = new Combo(definitionArea, SWT.READ_ONLY
| SWT.BORDER);
String[] colormaps = getColormaps();
// colormap = colormaps.length > 0 ? colormaps[0] : " ";
for (String colormap : colormaps) {
currentProductColormap.add(colormap);
}
currentProductColormap.select(0);
currentProductColormap.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
public void widgetSelected(SelectionEvent e) {
if (currentList.getSelectionIndex() > -1) {
// String colorMap = currentProductColormap
// .getItem(currentProductColormap.getSelectionIndex());
// colormap = colorMap;
}
}
});
Composite contourArea = new Composite(top, SWT.NONE);
contourArea.setLayout(new GridLayout(6, false));
Label lowerDef = new Label(contourArea, SWT.NONE);
lowerDef.setText("Bottom Contour: ");
lowerValue = new Text(contourArea, SWT.SINGLE | SWT.BORDER);
lowerValue.setLayoutData(new GridData(100, 20));
lowerValue.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (currentList.getSelectionIndex() > -1) {
String inputValue = lowerValue.getText();
if (inputValue.length() > 0
&& !inputValue.matches("[-\\d]\\d*\\.*\\d*")) {
MessageDialog
.openError(parentShell,
"Invalid Number Specified",
"The input for the lower contour value is not a number. Please correct.");
upperValue.setFocus();
} else {
if (inputValue.length() > 0) {
if (!(inputValue.length() == 1 && inputValue
.startsWith("-"))) {
// double upperNumber = Double
// .parseDouble(inputValue);
}
}
}
}
}
});
Label higherDef = new Label(contourArea, SWT.NONE);
higherDef.setText("Top Contour: ");
upperValue = new Text(contourArea, SWT.SINGLE | SWT.BORDER);
upperValue.setLayoutData(new GridData(100, 20));
upperValue.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (currentList.getSelectionIndex() > -1) {
String inputValue = upperValue.getText();
if (inputValue.length() > 0
&& !inputValue.matches("[-\\d]\\d*\\.*\\d*")) {
MessageDialog
.openError(parentShell,
"Invalid Number Specified",
"The input for the upper contour value is not a number. Please correct.");
upperValue.setFocus();
} else {
if (inputValue.length() > 0) {
if (!(inputValue.length() == 1 && inputValue
.startsWith("-"))) {
// double upperNumber = Double
// .parseDouble(inputValue);
}
}
}
}
}
});
Label intervalText = new Label(contourArea, SWT.NONE);
intervalText.setText("Interval: ");
interval = new Text(contourArea, SWT.SINGLE | SWT.BORDER);
interval.setLayoutData(new GridData(100, 20));
interval.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
if (currentList.getSelectionIndex() > -1) {
String inputValue = interval.getText();
if (inputValue.length() > 0
&& !inputValue.matches("[-\\d]\\d*\\.*\\d*")) {
MessageDialog
.openError(parentShell,
"Invalid Number Specified",
"The input for the contour interval is not a number. Please correct.");
upperValue.setFocus();
} else {
if (inputValue.length() > 0) {
if (!(inputValue.length() == 1 && inputValue
.startsWith("-"))) {
// double upperNumber = Double
// .parseDouble(inputValue);
}
}
}
}
}
});
}
/**
* Get a list of colormaps in the colormap directory
*
* @return the script names
*/
private String[] getColormaps() {
return ColorMapLoader
.listColorMaps(LocalizationContext.LocalizationLevel.UNKNOWN);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.dialogs.Dialog#getInitialSize()
*/
@Override
protected Point getInitialSize() {
return new Point(800, 700);
}
/**
* @return the editorType so
*/
public Map<String, String> getEditorConfig() {
return editorConfig;
}
/**
* @param editorType
* the editorType to set
*/
public void setEditorType(Map<String, String> editorConfig) {
this.editorConfig = editorConfig;
}
} // @jve:decl-index=0:visual-constraint="49,107,731,599"

View file

@ -45,6 +45,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 27, 2009 #2161 lvenable Initial creation
* Jan 16, 2013 #1492 rferrel Made dialog non-blocking.
*
* </pre>
*
@ -78,12 +79,13 @@ public class InventoryDlg extends CaveSWTDialog {
private ProductInventory inventoryMap;
public InventoryDlg(Shell parent, ProductTableData tableData) {
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE);
super(parent, SWT.DIALOG_TRIM | SWT.RESIZE, CAVE.DO_NOT_BLOCK);
setText("Inventory");
this.productName = tableData.getName();
this.time = tableData.getTime();
this.inventoryMap = tableData.getProductInventory();
setReturnValue(this.productName);
}
@Override

View file

@ -24,8 +24,10 @@ import gov.noaa.nws.ncep.ui.nsharp.display.NsharpSkewTPaneDisplay;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.core.commands.ExecutionException;
@ -90,6 +92,7 @@ import com.raytheon.viz.skewt.rscdata.SkewTResourceData;
import com.raytheon.viz.ui.EditorUtil;
import com.raytheon.viz.ui.BundleProductLoader;
import com.raytheon.viz.ui.UiUtil;
import com.raytheon.viz.ui.dialogs.ICloseCallback;
import com.raytheon.viz.ui.editor.AbstractEditor;
import com.raytheon.viz.ui.editor.IMultiPaneEditor;
import com.raytheon.viz.volumebrowser.datacatalog.DataCatalogManager;
@ -114,6 +117,7 @@ import com.vividsolutions.jts.geom.LineString;
* Jun 8, 2009 #2161 lvenable Initial creation
* Mar 27, 2012 #14506 Qinglu Lin For cross section plot along a line of
* latitude, swap xStart and xEnd.
* Jan 16, 2013 #1492 rferrel Changes for non-blocking InventoryDlg.
*
* </pre>
*
@ -190,6 +194,11 @@ public class ProductTableComp extends Composite {
*/
protected ArrayList<ProductTableData> tableDataArray;
/**
* Open Inventory dialogs.
*/
Map<String, InventoryDlg> inventoryDlgMap = new HashMap<String, InventoryDlg>();
/**
* Constructor.
*
@ -751,7 +760,21 @@ public class ProductTableComp extends Composite {
private void displayInventotyForProduct(TableItem tableItem) {
ProductTableData tableData = getProductData(tableItem);
InventoryDlg inventoryDlg = new InventoryDlg(getShell(), tableData);
String name = tableData.getName();
InventoryDlg inventoryDlg = inventoryDlgMap.get(name);
if (inventoryDlg == null) {
inventoryDlg = new InventoryDlg(getShell(), tableData);
inventoryDlgMap.put(name, inventoryDlg);
inventoryDlg.setCloseCallback(new ICloseCallback() {
@Override
public void dialogClosed(Object returnValue) {
if (returnValue instanceof String) {
inventoryDlgMap.remove(returnValue.toString());
}
}
});
}
inventoryDlg.open();
}