getDisplayDataList() {
+ return displayDataList;
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/FileInfo.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/FileInfo.java
index d656b96d90..de77c5c454 100644
--- a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/FileInfo.java
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/FileInfo.java
@@ -33,7 +33,7 @@ import com.raytheon.uf.common.util.FileUtil;
/**
* This class uses a obtains information on a File in a Job in order to remove
- * from the UI thread.
+ * from the UI thread. Use DirInfo instead.
*
*
*
@@ -48,7 +48,7 @@ import com.raytheon.uf.common.util.FileUtil;
* @author rferrel
* @version 1.0
*/
-
+@Deprecated
public class FileInfo {
private static final SizeJob sizeJob = new FileInfo.SizeJob();
@@ -103,7 +103,7 @@ public class FileInfo {
}
for (IUpdateListener listener : listeners) {
- listener.update(list);
+ // listener.update(list);
}
}
diff --git a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/IArchive.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/IArchiveTotals.java
similarity index 62%
rename from edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/IArchive.java
rename to cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/IArchiveTotals.java
index b356e3c23f..8cc6cfc6a8 100644
--- a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/IArchive.java
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/IArchiveTotals.java
@@ -17,12 +17,14 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
-package com.raytheon.uf.common.archive;
+package com.raytheon.uf.viz.archive.data;
import java.util.List;
+import com.raytheon.uf.common.archive.config.DisplayData;
+
/**
- * Interface that defines a Archive.
+ * Interface for methods for getting totals needed by the ArchiveTableComp.
*
*
*
@@ -30,27 +32,17 @@ import java.util.List;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * May 7, 2013 1966 bgonzale Initial creation
+ * May 29, 2013 1996 rferrel Initial creation
*
*
*
- * @author bgonzale
+ * @author rferrel
* @version 1.0
*/
-public interface IArchive {
-
+public interface IArchiveTotals {
/**
- * Obtain a list archive elements that have expired.
- *
- * @param archiveName
- * - Name of Archive Data.
- * @param categoryNameList
- * - List of categories to check. All categories are checked if
- * the list is null or empty.
- * @return archiveElementList
+ * Update total selected items and sizes.
*/
- List getExpiredElements(String archiveName,
- List categoryNameList);
-
+ public void updateTotals(List displayDatas);
}
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/IUpdateListener.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/IUpdateListener.java
index f8c5cefff7..1916b3c928 100644
--- a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/IUpdateListener.java
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/IUpdateListener.java
@@ -19,6 +19,8 @@
**/
package com.raytheon.uf.viz.archive.data;
+import java.util.List;
+
/**
* A listener to update file/directory information.
*
@@ -35,12 +37,11 @@ package com.raytheon.uf.viz.archive.data;
* @author rferrel
* @version 1.0
*/
-
public interface IUpdateListener {
/**
- * List of files/directories with updated information
+ * Table display state entries with updated information.
*
- * @param fileInfoArray
+ * @param dirInfos
*/
- public void update(FileInfo[] fileInfoArray);
+ public void update(List request);
}
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/SizeJob.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/SizeJob.java
new file mode 100644
index 0000000000..3e4b249ead
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/SizeJob.java
@@ -0,0 +1,206 @@
+package com.raytheon.uf.viz.archive.data;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+
+import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
+import com.raytheon.uf.common.archive.config.DisplayData;
+import com.raytheon.uf.common.util.FileUtil;
+
+/**
+ * Job to determine the size for a directory and its contents on a non-UI
+ * thread.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 13, 2013 rferrel Initial creation
+ *
+ *
+ *
+ * @author rferrel
+ * @version 1.0
+ */
+public class SizeJob extends Job {
+
+ /** The queue for requested sizes. */
+ private final ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue();
+
+ /**
+ * Pending selected entries that still need to have the sizes determined.
+ */
+ private final ConcurrentLinkedQueue selectedQueue = new ConcurrentLinkedQueue();
+
+ /**
+ * Indicates the job should stop computing the size of the current
+ * non-selected entry.
+ */
+ private final AtomicBoolean stopComputeSize = new AtomicBoolean(false);
+
+ /**
+ * The listeners to inform when job is done with an entry.
+ */
+ private final List listeners = new ArrayList();
+
+ /**
+ * Constructor.
+ */
+ public SizeJob() {
+ super("Size Job");
+ setSystem(true);
+ }
+
+ /**
+ * Add a Listener to inform when job has completed information on an entry.
+ *
+ * @param listener
+ */
+ public void addUpdateListener(IUpdateListener listener) {
+ listeners.add(listener);
+ }
+
+ /**
+ * Remove a listener.
+ *
+ * @param listener
+ */
+ public void removeUpdateListener(IUpdateListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Add entry to queue and if pending selected entries add them to the queue
+ * with same start/end times.
+ *
+ * @param fileInfo
+ */
+ public void queue(SizeJobRequest fileInfo) {
+ queue.add(fileInfo);
+
+ if (getState() == Job.NONE) {
+ schedule();
+ }
+ }
+
+ /**
+ * Clear queue but save selected entries still needing sizes.
+ */
+ public void clearQueue() {
+ List pending = new ArrayList();
+
+ // Drain queue queue.removeAll() doesn't work.
+ while (!queue.isEmpty()) {
+ pending.add(queue.remove());
+ }
+
+ if (getState() != NONE) {
+ cancel();
+ }
+
+ // Save selected items that do not have sizes.
+ for (SizeJobRequest dirInfo : pending) {
+ DisplayData displayData = dirInfo.getDisplayData();
+
+ if (displayData.isSelected() && displayData.getSize() < 0L) {
+ if (!selectedQueue.contains(displayData)) {
+ selectedQueue.add(displayData);
+ }
+ }
+ }
+ }
+
+ /**
+ * Requeue pending entries.
+ *
+ * @param startCal
+ * @param endCal
+ */
+ public void requeueSelected(Calendar startCal, Calendar endCal) {
+ if (!selectedQueue.isEmpty()) {
+ DisplayData displayData = selectedQueue.remove();
+ queue(new SizeJobRequest(displayData, startCal, endCal));
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.
+ * IProgressMonitor)
+ */
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (monitor.isCanceled()) {
+ return Status.OK_STATUS;
+ }
+
+ ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
+
+ mainLoop: while (!queue.isEmpty()) {
+ SizeJobRequest dirInfo = queue.remove();
+
+ stopComputeSize.set(false);
+ DisplayData displayData = dirInfo.displayData;
+ Calendar startCal = dirInfo.startCal;
+ Calendar endCal = dirInfo.endCal;
+
+ List files = manager.getDisplayFiles(displayData, startCal,
+ endCal);
+
+ // Size no longer needed.
+ if (!displayData.isSelected() && stopComputeSize.get()) {
+ continue;
+ }
+
+ dirInfo.files.clear();
+ dirInfo.files.addAll(files);
+ long size = 0L;
+ for (File file : dirInfo.files) {
+
+ // Skip when size no longer needed.
+ if (!displayData.isSelected() && stopComputeSize.get()) {
+ continue mainLoop;
+ }
+
+ if (file.isDirectory()) {
+ size += FileUtil.sizeOfDirectory(file);
+ } else {
+ size += file.length();
+ }
+ }
+
+ displayData.setSize(size);
+
+ List list = new ArrayList(1);
+ list.add(dirInfo);
+ for (IUpdateListener listener : listeners) {
+ listener.update(list);
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.jobs.Job#canceling()
+ */
+ @Override
+ protected void canceling() {
+ queue.clear();
+ stopComputeSize.set(true);
+ }
+}
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/SizeJobRequest.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/SizeJobRequest.java
new file mode 100644
index 0000000000..0de53cd1e8
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/data/SizeJobRequest.java
@@ -0,0 +1,82 @@
+/**
+ * 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.uf.viz.archive.data;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+import com.raytheon.uf.common.archive.config.DisplayData;
+
+/**
+ * This class obtains information on a File in a Job in order to remove it from
+ * the UI thread.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * May 15, 2013 1966 rferrel Initial creation
+ *
+ *
+ *
+ * @author rferrel
+ * @version 1.0
+ */
+
+public class SizeJobRequest {
+
+ /** Information from archive configuration manager. */
+ final DisplayData displayData;
+
+ /** Files or directories to obtain information on. */
+ final List files = new ArrayList();
+
+ /** Start time inclusive. */
+ final Calendar startCal;
+
+ /** End time exclusive. */
+ final Calendar endCal;
+
+ /**
+ * Create and entry and place it on the queue.
+ *
+ * @param displayData
+ * @param startCal
+ * @param endCal
+ */
+ public SizeJobRequest(DisplayData displayData, Calendar startCal,
+ Calendar endCal) {
+ this.displayData = displayData;
+ this.startCal = startCal;
+ this.endCal = endCal;
+ }
+
+ /**
+ *
+ * @return displayData
+ */
+ public DisplayData getDisplayData() {
+ return displayData;
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/AbstractArchiveDlg.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/AbstractArchiveDlg.java
new file mode 100644
index 0000000000..c9784a1dd8
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/AbstractArchiveDlg.java
@@ -0,0 +1,523 @@
+/**
+ * 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.uf.viz.archive.ui;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+import com.raytheon.uf.common.archive.config.ArchiveConfig;
+import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
+import com.raytheon.uf.common.archive.config.CategoryConfig;
+import com.raytheon.uf.common.archive.config.DisplayData;
+import com.raytheon.uf.common.util.SizeUtil;
+import com.raytheon.uf.viz.archive.data.ArchiveInfo;
+import com.raytheon.uf.viz.archive.data.CategoryInfo;
+import com.raytheon.uf.viz.archive.data.IArchiveTotals;
+import com.raytheon.uf.viz.archive.data.IUpdateListener;
+import com.raytheon.uf.viz.archive.data.SizeJob;
+import com.raytheon.uf.viz.archive.data.SizeJobRequest;
+import com.raytheon.uf.viz.archive.ui.ArchiveTableComp.TableType;
+import com.raytheon.uf.viz.core.VizApp;
+import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
+
+/**
+ * Abstract base class for Archive dialogs. Contains and manages information
+ * needed for the archive and category selectors and populates the selection
+ * table of display labels elements.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * May 30, 2013 1965 bgonzale Initial creation
+ * Jun 10, 2013 1966 rferrel Change to allow Case Creation to extend.
+ *
+ *
+ *
+ * @author bgonzale
+ * @version 1.0
+ */
+
+public abstract class AbstractArchiveDlg extends CaveSWTDialog implements
+ IArchiveTotals, IUpdateListener {
+
+ /** Table composite that holds the table controls. */
+ private ArchiveTableComp tableComp;
+
+ /** Archive configuration combo box. */
+ private Combo archCfgCbo;
+
+ /** Category combo box. */
+ private Combo categoryCbo;
+
+ /** Information for populating the various table displays. */
+ protected final Map archiveInfoMap = new HashMap();
+
+ /**
+ * Boolean to indicate when DisplayData is created should its selection be
+ * set based on the information in the configuration files.
+ */
+ protected boolean setSelect = false;
+
+ protected TableType tableType;
+
+ protected final SizeJob sizeJob = new SizeJob();
+
+ /**
+ * @param parentShell
+ */
+ public AbstractArchiveDlg(Shell parentShell) {
+ super(parentShell);
+ }
+
+ /**
+ * @param parentShell
+ * @param swtStyle
+ */
+ public AbstractArchiveDlg(Shell parentShell, int swtStyle) {
+ super(parentShell, swtStyle);
+ }
+
+ /**
+ * @param parentShell
+ * @param style
+ * @param caveStyle
+ */
+ public AbstractArchiveDlg(Shell parentShell, int style, int caveStyle) {
+ super(parentShell, style, caveStyle);
+ }
+
+ public List getAllSelected() {
+ List allSelected = new ArrayList();
+ for (String archiveName : archiveInfoMap.keySet()) {
+ ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
+ for (String categoryName : archiveInfo.getCategoryNames()) {
+ CategoryInfo categoryInfo = archiveInfo.get(categoryName);
+ for (DisplayData displayData : categoryInfo
+ .getDisplayDataList()) {
+ if (displayData.isSelected()) {
+ allSelected.add(displayData);
+ }
+ }
+ }
+ }
+ return allSelected;
+ }
+
+ /**
+ * @return the name of the currently selected archive in the dialog; null if
+ * none found
+ */
+ public String getSelectedArchiveName() {
+ int archiveSelection = archCfgCbo.getSelectionIndex();
+ String archiveName = archiveSelection == -1 ? null : archCfgCbo
+ .getItem(archiveSelection);
+ return archiveName;
+ }
+
+ /**
+ * @return the name of the currently selected category in the dialog; null
+ * if none found
+ */
+ public String getSelectedCategoryName() {
+ int categorySelection = categoryCbo.getSelectionIndex();
+ String categoryName = categorySelection == -1 ? null : categoryCbo
+ .getItem(categorySelection);
+ return categoryName;
+ }
+
+ /**
+ * @return the currently selected archive in the dialog; null if none found
+ */
+ public ArchiveConfig getSelectedArchive() {
+ int archiveSelection = archCfgCbo.getSelectionIndex();
+ String archiveName = archiveSelection == -1 ? null : archCfgCbo
+ .getItem(archiveSelection);
+ return ArchiveConfigManager.getInstance().getArchive(archiveName);
+ }
+
+ /**
+ * @return the currently selected category in the dialog; null if none found
+ */
+ public CategoryConfig getSelectedCategory() {
+ String archiveName = getSelectedArchiveName();
+ ArchiveConfig archive = ArchiveConfigManager.getInstance().getArchive(
+ archiveName);
+ if (archive != null) {
+ String categoryName = getSelectedCategoryName();
+ return archive.getCategory(categoryName);
+ }
+ return null;
+ }
+
+ /**
+ * This method is called by the AbstractArchiveDlg to set the size text.
+ *
+ * @param prettyByteSize
+ */
+ protected abstract void setTotalSizeText(String sizeStringText);
+
+ protected abstract void setTotalSelectedItems(int totalSize);
+
+ /**
+ * This method is called by the AbstractArchiveDlg to get the start of the
+ * time frame that bounds the data for the dialog.
+ *
+ * @return GMT Calendar
+ */
+ protected abstract Calendar getStart();
+
+ /**
+ * This method is called by the AbstractArchiveDlg to get the end of the
+ * time frame that bounds the data for the dialog.
+ *
+ * @return GMT Calendar
+ */
+ protected abstract Calendar getEnd();
+
+ /**
+ * Create the Archive and Category combo controls.
+ *
+ * @param comp
+ * Composite to put the controls in.
+ */
+ protected Composite createComboControls(Composite comp) {
+ Composite comboComp = new Composite(comp, SWT.NONE);
+ GridLayout gl = new GridLayout(2, false);
+ GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ comboComp.setLayout(gl);
+ comboComp.setLayoutData(gd);
+
+ Label archCfgLbl = new Label(comboComp, SWT.NONE);
+ archCfgLbl.setText("Archive Config: ");
+
+ gd = new GridData(200, SWT.DEFAULT);
+ archCfgCbo = new Combo(comboComp, SWT.VERTICAL | SWT.DROP_DOWN
+ | SWT.BORDER | SWT.READ_ONLY);
+ archCfgCbo.setLayoutData(gd);
+ archCfgCbo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ archiveComboSelection();
+ }
+ });
+
+ Label catLbl = new Label(comboComp, SWT.NONE);
+ catLbl.setText("Category: ");
+
+ gd = new GridData(200, SWT.DEFAULT);
+ categoryCbo = new Combo(comboComp, SWT.VERTICAL | SWT.DROP_DOWN
+ | SWT.BORDER | SWT.READ_ONLY);
+ categoryCbo.setLayoutData(gd);
+ categoryCbo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ categoryComboSelection();
+ }
+ });
+
+ return comboComp;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
+ */
+ @Override
+ protected void preOpened() {
+ super.preOpened();
+ setCursorBusy(true);
+
+ // Setup to display blank dialog with busy cursor while getting data.
+ Job job = new Job("setup") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ initInfo();
+ VizApp.runAsync(new Runnable() {
+
+ @Override
+ public void run() {
+ populateComboBoxes();
+ updateTableComp();
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+
+ /**
+ * Create the table control.
+ */
+ protected void createTable() {
+ tableComp = new ArchiveTableComp(shell, tableType, this);
+ sizeJob.addUpdateListener(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
+ */
+ @Override
+ protected void disposed() {
+ sizeJob.removeUpdateListener(this);
+ sizeJob.cancel();
+ }
+
+ /**
+ * Update table based on current item selections in archive and category.
+ */
+ protected void updateTableComp() {
+ populateTableComp();
+ }
+
+ /**
+ * Initial population up of the combo boxes.
+ */
+ private void populateComboBoxes() {
+ ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
+ boolean doSelect = false;
+ for (String archiveName : manager.getArchiveDataNamesList()) {
+ archCfgCbo.add(archiveName);
+ doSelect = true;
+ }
+
+ if (doSelect) {
+ archCfgCbo.select(0);
+ archiveComboSelection();
+ }
+ }
+
+ /**
+ * Method invoked when archive combo selection is changed.
+ */
+ protected void archiveComboSelection() {
+ populateCategoryCbo();
+ }
+
+ /**
+ * Populate the category combo based on the archive name and populate the
+ * table.
+ *
+ * @param archiveName
+ */
+ private void populateCategoryCbo() {
+ String archiveName = getSelectedArchiveName();
+ ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
+ categoryCbo.removeAll();
+ for (String categoryName : manager.getCategoryNames(archiveName)) {
+ categoryCbo.add(categoryName);
+ }
+ categoryCbo.select(0);
+ categoryComboSelection();
+ }
+
+ /**
+ * Method invoked when the category combo selection is changed.
+ */
+ protected void categoryComboSelection() {
+ populateTableComp();
+ }
+
+ /**
+ * Get information from manager for populating combo boxes and set up to get
+ * selected entries sizes. Intended for use on a non-UI thread.
+ */
+ private void initInfo() {
+ ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
+ manager.reset();
+ Calendar startCal = getStart();
+ Calendar endCal = getEnd();
+ String[] archiveNames = manager.getArchiveDataNamesList();
+ for (String archiveName : archiveNames) {
+ ArchiveInfo archiveInfo = new ArchiveInfo();
+ archiveInfoMap.put(archiveName, archiveInfo);
+ String[] categoryNames = manager.getCategoryNames(manager
+ .getArchive(archiveName));
+ for (String categoryName : categoryNames) {
+ List displayDatas = manager.getDisplayData(
+ archiveName, categoryName, setSelect);
+ CategoryInfo categoryInfo = new CategoryInfo(archiveName,
+ categoryName, displayDatas);
+ archiveInfo.add(categoryInfo);
+ for (DisplayData displayData : displayDatas) {
+ if (displayData.isSelected()) {
+ sizeJob.queue(new SizeJobRequest(displayData, startCal,
+ endCal));
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Populate the table based on the currently selected archive, category and
+ * adjust sizes on the display table.
+ */
+ protected void populateTableComp() {
+ String archiveName = getSelectedArchiveName();
+ String categoryName = getSelectedCategoryName();
+ Calendar startCal = getStart();
+ Calendar endCal = getEnd();
+
+ setCursorBusy(true);
+ sizeJob.clearQueue();
+
+ ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
+ CategoryInfo categoryInfo = archiveInfo.get(categoryName);
+
+ for (DisplayData displayData : categoryInfo.getDisplayDataList()) {
+ sizeJob.queue(new SizeJobRequest(displayData, startCal, endCal));
+ }
+ sizeJob.requeueSelected(startCal, endCal);
+
+ tableComp.populateTable(categoryInfo.getDisplayDataList());
+ setCursorBusy(false);
+ }
+
+ /**
+ * Set the shells cursor to the desire state.
+ *
+ * @param state
+ */
+ protected void setCursorBusy(boolean state) {
+ Cursor cursor = null;
+ if (state) {
+ cursor = shell.getDisplay().getSystemCursor(SWT.CURSOR_WAIT);
+ }
+ shell.setCursor(cursor);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.viz.archive.data.IArchiveTotals#updateTotals(java.util
+ * .List)
+ */
+ @Override
+ public void updateTotals(List displayDatas) {
+ long totalSize = 0;
+ int totalSelected = 0;
+
+ for (String archiveName : archiveInfoMap.keySet()) {
+ ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
+ for (String categoryName : archiveInfo.getCategoryNames()) {
+ CategoryInfo categoryInfo = archiveInfo.get(categoryName);
+ for (DisplayData displayData : categoryInfo
+ .getDisplayDataList()) {
+ if (displayData.isSelected()) {
+ ++totalSelected;
+ if (totalSize != DisplayData.UNKNOWN_SIZE) {
+ long size = displayData.getSize();
+ if (size >= 0) {
+ totalSize += size;
+ } else {
+ totalSize = DisplayData.UNKNOWN_SIZE;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ String sizeMsg = null;
+ if (totalSize == DisplayData.UNKNOWN_SIZE) {
+ sizeMsg = DisplayData.UNKNOWN_SIZE_LABEL;
+ } else {
+ sizeMsg = SizeUtil.prettyByteSize(totalSize);
+ }
+
+ setTotalSizeText(sizeMsg);
+ setTotalSelectedItems(totalSelected);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.viz.archive.data.IUpdateListener#update(java.util.List)
+ */
+ @Override
+ public void update(List dirInfos) {
+ final List displayDatas = new ArrayList(
+ dirInfos.size());
+ for (SizeJobRequest request : dirInfos) {
+ displayDatas.add(request.getDisplayData());
+ }
+
+ VizApp.runAsync(new Runnable() {
+
+ @Override
+ public void run() {
+ tableComp.updateSize(displayDatas);
+ updateTotals(null);
+ }
+ });
+ }
+
+ /**
+ * Reset modification flag.
+ */
+ protected void clearModified() {
+ tableComp.clearModified();
+ }
+
+ /**
+ * Add listener to inform when modification flag is set.
+ *
+ * @param iModifyListener
+ */
+ protected void addModifiedListener(IModifyListener iModifyListener) {
+ tableComp.addModifiedListener(iModifyListener);
+ }
+
+ /**
+ * Remove modification listener.
+ *
+ * @param iModifyListener
+ */
+ protected void removeModifiedListener(IModifyListener iModifyListener) {
+ tableComp.removeModifiedListener(iModifyListener);
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveRetentionDlg.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveRetentionDlg.java
index 8d145ed743..4f4836f55a 100644
--- a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveRetentionDlg.java
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveRetentionDlg.java
@@ -19,9 +19,14 @@
**/
package com.raytheon.uf.viz.archive.ui;
+import java.util.Calendar;
+import java.util.List;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.ShellAdapter;
+import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -29,11 +34,15 @@ import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
+import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
+import com.raytheon.uf.common.archive.config.DisplayData;
+import com.raytheon.uf.viz.archive.data.IArchiveTotals;
import com.raytheon.uf.viz.archive.ui.ArchiveTableComp.TableType;
-import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
+import com.raytheon.uf.viz.core.VizApp;
/**
* Archive retention dialog.
@@ -45,22 +54,34 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 23, 2013 #1964 lvenable Initial creation
+ * May 31, 2013 #1965 bgonzale Initial work for updating retention configurations.
+ * Jun 10, 2013 #1966 rferrel Implemented hooks to get display and save to work.
*
*
*
* @author lvenable
* @version 1.0
*/
-public class ArchiveRetentionDlg extends CaveSWTDialog {
+public class ArchiveRetentionDlg extends AbstractArchiveDlg implements
+ IArchiveTotals, IModifyListener {
- /** Table composite that holds the table controls. */
- private ArchiveTableComp tableComp;
+ /** Current Archive/Category selection's minimum retention hours. */
+ private RetentionHours minRetention;
- /** Archive config combo box. */
- private Combo archCfgCbo;
+ /** Current Archive/Category selection's extended retention hours. */
+ private RetentionHours extRetention;
- /** Category combo box. */
- private Combo categoryCbo;
+ /** Displays the total number of selected items for all tables. */
+ private Label totalSelectedItems;
+
+ /** Displays the total size of selected items. */
+ private Label totalSizeLbl;
+
+ /** Performs save action button. */
+ private Button saveBtn;
+
+ /** Flag set when user wants to close with unsaved modifications. */
+ boolean closeFlag = false;
/**
* Constructor.
@@ -71,18 +92,31 @@ public class ArchiveRetentionDlg extends CaveSWTDialog {
public ArchiveRetentionDlg(Shell parentShell) {
super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.DO_NOT_BLOCK
| CAVE.MODE_INDEPENDENT | CAVE.INDEPENDENT_SHELL);
+ this.setSelect = true;
+ this.tableType = TableType.Retention;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
+ */
@Override
protected Layout constructShellLayout() {
// Create the main layout for the shell.
GridLayout mainLayout = new GridLayout(1, false);
mainLayout.marginHeight = 2;
mainLayout.marginWidth = 2;
-
return mainLayout;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
+ * .eclipse.swt.widgets.Shell)
+ */
@Override
protected void initializeComponents(Shell shell) {
setText("Archive Retention");
@@ -92,6 +126,7 @@ public class ArchiveRetentionDlg extends CaveSWTDialog {
gl.marginWidth = 0;
gl.horizontalSpacing = 0;
mainComp.setLayout(gl);
+ ArchiveConfigManager.getInstance().reset();
init();
}
@@ -101,12 +136,8 @@ public class ArchiveRetentionDlg extends CaveSWTDialog {
*/
private void init() {
createRetentionControls();
- createTable();
- addSeparator(shell, SWT.HORIZONTAL);
+ GuiUtil.addSeparator(shell, SWT.HORIZONTAL);
createBottomActionButtons();
-
- // TODO : Remove this when functionality is implemented
- populateComboBoxes();
}
/**
@@ -114,7 +145,7 @@ public class ArchiveRetentionDlg extends CaveSWTDialog {
*/
private void createRetentionControls() {
Composite retentionComp = new Composite(shell, SWT.NONE);
- GridLayout gl = new GridLayout(5, false);
+ GridLayout gl = new GridLayout(2, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
retentionComp.setLayout(gl);
retentionComp.setLayoutData(gd);
@@ -122,103 +153,71 @@ public class ArchiveRetentionDlg extends CaveSWTDialog {
/*
* Top row of controls.
*/
- Label archCfgLbl = new Label(retentionComp, SWT.NONE);
- archCfgLbl.setText("Archive Config: ");
+ createComboControls(retentionComp);
+ createTable();
- gd = new GridData(200, SWT.DEFAULT);
- archCfgCbo = new Combo(retentionComp, SWT.VERTICAL | SWT.DROP_DOWN
- | SWT.BORDER | SWT.READ_ONLY);
- archCfgCbo.setLayoutData(gd);
- archCfgCbo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- /*
- * TODO - add code to update the category combo box
- */
- }
- });
+ // composite for retention time selection
+ Composite selectionComp = new Composite(retentionComp, SWT.NONE);
+ selectionComp.setLayout(new GridLayout(3, true));
+ selectionComp.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true,
+ false));
gd = new GridData();
gd.horizontalIndent = 20;
- Label minRetentionLbl = new Label(retentionComp, SWT.NONE);
+ Label minRetentionLbl = new Label(selectionComp, SWT.NONE);
minRetentionLbl.setText("Minimum Retention: ");
minRetentionLbl.setLayoutData(gd);
gd = new GridData(60, SWT.DEFAULT);
- final Spinner minRetentionSpnr = new Spinner(retentionComp, SWT.BORDER);
+ Spinner minRetentionSpnr = new Spinner(selectionComp, SWT.BORDER);
minRetentionSpnr.setIncrement(1);
minRetentionSpnr.setPageIncrement(5);
minRetentionSpnr.setMaximum(Integer.MAX_VALUE);
minRetentionSpnr.setMinimum(1);
minRetentionSpnr.setLayoutData(gd);
- final Combo minRetentionCbo = new Combo(retentionComp, SWT.VERTICAL
+ Combo minRetentionCbo = new Combo(selectionComp, SWT.VERTICAL
| SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
- minRetentionCbo.addSelectionListener(new SelectionAdapter() {
+ minRetention = new RetentionHours(1, minRetentionSpnr, minRetentionCbo) {
+
@Override
- public void widgetSelected(SelectionEvent e) {
- handleRetentionSelection(minRetentionCbo, minRetentionSpnr);
+ protected boolean handleTimeSelection() {
+ boolean state = super.handleTimeSelection();
+ getSelectedArchive().setRetentionHours(getHours());
+ return state;
}
- });
- minRetentionCbo.add("Hours");
- minRetentionCbo.add("Days");
- minRetentionCbo.select(0);
- minRetentionCbo.setData(minRetentionCbo.getItem(minRetentionCbo
- .getSelectionIndex()));
+ };
+ minRetention.addModifyListener(this);
/*
* Bottom row of controls.
*/
- Label catLbl = new Label(retentionComp, SWT.NONE);
- catLbl.setText("Category: ");
-
- gd = new GridData(200, SWT.DEFAULT);
- categoryCbo = new Combo(retentionComp, SWT.VERTICAL | SWT.DROP_DOWN
- | SWT.BORDER | SWT.READ_ONLY);
- categoryCbo.setLayoutData(gd);
- categoryCbo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- /*
- * TODO - add code to update the information in the table
- */
- }
- });
-
gd = new GridData();
gd.horizontalIndent = 20;
- Label extRetentionLbl = new Label(retentionComp, SWT.NONE);
+ Label extRetentionLbl = new Label(selectionComp, SWT.NONE);
extRetentionLbl.setText("Extended Retention: ");
extRetentionLbl.setLayoutData(gd);
gd = new GridData(60, SWT.DEFAULT);
- final Spinner extRetentionSpnr = new Spinner(retentionComp, SWT.BORDER);
+ Spinner extRetentionSpnr = new Spinner(selectionComp, SWT.BORDER);
extRetentionSpnr.setIncrement(1);
extRetentionSpnr.setPageIncrement(5);
extRetentionSpnr.setMaximum(Integer.MAX_VALUE);
- extRetentionSpnr.setMinimum(1);
+ extRetentionSpnr.setMinimum(0);
extRetentionSpnr.setLayoutData(gd);
- final Combo extRetentionCbo = new Combo(retentionComp, SWT.VERTICAL
+ Combo extRetentionCbo = new Combo(selectionComp, SWT.VERTICAL
| SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
- extRetentionCbo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleRetentionSelection(extRetentionCbo, extRetentionSpnr);
- }
- });
- extRetentionCbo.add("Hours");
- extRetentionCbo.add("Days");
- extRetentionCbo.select(0);
- extRetentionCbo.setData(extRetentionCbo.getItem(extRetentionCbo
- .getSelectionIndex()));
- }
+ extRetention = new RetentionHours(1, extRetentionSpnr, extRetentionCbo) {
- /**
- * Create the table control.
- */
- private void createTable() {
- tableComp = new ArchiveTableComp(shell, TableType.Case);
+ @Override
+ protected boolean handleTimeSelection() {
+ boolean state = super.handleTimeSelection();
+ getSelectedCategory().setRetentionHours(getHours());
+ return state;
+ }
+ };
+ extRetention.addModifyListener(this);
}
/**
@@ -227,28 +226,36 @@ public class ArchiveRetentionDlg extends CaveSWTDialog {
private void createBottomActionButtons() {
Composite actionControlComp = new Composite(shell, SWT.NONE);
- GridLayout gl = new GridLayout(3, false);
+ GridLayout gl = new GridLayout(2, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
actionControlComp.setLayout(gl);
actionControlComp.setLayoutData(gd);
- Button calcSizeBtn = new Button(actionControlComp, SWT.PUSH);
- calcSizeBtn.setText(" Calculate Sizes ");
- calcSizeBtn.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- // TODO : add calculate size functionality
- }
- });
+ // TODO - For the future ?
+ // Button calcSizeBtn = new Button(actionControlComp, SWT.PUSH);
+ // calcSizeBtn.setText(" Calculate Sizes ");
+ // calcSizeBtn.addSelectionListener(new SelectionAdapter() {
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ // // TODO : add calculate size functionality
+ // // With Roger's automated size calculation code, this doesn't
+ // // seem relevant unless it is for calculating compressed size
+ // }
+ // });
- Button saveBtn = new Button(actionControlComp, SWT.PUSH);
- saveBtn.setText(" Save... ");
+ saveBtn = new Button(actionControlComp, SWT.PUSH);
+ saveBtn.setText(" Save ");
saveBtn.addSelectionListener(new SelectionAdapter() {
@Override
- public void widgetSelected(SelectionEvent e) {
- // TODO : add save functionality
+ public void widgetSelected(SelectionEvent selectionEvent) {
+ ArchiveConfigManager manager = ArchiveConfigManager
+ .getInstance();
+ manager.save();
+ saveBtn.setEnabled(false);
+ clearModified();
}
});
+ saveBtn.setEnabled(false);
gd = new GridData(SWT.RIGHT, SWT.DEFAULT, true, false);
Button closeBtn = new Button(actionControlComp, SWT.PUSH);
@@ -257,93 +264,198 @@ public class ArchiveRetentionDlg extends CaveSWTDialog {
closeBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- close();
+ if (verifyClose()) {
+ close();
+ } else {
+ e.doit = false;
+ }
}
});
}
/**
- * Handle the retention selection for both minimum and extended retention.
+ * When unsaved modifications this asks the user to verify the close.
*
- * @param comboBox
- * Retention combo box.
- * @param spinner
- * Retention spinner.
+ * @return true when okay to close.
*/
- private void handleRetentionSelection(Combo comboBox, Spinner spinner) {
- // If the selection didn't change then just return.
- if (comboBox.getItem(comboBox.getSelectionIndex()).equals(
- (String) comboBox.getData())) {
- return;
+ private boolean verifyClose() {
+ boolean state = true;
+ if (isModified()) {
+ MessageBox box = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK
+ | SWT.CANCEL);
+ box.setText("Close Retention");
+ box.setMessage("Unsave changes.\nSelect OK to continue.");
+ state = box.open() == SWT.OK;
}
+ closeFlag = state;
+ return state;
+ }
- int time = 0;
-
- if (comboBox.getItem(comboBox.getSelectionIndex()).equals("Hours")) {
- time = convertTime(true, spinner.getSelection());
- } else {
- time = convertTime(false, spinner.getSelection());
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#setTotalSizeText(java
+ * .lang.String)
+ */
+ @Override
+ protected void setTotalSizeText(String sizeStringText) {
+ if (totalSizeLbl != null && !totalSizeLbl.isDisposed()) {
+ totalSizeLbl.setText(sizeStringText);
}
+ }
- spinner.setSelection(time);
- comboBox.setData(comboBox.getItem(comboBox.getSelectionIndex()));
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#setTotalSelectedItems
+ * (int)
+ */
+ @Override
+ protected void setTotalSelectedItems(int totalSize) {
+ if (totalSelectedItems != null && !totalSelectedItems.isDisposed()) {
+ totalSelectedItems.setText("" + totalSize);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getStart()
+ */
+ @Override
+ protected Calendar getStart() {
+ // display all elements so no start bound
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getEnd()
+ */
+ @Override
+ protected Calendar getEnd() {
+ // display all elements so no end bound
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#updateTotals(java.util
+ * .List)
+ */
+ @Override
+ public void updateTotals(List displayDatas) {
+ super.updateTotals(displayDatas);
+ if (displayDatas != null) {
+ for (DisplayData displayData : displayDatas) {
+ displayData.updateCategory();
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#archiveComboSelection()
+ */
+ @Override
+ protected void archiveComboSelection() {
+ super.archiveComboSelection();
+ minRetention.setHours(getSelectedArchive().getRetentionHours());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#categoryComboSelection
+ * ()
+ */
+ @Override
+ protected void categoryComboSelection() {
+ super.categoryComboSelection();
+ extRetention.setHours(getSelectedCategory().getRetentionHours());
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.uf.viz.archive.ui.IModifyListener#modified()
+ */
+ @Override
+ public void modified() {
+ saveBtn.setEnabled(true);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#clearModified()
+ */
+ @Override
+ public void clearModified() {
+ super.clearModified();
+ minRetention.clearModified();
+ extRetention.clearModified();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#preOpened()
+ */
+ @Override
+ protected void preOpened() {
+ super.preOpened();
+ addModifiedListener(this);
+ shell.addShellListener(new ShellAdapter() {
+
+ @Override
+ public void shellClosed(ShellEvent e) {
+ if (closeFlag || !isModified()) {
+ return;
+ }
+
+ e.doit = false;
+ VizApp.runAsync(new Runnable() {
+
+ @Override
+ public void run() {
+ if (verifyClose()) {
+ close();
+ }
+ }
+ });
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#disposed()
+ */
+ @Override
+ protected void disposed() {
+ minRetention.removeModifyListener(this);
+ extRetention.removeModifyListener(this);
+ removeModifiedListener(this);
+ super.disposed();
}
/**
- * Covert time from either hours to days or days to hours.
+ * Indicate unsaved user changes.
*
- * @param daysToHours
- * Flag indicating how to convert the time.
- * @param time
- * Time to be converted.
- * @return The converted time.
+ * @return modified
*/
- private int convertTime(boolean daysToHours, int time) {
- int convertedTime = 0;
-
- if (daysToHours) {
- convertedTime = time * 24;
- } else {
- convertedTime = time / 24;
- }
-
- return convertedTime;
- }
-
- /**
- * Add a separator line to the provided container.
- *
- * @param container
- * Composite.
- * @param orientation
- * Vertical or horizontal orientation.
- */
- private void addSeparator(Composite container, int orientation) {
- // Separator label
- GridData gd;
-
- if (orientation == SWT.HORIZONTAL) {
- gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
- } else {
- gd = new GridData(SWT.DEFAULT, SWT.FILL, false, true);
- }
-
- Label sepLbl = new Label(container, SWT.SEPARATOR | orientation);
- sepLbl.setLayoutData(gd);
- }
-
- /********************************************************
- * TEST METHODS - to be removed when functionality is implemented.
- * ******************************************************
- */
- private void populateComboBoxes() {
- archCfgCbo.add("Raw");
- archCfgCbo.add("Processed");
- archCfgCbo.select(0);
-
- categoryCbo.add("Radar");
- categoryCbo.add("Point");
- categoryCbo.add("Satellite");
- categoryCbo.select(0);
+ private boolean isModified() {
+ return (saveBtn != null) && !saveBtn.isDisposed()
+ && saveBtn.isEnabled();
}
}
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveTableComp.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveTableComp.java
index 4e72f90b67..8923e72b3f 100644
--- a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveTableComp.java
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/ArchiveTableComp.java
@@ -19,6 +19,11 @@
**/
package com.raytheon.uf.viz.archive.ui;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.commons.lang.ArrayUtils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
@@ -28,13 +33,19 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
+import com.raytheon.uf.common.archive.config.DisplayData;
+import com.raytheon.uf.common.util.SizeUtil;
+import com.raytheon.uf.viz.archive.data.IArchiveTotals;
+
/**
* Archive table composite that contains the SWT table.
*
@@ -53,6 +64,12 @@ import org.eclipse.swt.widgets.TableItem;
*/
public class ArchiveTableComp extends Composite {
+ /** Column to display label information. */
+ private final int LABEL_COL_INDEX = 0;
+
+ /** Column to display size information,. */
+ private final int SIZE_COL_INDEX = 1;
+
/** Table control. */
private Table table;
@@ -71,7 +88,23 @@ public class ArchiveTableComp extends Composite {
};
/** Current table type. */
- private TableType tableType = TableType.Retention;
+ private final TableType type;
+
+ /** Allows the parent dialog log to update other total displays. */
+ private final IArchiveTotals iArchiveTotals;
+
+ /** Data for the currently display table */
+ private DisplayData[] tableData;
+
+ /**
+ * Modification state set to true only when user performs a modification.
+ */
+ private boolean modifiedState = false;
+
+ /**
+ * Listeners to inform when user changes the modification state.
+ */
+ private final List modifiedListeners = new CopyOnWriteArrayList();
/**
* Constructor.
@@ -81,10 +114,12 @@ public class ArchiveTableComp extends Composite {
* @param type
* Table type.
*/
- public ArchiveTableComp(Composite parent, TableType type) {
+ public ArchiveTableComp(Composite parent, TableType type,
+ IArchiveTotals iTotalSelectedSize) {
super(parent, 0);
- tableType = type;
+ this.type = type;
+ this.iArchiveTotals = iTotalSelectedSize;
init();
}
@@ -101,43 +136,50 @@ public class ArchiveTableComp extends Composite {
this.setLayoutData(gd);
createTable();
- createTableLabels();
- updateSelectionLabel();
+ if (type != TableType.Retention) {
+ createTableLabels();
+ }
}
/**
* Create the table control.
*/
private void createTable() {
+ GridData gd = null;
+
table = new Table(this, SWT.CHECK | SWT.BORDER | SWT.V_SCROLL
- | SWT.H_SCROLL | SWT.MULTI);
- GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
+ | SWT.H_SCROLL | SWT.MULTI | SWT.VIRTUAL);
+ gd = new GridData(SWT.FILL, SWT.DEFAULT, true, true);
gd.widthHint = 730;
gd.heightHint = 270;
table.setLayoutData(gd);
table.setHeaderVisible(true);
table.setLinesVisible(true);
+ table.addListener(SWT.SetData, new Listener() {
- TableColumn pathColumn = new TableColumn(table, SWT.CENTER);
- pathColumn.setText("Path");
+ @Override
+ public void handleEvent(Event event) {
+ TableItem item = (TableItem) event.item;
+ int index = table.indexOf(item);
+ DisplayData displayData = tableData[index];
+ item.setText(new String[] { displayData.getDisplayLabel(),
+ displayData.getSizeLabel() });
+ item.setChecked(displayData.isSelected());
+ }
+ });
+
+ TableColumn pathColumn = new TableColumn(table, SWT.LEFT);
+ pathColumn.setText("Label");
TableColumn sizeColumn = new TableColumn(table, SWT.CENTER);
- if (tableType == TableType.Retention) {
- sizeColumn.setText("Current Size (MB)");
- } else if (tableType == TableType.Case) {
- sizeColumn.setText("Size (MB)");
+ if (type == TableType.Retention) {
+ sizeColumn.setText("Current Size");
+ } else if (type == TableType.Case) {
+ sizeColumn.setText("Size");
}
- populateTable();
-
- for (int i = 0; i < 2; i++) {
- table.getColumn(i).setResizable(false);
- table.getColumn(i).setMoveable(false);
- table.getColumn(i).pack();
- }
-
- table.getColumn(1).setWidth(100);
+ table.getColumn(0).setWidth(500);
table.addMouseListener(new MouseAdapter() {
@Override
@@ -152,9 +194,23 @@ public class ArchiveTableComp extends Composite {
table.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- updateSelectionLabel();
+ if (e.detail == SWT.CHECK) {
+ updateSelectionLabels();
+ setModified();
+ }
}
});
+
+ Listener sortListener = new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ sortColumn(event);
+ }
+ };
+
+ pathColumn.addListener(SWT.Selection, sortListener);
+ sizeColumn.addListener(SWT.Selection, sortListener);
}
/**
@@ -171,30 +227,89 @@ public class ArchiveTableComp extends Composite {
selectedLbl = new Label(lblComp, SWT.NONE);
selectedLbl.setLayoutData(gd);
- /*
- * TODO : keep for future use. This will be used to show the total size
- * of the selected items in the table.
- */
- // gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
- // sizeLbl = new Label(lblComp, SWT.NONE);
- // sizeLbl.setLayoutData(gd);
- // sizeLbl.setText("Size of Selected items: 0" + sizeSuffix);
+ gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ sizeLbl = new Label(lblComp, SWT.NONE);
+ sizeLbl.setLayoutData(gd);
}
/**
- * Update the selection items label.
+ * Sort table roles by desired column and direction.
+ *
+ * @param e
*/
- private void updateSelectionLabel() {
- TableItem[] itemArray = table.getItems();
- int count = 0;
+ private void sortColumn(Event e) {
+ TableColumn sortColumn = table.getSortColumn();
+ TableColumn eventColumn = (TableColumn) e.widget;
- for (TableItem ti : itemArray) {
- if (ti.getChecked()) {
- count++;
- }
+ int sortDir = table.getSortDirection();
+ int index = eventColumn == table.getColumn(LABEL_COL_INDEX) ? LABEL_COL_INDEX
+ : SIZE_COL_INDEX;
+
+ if (sortColumn == eventColumn) {
+ sortDir = ((sortDir == SWT.UP) ? SWT.DOWN : SWT.UP);
+ } else {
+ table.setSortColumn(eventColumn);
+ sortDir = SWT.UP;
}
- selectedLbl.setText("Selected Items: " + count);
+ switch (index) {
+ case LABEL_COL_INDEX:
+ Arrays.sort(tableData, DisplayData.LABEL_ORDER);
+ if (sortDir == SWT.DOWN) {
+ ArrayUtils.reverse(tableData);
+ }
+ break;
+ case SIZE_COL_INDEX:
+ Arrays.sort(tableData, DisplayData.SIZE_ORDER);
+ if (sortDir == SWT.DOWN) {
+ ArrayUtils.reverse(tableData);
+ }
+ break;
+ default:
+ // Programmer error should never get here.
+ throw new IndexOutOfBoundsException("Unknown column index.");
+ }
+ table.setSortDirection(sortDir);
+ table.clearAll();
+ }
+
+ /**
+ * Update the selection items labels.
+ */
+ private void updateSelectionLabels() {
+ int count = 0;
+ long tableTotalSize = 0;
+
+ for (int index = 0; index < tableData.length; ++index) {
+ DisplayData displayData = tableData[index];
+ TableItem item = table.getItem(index);
+ if (item.getChecked()) {
+ ++count;
+ displayData.setSelected(true);
+ if (tableTotalSize >= 0) {
+ long diSize = displayData.getSize();
+ if (diSize < 0) {
+ tableTotalSize = diSize;
+ } else {
+ tableTotalSize += diSize;
+ }
+ }
+ } else {
+ displayData.setSelected(false);
+ }
+ }
+ List displayDatas = Arrays.asList(tableData);
+
+ if (selectedLbl != null) {
+ selectedLbl.setText("Table Selected Items: " + count);
+
+ String sizeString = DisplayData.UNKNOWN_SIZE_LABEL;
+ if (tableTotalSize >= 0) {
+ sizeString = SizeUtil.prettyByteSize(tableTotalSize);
+ }
+ sizeLbl.setText("Table Selected Size: " + sizeString);
+ }
+ iArchiveTotals.updateTotals(displayDatas);
}
/**
@@ -260,12 +375,11 @@ public class ArchiveTableComp extends Composite {
*/
private void handleCheckSelectedRow(boolean check) {
TableItem[] itemArray = table.getSelection();
-
for (TableItem ti : itemArray) {
ti.setChecked(check);
}
- updateSelectionLabel();
+ updateSelectionLabels();
}
/**
@@ -280,24 +394,86 @@ public class ArchiveTableComp extends Composite {
for (TableItem ti : itemArray) {
ti.setChecked(check);
}
+ setModified();
- updateSelectionLabel();
+ updateSelectionLabels();
+ }
+
+ /**
+ * Check the current table to see if the size of any entries needs to be
+ * updated.
+ *
+ * @param displayDatas
+ */
+ public void updateSize(List displayDatas) {
+ if (tableData != null && tableData.length > 0) {
+ for (DisplayData displayData : displayDatas) {
+ for (int index = 0; index < tableData.length; ++index) {
+ if (displayData.equals(tableData[index])) {
+ table.getItem(index)
+ .setText(displayData.getSizeLabel());
+ table.clear(index);
+ }
+ }
+ }
+ updateSelectionLabels();
+ }
+ }
+
+ /**
+ * Set up table with values in the list.
+ *
+ * @param displayDatas
+ */
+ protected void populateTable(List displayDatas) {
+ tableData = displayDatas.toArray(new DisplayData[0]);
+ table.removeAll();
+ table.setItemCount(tableData.length);
+
+ for (int i = 0; i < 2; i++) {
+ table.getColumn(i).setResizable(false);
+ table.getColumn(i).setMoveable(false);
+ table.getColumn(i).pack();
+ }
+ table.getColumn(0).setWidth(600);
+ table.setSortColumn(table.getColumn(LABEL_COL_INDEX));
+ table.setSortDirection(SWT.UP);
+ table.clearAll();
+ }
+
+ /**
+ * Check the modified state and inform listeners when it changes.
+ */
+ private void setModified() {
+ if (!modifiedState) {
+ modifiedState = true;
+ for (IModifyListener iModifyListener : modifiedListeners) {
+ iModifyListener.modified();
+ }
+ }
+ }
+
+ /**
+ * Reset the modified state.
+ */
+ public void clearModified() {
+ modifiedState = false;
+ }
+
+ /**
+ * Add listener that wants to be informed when the modified state is
+ * changed.
+ *
+ * @param iModifyListener
+ */
+ public void addModifiedListener(IModifyListener iModifyListener) {
+ modifiedListeners.add(iModifyListener);
}
/*
- * TODO : this is just for display purposes. This will go away when the
- * functionality is implemented.
+ * Remove the listener.
*/
- private void populateTable() {
- for (int i = 0; i < 150; i++) {
- TableItem item = new TableItem(table, SWT.NONE);
- item.setText(0,
- "/home/lvenable/caveData/configuration/base/com.raytheon.uf.viz.gisdatastore/"
- + i + " ");
- if (i % 5 == 0) {
- item.setChecked(true);
- }
- item.setText(1, "?????");
- }
+ public void removeModifiedListener(IModifyListener iModifyListener) {
+ modifiedListeners.remove(iModifyListener);
}
}
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/CaseCreationDlg.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/CaseCreationDlg.java
index f0dc0c0cf8..eb39bdc72c 100644
--- a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/CaseCreationDlg.java
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/CaseCreationDlg.java
@@ -19,12 +19,20 @@
**/
package com.raytheon.uf.viz.archive.ui;
+import java.io.File;
import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Calendar;
import java.util.Date;
+import java.util.List;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
@@ -33,16 +41,26 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Spinner;
+import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
+import com.raytheon.uf.common.archive.config.DisplayData;
import com.raytheon.uf.common.time.util.TimeUtil;
+import com.raytheon.uf.common.util.SizeUtil;
+import com.raytheon.uf.viz.archive.data.ArchiveInfo;
+import com.raytheon.uf.viz.archive.data.CategoryInfo;
+import com.raytheon.uf.viz.archive.data.IArchiveTotals;
+import com.raytheon.uf.viz.archive.data.IUpdateListener;
+import com.raytheon.uf.viz.archive.data.SizeJobRequest;
import com.raytheon.uf.viz.archive.ui.ArchiveTableComp.TableType;
+import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.ui.dialogs.AwipsCalendar;
-import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
+import com.raytheon.viz.ui.dialogs.ICloseCallback;
/**
*
@@ -54,17 +72,17 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * May 23, 2013 #1964 lvenable Initial creation
+ * May 23, 2013 #1964 lvenable Initial creation
+ * Jun 10, 2013 #1966 rferrel Implemented back in hooks for display
+ * and generation of cases.
*
*
*
* @author lvenable
* @version 1.0
*/
-public class CaseCreationDlg extends CaveSWTDialog {
-
- /** Table control */
- private ArchiveTableComp tableComp;
+public class CaseCreationDlg extends AbstractArchiveDlg implements
+ IArchiveTotals, IUpdateListener {
/** Start time label. */
private Label startTimeLbl;
@@ -78,11 +96,11 @@ public class CaseCreationDlg extends CaveSWTDialog {
/** End date. */
private Date endDate;
- /** Archive configuration combo box. */
- private Combo archCfgCbo;
+ /** Action to bring up the case name dialog. */
+ private Button caseNameCreate;
- /** Category combo box. */
- private Combo categoryCbo;
+ /** Display the case name. */
+ private Label caseNameLbl;
/** Compression check box. */
private Button compressChk;
@@ -102,13 +120,28 @@ public class CaseCreationDlg extends CaveSWTDialog {
/** Directory location label. */
private Label locationLbl;
+ /** Directory location state. */
+ private Label locationStateLbl;
+
/** Uncompressed file size label. */
private Label uncompressSizeLbl;
+ /** Displays total number of items selected from all categories. */
+ private Label totalSelectedItemsLbl;
+
+ /** Button to generate the case. */
+ private Button generateBtn;
+
/** Date format. */
private SimpleDateFormat dateFmt = new SimpleDateFormat(
"E MMM dd yyyy HH:00 z");
+ /** Archive configuration manager */
+ private ArchiveConfigManager manager = ArchiveConfigManager.getInstance();
+
+ /** Number of selected items. */
+ private int selectedItemsSize = 0;
+
/**
* Constructor.
*
@@ -118,8 +151,15 @@ public class CaseCreationDlg extends CaveSWTDialog {
public CaseCreationDlg(Shell parentShell) {
super(parentShell, SWT.DIALOG_TRIM | SWT.MIN, CAVE.DO_NOT_BLOCK
| CAVE.MODE_INDEPENDENT | CAVE.INDEPENDENT_SHELL);
+ this.setSelect = false;
+ this.tableType = TableType.Case;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
+ */
@Override
protected Layout constructShellLayout() {
// Create the main layout for the shell.
@@ -130,9 +170,16 @@ public class CaseCreationDlg extends CaveSWTDialog {
return mainLayout;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
+ * .eclipse.swt.widgets.Shell)
+ */
@Override
protected void initializeComponents(Shell shell) {
- setText("Case Creation");
+ setText("Archive Case Creation");
Composite mainComp = new Composite(shell, SWT.NONE);
GridLayout gl = new GridLayout(1, false);
gl.marginHeight = 0;
@@ -140,6 +187,8 @@ public class CaseCreationDlg extends CaveSWTDialog {
gl.horizontalSpacing = 0;
mainComp.setLayout(gl);
+ manager.reset();
+
init();
}
@@ -147,17 +196,14 @@ public class CaseCreationDlg extends CaveSWTDialog {
* Initialize method to create all of the composite & controls.
*/
private void init() {
-
createTimeControls();
- addSeparator(shell, SWT.HORIZONTAL);
+ GuiUtil.addSeparator(shell, SWT.HORIZONTAL);
createCaseCompressionControls();
- addSeparator(shell, SWT.HORIZONTAL);
+ GuiUtil.addSeparator(shell, SWT.HORIZONTAL);
createFileBrowserControls();
createTable();
- addSeparator(shell, SWT.HORIZONTAL);
+ GuiUtil.addSeparator(shell, SWT.HORIZONTAL);
createBottomActionButtons();
-
- populateComboBoxes();
}
/**
@@ -199,9 +245,10 @@ public class CaseCreationDlg extends CaveSWTDialog {
endTimeLbl = new Label(timeComp, SWT.BORDER);
endTimeLbl.setLayoutData(gd);
- Date date = TimeUtil.newDate();
- startDate = date;
- endDate = date;
+ endDate = TimeUtil.newDate();
+ long time = endDate.getTime();
+ time -= TimeUtil.MILLIS_PER_DAY;
+ startDate = new Date(time);
startTimeLbl.setText(dateFmt.format(startDate));
endTimeLbl.setText(dateFmt.format(endDate));
}
@@ -217,54 +264,35 @@ public class CaseCreationDlg extends CaveSWTDialog {
caseCompressionComp.setLayoutData(gd);
createComboControls(caseCompressionComp);
- addSeparator(caseCompressionComp, SWT.VERTICAL);
+ GuiUtil.addSeparator(caseCompressionComp, SWT.VERTICAL);
createCompressionControls(caseCompressionComp);
}
- /**
- * Create the Archive and Category combo controls.
+ /*
+ * (non-Javadoc)
*
- * @param comp
- * Composite to put the controls in.
+ * @see
+ * com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#createComboControls
+ * (org.eclipse.swt.widgets.Composite)
*/
- private void createComboControls(Composite comp) {
- Composite comboComp = new Composite(comp, SWT.NONE);
- GridLayout gl = new GridLayout(2, false);
- GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
- comboComp.setLayout(gl);
- comboComp.setLayoutData(gd);
+ protected Composite createComboControls(Composite comp) {
+ Composite comboComp = super.createComboControls(comp);
- Label archCfgLbl = new Label(comboComp, SWT.NONE);
- archCfgLbl.setText("Archive Config: ");
+ caseNameCreate = new Button(comboComp, SWT.PUSH);
+ caseNameCreate.setText(" Case Name... ");
+ caseNameCreate.addSelectionListener(new SelectionAdapter() {
- gd = new GridData(200, SWT.DEFAULT);
- archCfgCbo = new Combo(comboComp, SWT.VERTICAL | SWT.DROP_DOWN
- | SWT.BORDER | SWT.READ_ONLY);
- archCfgCbo.setLayoutData(gd);
- archCfgCbo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- /*
- * TODO - add code to update the category combo box
- */
+ handleCaseNameSelection();
}
});
+ caseNameCreate.setToolTipText("Must first select \"Case Location\".");
- Label catLbl = new Label(comboComp, SWT.NONE);
- catLbl.setText("Category: ");
-
- gd = new GridData(200, SWT.DEFAULT);
- categoryCbo = new Combo(comboComp, SWT.VERTICAL | SWT.DROP_DOWN
- | SWT.BORDER | SWT.READ_ONLY);
- categoryCbo.setLayoutData(gd);
- categoryCbo.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- /*
- * TODO - add code to update the information in the table
- */
- }
- });
+ GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ caseNameLbl = new Label(comboComp, SWT.BORDER);
+ caseNameLbl.setLayoutData(gd);
+ return comboComp;
}
/**
@@ -276,7 +304,7 @@ public class CaseCreationDlg extends CaveSWTDialog {
private void createCompressionControls(Composite comp) {
Composite compressionComp = new Composite(comp, SWT.NONE);
GridLayout gl = new GridLayout(1, false);
- GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
compressionComp.setLayout(gl);
compressionComp.setLayoutData(gd);
@@ -284,7 +312,7 @@ public class CaseCreationDlg extends CaveSWTDialog {
* Uncompressed file size label
*/
Composite compressionLblComp = new Composite(compressionComp, SWT.NONE);
- gl = new GridLayout(3, false);
+ gl = new GridLayout(2, false);
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
compressionLblComp.setLayout(gl);
compressionLblComp.setLayoutData(gd);
@@ -294,9 +322,15 @@ public class CaseCreationDlg extends CaveSWTDialog {
gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
uncompressSizeLbl = new Label(compressionLblComp, SWT.NONE);
- uncompressSizeLbl.setText("1024 MB");
uncompressSizeLbl.setLayoutData(gd);
+ Label totSelectedLbl = new Label(compressionLblComp, SWT.NONE);
+ totSelectedLbl.setText("Total Selected Items: ");
+
+ gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ totalSelectedItemsLbl = new Label(compressionLblComp, SWT.NONE);
+ totalSelectedItemsLbl.setLayoutData(gd);
+
/*
* Compression controls
*/
@@ -351,6 +385,9 @@ public class CaseCreationDlg extends CaveSWTDialog {
handleFileSizeChangeSelection();
}
});
+ fileSizeCbo.add("MB");
+ fileSizeCbo.add("GB");
+ fileSizeCbo.select(0);
}
/**
@@ -358,7 +395,7 @@ public class CaseCreationDlg extends CaveSWTDialog {
*/
private void createFileBrowserControls() {
Composite fileBrowserComp = new Composite(shell, SWT.NONE);
- GridLayout gl = new GridLayout(4, false);
+ GridLayout gl = new GridLayout(6, false);
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
fileBrowserComp.setLayout(gl);
fileBrowserComp.setLayoutData(gd);
@@ -378,13 +415,14 @@ public class CaseCreationDlg extends CaveSWTDialog {
handleBrowserSelection();
}
});
- }
+ browseBtn.setToolTipText("Select directory to place case.");
- /**
- * Create the table control.
- */
- private void createTable() {
- tableComp = new ArchiveTableComp(shell, TableType.Case);
+ Label stateLbl = new Label(fileBrowserComp, SWT.NONE);
+ stateLbl.setText("Full - Avaliable:");
+
+ locationStateLbl = new Label(fileBrowserComp, SWT.BORDER);
+ gd = new GridData(200, SWT.DEFAULT);
+ locationStateLbl.setLayoutData(gd);
}
/**
@@ -398,22 +436,24 @@ public class CaseCreationDlg extends CaveSWTDialog {
actionControlComp.setLayout(gl);
actionControlComp.setLayoutData(gd);
- Button exportBtn = new Button(actionControlComp, SWT.PUSH);
- exportBtn.setText(" Export Case Config... ");
- exportBtn.addSelectionListener(new SelectionAdapter() {
+ // TODO - Future implementation.
+ // Button exportBtn = new Button(actionControlComp, SWT.PUSH);
+ // exportBtn.setText(" Export Case Config... ");
+ // exportBtn.addSelectionListener(new SelectionAdapter() {
+ //
+ // @Override
+ // public void widgetSelected(SelectionEvent e) {
+ //
+ // }
+ // });
- @Override
- public void widgetSelected(SelectionEvent e) {
-
- }
- });
-
- Button generateBtn = new Button(actionControlComp, SWT.PUSH);
+ generateBtn = new Button(actionControlComp, SWT.PUSH);
generateBtn.setText(" Generate ");
+ generateBtn.setEnabled(false);
generateBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
-
+ generateCase();
}
});
@@ -429,6 +469,49 @@ public class CaseCreationDlg extends CaveSWTDialog {
});
}
+ /**
+ * Display modal dialog that performs the Generation of the case.
+ */
+ private void generateCase() {
+ setCursorBusy(true);
+ File targetDir = (File) locationLbl.getData();
+ File caseDir = (File) caseNameLbl.getData();
+ Calendar startCal = getStart();
+ Calendar endCal = getEnd();
+
+ List displayDatas = getSelectedData();
+ boolean doCompress = compressChk.getSelection();
+ boolean doMultiFiles = breakFilesChk.getSelection();
+ int compressSize = fileSizeSpnr.getSelection();
+ String sizeType = fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex());
+
+ // Assume Model dialog.
+ GenerateCaseDlg dialog = new GenerateCaseDlg(shell, targetDir, caseDir,
+ startCal, endCal, displayDatas, doCompress, doMultiFiles,
+ compressSize, sizeType);
+ dialog.addJobChangeListener(new JobChangeAdapter() {
+
+ @Override
+ public void done(IJobChangeEvent event) {
+ VizApp.runAsync(new Runnable() {
+ @Override
+ public void run() {
+ updateLocationState();
+ }
+ });
+ }
+ });
+ dialog.setCloseCallback(new ICloseCallback() {
+
+ @Override
+ public void dialogClosed(Object returnValue) {
+ setCursorBusy(false);
+ }
+ });
+ dialog.open();
+
+ }
+
/**
* Enable/Disable controls based on the compression check box.
*/
@@ -442,6 +525,36 @@ public class CaseCreationDlg extends CaveSWTDialog {
breakFilesChk.setEnabled(compressChk.getSelection());
}
+ /**
+ * Bring up modal dialog to get the case's directory name.
+ */
+ private void handleCaseNameSelection() {
+ Object o = locationLbl.getData();
+ if (!(o instanceof File)) {
+ MessageDialog.openError(shell, "Error",
+ "Must select \"Case Location\".");
+ return;
+ }
+
+ File targetDir = (File) o;
+ // Assume modal dialog.
+ CaseNameDialog dialog = new CaseNameDialog(shell, targetDir);
+ dialog.setCloseCallback(new ICloseCallback() {
+
+ @Override
+ public void dialogClosed(Object returnValue) {
+ if (returnValue instanceof File) {
+ File caseDir = (File) returnValue;
+ String caseName = caseDir.getAbsolutePath();
+ caseNameLbl.setText(caseName);
+ caseNameLbl.setData(caseDir);
+ checkGenerateButton();
+ }
+ }
+ });
+ dialog.open();
+ }
+
/**
* Enable/Disable file size controls.
*
@@ -454,6 +567,16 @@ public class CaseCreationDlg extends CaveSWTDialog {
fileSizeCbo.setEnabled(enabled);
}
+ /**
+ * Enables the generate button will user has entered all needed elements.
+ */
+ private void checkGenerateButton() {
+ if (generateBtn != null && !generateBtn.isDisposed()) {
+ generateBtn.setEnabled(locationLbl.getData() != null
+ && caseNameLbl.getData() != null && selectedItemsSize > 0);
+ }
+ }
+
/**
* Action performed when the file size has changed.
*/
@@ -493,30 +616,51 @@ public class CaseCreationDlg extends CaveSWTDialog {
if (dirName != null) {
locationLbl.setText(trimDirectoryName(dirName));
locationLbl.setToolTipText(dirName);
- locationLbl.setData(dirName);
+ locationLbl.setData(new File(dirName));
+ caseNameCreate.setToolTipText(null);
+ caseNameLbl.setText("");
+ caseNameLbl.setData(null);
+ updateLocationState();
+ checkGenerateButton();
}
}
/**
- * Add a separator line to the provided container.
- *
- * @param container
- * Composite.
- * @param orientation
- * Vertical or horizontal orientation.
+ * Update location's state.
*/
- private void addSeparator(Composite container, int orientation) {
- // Separator label
- GridData gd;
-
- if (orientation == SWT.HORIZONTAL) {
- gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ private void updateLocationState() {
+ File dir = (File) locationLbl.getData();
+ long totSpace = dir.getTotalSpace();
+ long freeSpace = dir.getUsableSpace();
+ long percentFull = (long) Math.round(((totSpace - freeSpace) * 100.0)
+ / totSpace);
+ String state = null;
+ Color bgColor = null;
+ Color fgColor = null;
+ Display display = shell.getDisplay();
+ if (percentFull <= 84) {
+ state = "GOOD";
+ bgColor = display.getSystemColor(SWT.COLOR_GREEN);
+ fgColor = display.getSystemColor(SWT.COLOR_BLACK);
+ } else if (percentFull <= 94) {
+ state = "CAUTION";
+ bgColor = display.getSystemColor(SWT.COLOR_YELLOW);
+ fgColor = display.getSystemColor(SWT.COLOR_BLACK);
+ } else if (percentFull <= 97) {
+ state = "DANGER";
+ bgColor = display.getSystemColor(SWT.COLOR_RED);
+ fgColor = display.getSystemColor(SWT.COLOR_BLACK);
} else {
- gd = new GridData(SWT.DEFAULT, SWT.FILL, false, true);
+ state = "FATAL";
+ bgColor = display.getSystemColor(SWT.COLOR_DARK_MAGENTA);
+ fgColor = display.getSystemColor(SWT.COLOR_WHITE);
}
- Label sepLbl = new Label(container, SWT.SEPARATOR | orientation);
- sepLbl.setLayoutData(gd);
+ String text = String.format("%1$3d%% %2$s - %3$s", percentFull, state,
+ SizeUtil.prettyByteSize(freeSpace));
+ locationStateLbl.setText(text);
+ locationStateLbl.setBackground(bgColor);
+ locationStateLbl.setForeground(fgColor);
}
/**
@@ -526,9 +670,16 @@ public class CaseCreationDlg extends CaveSWTDialog {
* True for start time, false for end time.
*/
private void displayDateTimeControls(boolean startTimeFlag) {
- AwipsCalendar ac = new AwipsCalendar(shell, 1);
+
+ Date acDate = startTimeFlag ? startDate : endDate;
+ AwipsCalendar ac = new AwipsCalendar(shell, acDate, 1);
+ ac.setTimeZone(TimeUtil.newCalendar().getTimeZone());
Date date = (Date) ac.open();
+ if (date == null) {
+ return;
+ }
+
if (startTimeFlag) {
if (date.after(endDate)) {
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION
@@ -538,6 +689,11 @@ public class CaseCreationDlg extends CaveSWTDialog {
mb.open();
return;
}
+
+ if (!startDate.equals(date)) {
+ startDate = date;
+ resetSizes();
+ }
} else {
if (date.before(startDate)) {
MessageBox mb = new MessageBox(shell, SWT.ICON_QUESTION
@@ -547,6 +703,10 @@ public class CaseCreationDlg extends CaveSWTDialog {
mb.open();
return;
}
+ if (!endDate.equals(date)) {
+ endDate = date;
+ resetSizes();
+ }
}
if (startTimeFlag) {
@@ -587,23 +747,98 @@ public class CaseCreationDlg extends CaveSWTDialog {
return str;
}
- /********************************************************
- * TEST METHODS ******************************************************
+ protected void setTotalSizeText(String text) {
+ uncompressSizeLbl.setText(text);
+ }
+
+ protected void setTotalSelectedItems(int totalSelected) {
+ selectedItemsSize = totalSelected;
+ totalSelectedItemsLbl.setText("" + totalSelected);
+ checkGenerateButton();
+ }
+
+ /**
+ * Reset all entries to unknown size, recompute the sizes for the current
+ * display table and and other selected entries.
*/
- private void populateComboBoxes() {
- archCfgCbo.add("Raw");
- archCfgCbo.add("Processed");
- archCfgCbo.select(0);
+ private void resetSizes() {
+ List selectedDatas = new ArrayList();
+ for (String archiveName : archiveInfoMap.keySet()) {
+ ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
+ for (String categoryName : archiveInfo.getCategoryNames()) {
+ CategoryInfo categoryInfo = archiveInfo.get(categoryName);
+ for (DisplayData displayData : categoryInfo
+ .getDisplayDataList()) {
+ displayData.setSize(DisplayData.UNKNOWN_SIZE);
+ if (displayData.isSelected()) {
+ selectedDatas.add(displayData);
+ }
+ }
+ }
+ }
- categoryCbo.add("Radar");
- categoryCbo.add("Point");
- categoryCbo.add("Satellite");
- categoryCbo.select(0);
+ populateTableComp();
- fileSizeCbo.add("MB");
- fileSizeCbo.add("GB");
- fileSizeCbo.select(0);
- fileSizeCbo
- .setData(fileSizeCbo.getItem(fileSizeCbo.getSelectionIndex()));
+ if (selectedDatas.size() > 0) {
+ String archiveName = getSelectedArchiveName();
+ String categoryName = getSelectedCategoryName();
+ Calendar startCal = getStart();
+ Calendar endCal = getEnd();
+
+ for (DisplayData displayData : selectedDatas) {
+ if (!displayData.isArchive(archiveName)
+ || !displayData.isCategory(categoryName)) {
+ sizeJob.queue(new SizeJobRequest(displayData, startCal,
+ endCal));
+ }
+ }
+ }
+ }
+
+ /**
+ * Get the data information on all selected items; not just the currently
+ * displayed table.
+ *
+ * @return selectedDatas
+ */
+ private List getSelectedData() {
+ List selectedDatas = new ArrayList();
+ for (String archiveName : archiveInfoMap.keySet()) {
+ ArchiveInfo archiveInfo = archiveInfoMap.get(archiveName);
+ for (String categoryName : archiveInfo.getCategoryNames()) {
+ CategoryInfo categoryInfo = archiveInfo.get(categoryName);
+ for (DisplayData displayData : categoryInfo
+ .getDisplayDataList()) {
+ if (displayData.isSelected()) {
+ selectedDatas.add(displayData);
+ }
+ }
+ }
+ }
+ return selectedDatas;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getStart()
+ */
+ // @Override
+ protected Calendar getStart() {
+ Calendar startCal = TimeUtil.newCalendar();
+ startCal.setTimeInMillis(startDate.getTime());
+ return startCal;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.uf.viz.archive.ui.AbstractArchiveDlg#getEnd()
+ */
+ // @Override
+ protected Calendar getEnd() {
+ Calendar endCal = TimeUtil.newCalendar();
+ endCal.setTimeInMillis(endDate.getTime());
+ return endCal;
}
}
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/CaseNameDialog.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/CaseNameDialog.java
new file mode 100644
index 0000000000..60a5e16b54
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/CaseNameDialog.java
@@ -0,0 +1,189 @@
+/**
+ * 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.uf.viz.archive.ui;
+
+import java.io.File;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
+
+/**
+ * Dialog to obtain and verify a case name.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 5, 2013 1966 rferrel Initial creation
+ *
+ *
+ *
+ * @author rferrel
+ * @version 1.0
+ */
+
+public class CaseNameDialog extends CaveSWTDialog {
+
+ /** The location directory. */
+ private File locationDir;
+
+ /** Text field for entering the case name's directory. */
+ private Text caseNameText;
+
+ /** Non-blocking modal constructor. */
+ protected CaseNameDialog(Shell parent, File locationDir) {
+ super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
+ CAVE.DO_NOT_BLOCK);
+ this.locationDir = locationDir;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
+ * .eclipse.swt.widgets.Shell)
+ */
+ @Override
+ protected void initializeComponents(Shell shell) {
+ Composite mainComp = new Composite(shell, SWT.NONE);
+ GridLayout gl = new GridLayout(1, false);
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+ gl.horizontalSpacing = 0;
+ mainComp.setLayout(gl);
+ init();
+ }
+
+ /**
+ * create layout of the dialog.
+ */
+ private void init() {
+ setText("Case Name");
+ createFieldsComp();
+ GuiUtil.addSeparator(shell, SWT.HORIZONTAL);
+ createBottomActionButtons();
+ }
+
+ /**
+ * The xomposite with case name text field.
+ */
+ private void createFieldsComp() {
+ Composite fieldComp = new Composite(shell, SWT.NONE);
+ GridLayout gl = new GridLayout(2, false);
+ GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ fieldComp.setLayout(gl);
+ fieldComp.setLayoutData(gd);
+
+ Label nameLbl = new Label(fieldComp, SWT.LEFT);
+ nameLbl.setText("Name: ");
+
+ caseNameText = new Text(fieldComp, SWT.SINGLE);
+ gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ gd.minimumWidth = 200;
+ caseNameText.setLayoutData(gd);
+ caseNameText.addKeyListener(new KeyAdapter() {
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ super.keyReleased(e);
+ if (e.character == SWT.CR || e.character == SWT.KEYPAD_CR) {
+ if (verifySelection()) {
+ close();
+ }
+ }
+ }
+ });
+ }
+
+ /**
+ * The composite with the action buttons.
+ */
+ private void createBottomActionButtons() {
+ Composite actionControlComp = new Composite(shell, SWT.NONE);
+ GridLayout gl = new GridLayout(2, false);
+ GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ actionControlComp.setLayout(gl);
+ actionControlComp.setLayoutData(gd);
+
+ Button okBtn = new Button(actionControlComp, SWT.PUSH);
+ okBtn.setText(" OK ");
+ okBtn.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (verifySelection()) {
+ close();
+ }
+ }
+ });
+
+ Button cancelBtn = new Button(actionControlComp, SWT.PUSH);
+ cancelBtn.setText(" Cancel ");
+ cancelBtn.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ close();
+ }
+ });
+ }
+
+ /**
+ * Validate the case's directory does not exist and set the return value
+ * when it doesn't exist.
+ *
+ * @return true when case's directory does not exist.
+ */
+ private boolean verifySelection() {
+ String caseName = caseNameText.getText().trim();
+ if (caseName.length() == 0) {
+ MessageDialog.openError(shell, "Error", "Enter a case name.");
+ return false;
+ }
+
+ File caseDir = new File(locationDir, caseName);
+ if (caseDir.exists()) {
+ MessageDialog.openError(shell, "Error",
+ "Case already exists choose another name.");
+ caseNameText.selectAll();
+ caseNameText.setFocus();
+ return false;
+ }
+
+ setReturnValue(caseDir);
+ return true;
+ }
+
+}
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/GenerateCaseDlg.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/GenerateCaseDlg.java
new file mode 100644
index 0000000000..5ec5cfa75a
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/GenerateCaseDlg.java
@@ -0,0 +1,465 @@
+/**
+ * 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.uf.viz.archive.ui;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.List;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.ShellAdapter;
+import org.eclipse.swt.events.ShellEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.ProgressBar;
+import org.eclipse.swt.widgets.Shell;
+
+import com.raytheon.uf.common.archive.config.ArchiveConfigManager;
+import com.raytheon.uf.common.archive.config.DisplayData;
+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.util.FileUtil;
+import com.raytheon.uf.viz.core.VizApp;
+import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
+
+/**
+ * Class to show progress of creating a case.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 3, 2013 1966 rferrel Initial creation
+ *
+ *
+ *
+ * @author rferrelGenerateJob
+ * @version 1.0
+ */
+
+public class GenerateCaseDlg extends CaveSWTDialog {
+ private final IUFStatusHandler statusHandler = UFStatus
+ .getHandler(GenerateCaseDlg.class);
+
+ /** Use to display the current state of the case generation. */
+ private Label stateLbl;
+
+ /** Progress bar to indicate activity. */
+ private ProgressBar progressBar;
+
+ /** Stops the case generation leaving it in an unknown state. */
+ private Button cancelBtn;
+
+ /** Active have generation is finish or has an error. */
+ private Button closeBtn;
+
+ /** The main destination directory. */
+ private final File targetDir;
+
+ /**
+ * The case's destination directory. Assumed to be a sub-directory of
+ * targetDir.
+ */
+ private final File caseDir;
+
+ /** Starting time for the case. */
+ private final Calendar startCal;
+
+ /** End time for the case. */
+ private final Calendar endCal;
+
+ /** Data list for the case. */
+ private final List sourceDataList;
+
+ /** When true compress the case directory. */
+ private final boolean doCompress;
+
+ /** When true break the compress file into multliple files. */
+ private final boolean doMultiFiles;
+
+ /** The compress size for muliple files. */
+ private final int compressSize;
+
+ /** Assumed to be MG or GB to indicate scaling factor for compressSize. */
+ private final String sizeType;
+
+ /** Job to perform the case generation off of the UI thread. */
+ private GenerateJob generateJob;
+
+ /** Shorten case name to use in status message. */
+ private final String caseName;
+
+ /** Listeners to add to the job when scheduled. */
+ private final List jobListeners = new ArrayList();
+
+ /** Data manager. */
+ private final ArchiveConfigManager archiveManager = ArchiveConfigManager
+ .getInstance();
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell
+ * @param targetDir
+ * @param caseDir
+ * @param startCal
+ * @param endCal
+ * @param sourceList
+ * @param doCompress
+ * @param doMultiFiles
+ * @param compressSize
+ * @param sizeType
+ */
+ protected GenerateCaseDlg(Shell parentShell, File targetDir, File caseDir,
+ Calendar startCal, Calendar endCal, List sourceList,
+ boolean doCompress, boolean doMultiFiles, int compressSize,
+ String sizeType) {
+ super(parentShell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
+ CAVE.DO_NOT_BLOCK);
+ this.targetDir = targetDir;
+ this.caseDir = caseDir;
+ this.startCal = startCal;
+ this.endCal = endCal;
+ this.sourceDataList = new ArrayList(sourceList);
+ this.doCompress = doCompress;
+ this.doMultiFiles = doMultiFiles;
+ this.compressSize = compressSize;
+ this.sizeType = sizeType;
+ this.caseName = caseDir.getAbsolutePath().substring(
+ targetDir.getAbsolutePath().length() + 1);
+ setText("Generating - " + caseName);
+ }
+
+ /**
+ * Add a job listener.
+ *
+ * @param listener
+ */
+ protected void addJobChangeListener(IJobChangeListener listener) {
+ jobListeners.add(listener);
+ }
+
+ /**
+ * Remve a job listener.
+ *
+ * @param listener
+ */
+ protected void removeJobChangeListener(IJobChangeListener listener) {
+ jobListeners.remove(listener);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
+ * .eclipse.swt.widgets.Shell)
+ */
+ @Override
+ protected void initializeComponents(Shell shell) {
+ Composite mainComp = new Composite(shell, SWT.NONE);
+ GridLayout gl = new GridLayout(1, false);
+ gl.marginHeight = 0;
+ gl.marginWidth = 0;
+ gl.horizontalSpacing = 0;
+ mainComp.setLayout(gl);
+
+ init();
+ }
+
+ /**
+ * Set up main layout.
+ */
+ private void init() {
+ createProgress();
+ GuiUtil.addSeparator(shell, SWT.HORIZONTAL);
+ createBottomActionButtons();
+ }
+
+ /**
+ * The progress component.
+ */
+ private void createProgress() {
+ Composite progComp = new Composite(shell, SWT.NONE);
+ GridLayout gl = new GridLayout(1, false);
+ progComp.setLayout(gl);
+
+ GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ gd.minimumWidth = 300;
+ stateLbl = new Label(shell, SWT.BORDER | SWT.CENTER);
+ stateLbl.setLayoutData(gd);
+ stateLbl.setText("state of progress goes here.");
+
+ progressBar = new ProgressBar(shell, SWT.DEFAULT);
+ gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ progressBar.setLayoutData(gd);
+ }
+
+ /**
+ * Component for the action buttons.
+ */
+ private void createBottomActionButtons() {
+ Composite actionComp = new Composite(shell, SWT.NONE);
+ GridLayout gl = new GridLayout(2, false);
+ actionComp.setLayout(gl);
+
+ cancelBtn = new Button(actionComp, SWT.PUSH);
+ cancelBtn.setText(" Cancel ");
+ cancelBtn.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (generateJob != null && generateJob.getState() != Job.NONE) {
+ generateJob.cancel();
+ }
+
+ close();
+ }
+ });
+
+ closeBtn = new Button(actionComp, SWT.PUSH);
+ closeBtn.setText(" Close ");
+ closeBtn.setEnabled(false);
+ closeBtn.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ close();
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.viz.ui.dialogs.CaveSWTDialog#preOpened()
+ */
+ @Override
+ protected void preOpened() {
+ super.preOpened();
+
+ generateJob = new GenerateJob();
+ for (IJobChangeListener listener : jobListeners) {
+ generateJob.addJobChangeListener(listener);
+ }
+
+ generateJob.schedule();
+ shell.addShellListener(new ShellAdapter() {
+
+ @Override
+ public void shellClosed(ShellEvent e) {
+ if (generateJob != null && generateJob.getState() != Job.NONE) {
+ e.doit = false;
+ }
+ }
+ });
+ }
+
+ /**
+ * Allow a non-UI thread to update the state label.
+ *
+ * @param message
+ * @param tooltip
+ */
+ private void setStateLbl(final String message, final String tooltip) {
+ VizApp.runAsync(new Runnable() {
+ @Override
+ public void run() {
+ if (!stateLbl.isDisposed()) {
+ stateLbl.setText(message);
+ stateLbl.setToolTipText(tooltip);
+ }
+ }
+ });
+ }
+
+ /**
+ * Allow a non-UI thread to update the progress bar and background of the
+ * state label when there is an error.
+ *
+ * @param value
+ * @param state
+ */
+ private void setProgressBar(final int value, final int state) {
+ VizApp.runAsync(new Runnable() {
+
+ @Override
+ public void run() {
+ if (!progressBar.isDisposed()) {
+ int val = value;
+ if (val < progressBar.getMinimum()) {
+ val = progressBar.getMinimum();
+ } else if (val >= progressBar.getMaximum()) {
+ val = progressBar.getMaximum();
+ closeBtn.setEnabled(true);
+ cancelBtn.setEnabled(false);
+ }
+ progressBar.setSelection(val);
+ progressBar.setState(state);
+ progressBar.setVisible(val != progressBar.getMaximum());
+ Color bgColor = null;
+ if (state == SWT.ERROR) {
+ bgColor = shell.getDisplay().getSystemColor(
+ SWT.COLOR_RED);
+ }
+ stateLbl.setBackground(bgColor);
+ }
+ }
+ });
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#disposed()
+ */
+ @Override
+ protected void disposed() {
+ if (generateJob != null && generateJob.getState() != Job.NONE) {
+ generateJob.cancel();
+ }
+ }
+
+ /**
+ * The performs the work of generating the case on a non-UI thread.
+ */
+ private class GenerateJob extends Job {
+ boolean shutdown = false;
+
+ public GenerateJob() {
+ super("Generate Job");
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (monitor.isCanceled()) {
+ return Status.OK_STATUS;
+ }
+
+ setStateLbl("Creating: " + caseDir.getName(),
+ caseDir.getAbsolutePath());
+ if (caseDir.exists()) {
+ setStateLbl("Case exists: " + caseName,
+ caseDir.getAbsolutePath());
+ setProgressBar(100, SWT.ERROR);
+ return Status.OK_STATUS;
+ }
+
+ if (!caseDir.mkdirs()) {
+ setStateLbl("Unable to create case: " + caseName,
+ caseDir.getAbsolutePath());
+ setProgressBar(100, SWT.ERROR);
+ return Status.OK_STATUS;
+ }
+
+ if (shutdown) {
+ return Status.OK_STATUS;
+ }
+
+ for (DisplayData displayData : sourceDataList) {
+ if (shutdown) {
+ return Status.OK_STATUS;
+ }
+
+ setStateLbl(
+ "Copying \"" + displayData.getDisplayLabel() + "\"",
+ null);
+ String rootDir = displayData.getRootDir();
+ int beginIndex = rootDir.length();
+
+ List files = archiveManager.getDisplayFiles(displayData,
+ startCal, endCal);
+ for (File source : files) {
+ if (shutdown) {
+ return Status.OK_STATUS;
+ }
+
+ String name = source.getAbsolutePath();
+ String relativePath = name.substring(beginIndex);
+
+ setStateLbl("Copy: " + relativePath, name);
+ File destination = new File(caseDir, relativePath);
+ try {
+ if (source.isDirectory()) {
+ destination.mkdirs();
+ FileUtil.copyDirectory(source, destination);
+ } else {
+ File destParent = destination.getParentFile();
+ destParent.mkdirs();
+ FileUtil.copyFile(source, destination);
+ }
+ } catch (IOException e) {
+ statusHandler.handle(Priority.PROBLEM,
+ e.getLocalizedMessage(), e);
+ }
+ }
+ }
+
+ if (!doCompress) {
+ setProgressBar(100, SWT.NORMAL);
+ setStateLbl("Created: " + caseName, caseDir.getAbsolutePath());
+ return Status.OK_STATUS;
+ }
+
+ if (shutdown) {
+ return Status.OK_STATUS;
+ }
+
+ if (doMultiFiles) {
+ setProgressBar(100, SWT.NORMAL);
+ String message = "Compress into multifiles NYI.";
+ setStateLbl(message, null);
+ } else {
+ setProgressBar(100, SWT.NORMAL);
+ String message = "Compress into one file NYI";
+ setStateLbl(message, null);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.core.runtime.jobs.Job#canceling()
+ */
+ @Override
+ protected void canceling() {
+ shutdown = true;
+ generateJob = null;
+ }
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/GuiUtil.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/GuiUtil.java
new file mode 100644
index 0000000000..4d02e65d0a
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/GuiUtil.java
@@ -0,0 +1,70 @@
+/**
+ * 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.uf.viz.archive.ui;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+
+/**
+ * Common methods used in the dialogs.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 6, 2013 1966 rferrel Initial creation
+ *
+ *
+ *
+ * @author rferrel
+ * @version 1.0
+ */
+
+public class GuiUtil {
+ private GuiUtil() {
+ }
+
+ /**
+ * Add a separator line to the provided container.
+ *
+ * @param container
+ * Composite.
+ * @param orientation
+ * Vertical or horizontal orientation.
+ */
+ public static void addSeparator(Composite container, int orientation) {
+ // Separator label
+ GridData gd;
+
+ if (orientation == SWT.HORIZONTAL) {
+ gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ } else {
+ gd = new GridData(SWT.DEFAULT, SWT.FILL, false, true);
+ }
+
+ Label sepLbl = new Label(container, SWT.SEPARATOR | orientation);
+ sepLbl.setLayoutData(gd);
+ }
+
+}
diff --git a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/ArchiveManagerFactory.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/IModifyListener.java
similarity index 75%
rename from edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/ArchiveManagerFactory.java
rename to cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/IModifyListener.java
index 92d92a82bf..835aa0d714 100644
--- a/edexOsgi/com.raytheon.uf.common.archive/src/com/raytheon/uf/common/archive/ArchiveManagerFactory.java
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/IModifyListener.java
@@ -17,10 +17,10 @@
* See the AWIPS II Master Rights File ("Master Rights File.pdf") for
* further licensing information.
**/
-package com.raytheon.uf.common.archive;
+package com.raytheon.uf.viz.archive.ui;
/**
- * Factory for accessing an archive CategoryManager.
+ * A Listner to inform when class is modified.
*
*
*
@@ -28,18 +28,17 @@ package com.raytheon.uf.common.archive;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * May 06, 2013 1966 bgonzale Initial creation
+ * Jun 18, 2013 1966 rferrel Initial creation
*
*
*
- * @author bgonzale
+ * @author rferrel
* @version 1.0
*/
-public class ArchiveManagerFactory {
-
- public static IArchiveManager getManager() {
- return null;
- }
-
+public interface IModifyListener {
+ /*
+ * Method called to notify listener that a modification has happened.
+ */
+ public void modified();
}
diff --git a/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/RetentionHours.java b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/RetentionHours.java
new file mode 100644
index 0000000000..2edc296c97
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.archive/src/com/raytheon/uf/viz/archive/ui/RetentionHours.java
@@ -0,0 +1,258 @@
+/**
+ * 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.uf.viz.archive.ui;
+
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Spinner;
+
+import com.raytheon.uf.common.time.util.TimeUtil;
+
+/**
+ * Convenience class for taking retention hours and converting to days/hours.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * May 2, 2013 1966 rferrel Initial creation
+ *
+ *
+ *
+ * @author rferrel
+ * @version 1.0
+ */
+
+public class RetentionHours {
+
+ /** Minimum value for the spinner. */
+ private final int minUnit;
+
+ /** The retention hours. */
+ private int retentionHours;
+
+ /** Spinner for the time assume hours or days. */
+ private Spinner timeSpnr;
+
+ /** Combo box assume to determine use of Hours or Days. */
+ private Combo timeUnitCombo;
+
+ /**
+ * Keep track of previous time unit so recalculation only done when changed.
+ */
+ private int prevTimeUnitSelected = 0;
+
+ /**
+ * Set when user modified values.
+ */
+ private boolean modifyState = false;
+
+ /**
+ * Listeners to inform when user performs a modification.
+ */
+ private final List listeners = new CopyOnWriteArrayList();
+
+ /**
+ * Constructor with default 7 day retention.
+ */
+ public RetentionHours(int minUnit, Spinner timeSpnr, Combo timeUnitCombo) {
+ this.minUnit = minUnit;
+ this.timeSpnr = timeSpnr;
+ this.timeUnitCombo = timeUnitCombo;
+ init();
+ }
+
+ /**
+ * Set up Listeners on the combo boxes for time conversion.
+ */
+ private void init() {
+ timeSpnr.setMinimum(minUnit);
+ timeSpnr.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateAndCheckTimeSelection();
+ }
+ });
+
+ timeUnitCombo.removeAll();
+ timeUnitCombo.add("Hours");
+ timeUnitCombo.add("Days");
+ timeUnitCombo.select(prevTimeUnitSelected);
+
+ timeUnitCombo.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (prevTimeUnitSelected != timeUnitCombo.getSelectionIndex()) {
+ prevTimeUnitSelected = timeUnitCombo.getSelectionIndex();
+ handleTimeUnitSelection();
+ updateAndCheckTimeSelection();
+ }
+ }
+ });
+ timeUnitCombo.setData(timeUnitCombo.getItem(timeUnitCombo
+ .getSelectionIndex()));
+ }
+
+ /**
+ * Update the retention hours and determine if modification listeners should
+ * be notified.
+ */
+ private void updateAndCheckTimeSelection() {
+ // Make sure this is called so retention hours is updated properly.
+ boolean modified = handleTimeSelection();
+
+ // Do notification when state becomes true.
+ if (!modifyState && modified) {
+ modifyState = true;
+ for (IModifyListener iModifyListener : listeners) {
+ iModifyListener.modified();
+ }
+ }
+ }
+
+ /**
+ * Get retention in hours.
+ *
+ * @return
+ */
+ public int getHours() {
+ return retentionHours;
+ }
+
+ /**
+ * Set number hours of retention.
+ *
+ * @param hours
+ */
+ public void setHours(int hours) {
+ if (hours < minUnit) {
+ hours = minUnit;
+ }
+
+ retentionHours = hours;
+ int time = retentionHours;
+ if (timeUnitCombo.getItem(timeUnitCombo.getSelectionIndex()).equals(
+ "Days")) {
+ time /= TimeUtil.HOURS_PER_DAY;
+ if (time < minUnit) {
+ time = minUnit;
+ }
+ }
+
+ timeSpnr.setSelection(time);
+
+ // Based on the time unit retentionHours may need updating.
+ handleTimeSelection();
+ }
+
+ /**
+ * Handle the retention selection for both minimum and extended retention.
+ *
+ * @param timeUnitCombo
+ * Retention combo box.
+ * @param timeSpinner
+ * Retention spinner.
+ * @return hours entered if changed; -1 if not changed
+ */
+ private void handleTimeUnitSelection() {
+ int time = 0;
+
+ if (timeUnitCombo.getItem(timeUnitCombo.getSelectionIndex()).equals(
+ "Hours")) {
+ time = convertTime(true, timeSpnr.getSelection());
+ } else {
+ time = convertTime(false, timeSpnr.getSelection());
+ }
+
+ timeSpnr.setSelection(time);
+ timeUnitCombo.setData(timeUnitCombo.getItem(timeUnitCombo
+ .getSelectionIndex()));
+ }
+
+ /**
+ * Covert time from either hours to days or days to hours.
+ *
+ * @param daysToHours
+ * Flag indicating how to convert the time.
+ * @param time
+ * Time to be converted.
+ * @return The converted time.
+ */
+ private int convertTime(boolean daysToHours, int time) {
+ int convertedTime = 0;
+
+ if (daysToHours) {
+ convertedTime = time * TimeUtil.HOURS_PER_DAY;
+ retentionHours = convertedTime;
+ } else {
+ convertedTime = time / TimeUtil.HOURS_PER_DAY;
+ retentionHours = convertedTime * TimeUtil.HOURS_PER_DAY;
+ }
+ return convertedTime;
+ }
+
+ /**
+ * Adjust retention hours based on combo boxes current values.
+ */
+ protected boolean handleTimeSelection() {
+ int time = timeSpnr.getSelection();
+ boolean modified = false;
+ if (timeUnitCombo.getItem(timeUnitCombo.getSelectionIndex()).equals(
+ "Days")) {
+ time *= TimeUtil.HOURS_PER_DAY;
+ }
+
+ if (retentionHours != time) {
+ retentionHours = time;
+ modified = true;
+ }
+ return modified;
+ }
+
+ /**
+ * Reset the modify state.
+ */
+ public void clearModified() {
+ modifyState = false;
+ }
+
+ /**
+ *
+ * @param iModifyListener
+ */
+ public void addModifyListener(IModifyListener iModifyListener) {
+ listeners.add(iModifyListener);
+ }
+
+ /**
+ *
+ * @param iModifyListener
+ */
+ public void removeModifyListener(IModifyListener iModifyListener) {
+ listeners.remove(iModifyListener);
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.core.feature/feature.xml b/cave/com.raytheon.uf.viz.core.feature/feature.xml
index 447a7c642c..62ff17a95b 100644
--- a/cave/com.raytheon.uf.viz.core.feature/feature.xml
+++ b/cave/com.raytheon.uf.viz.core.feature/feature.xml
@@ -194,4 +194,10 @@
install-size="0"
version="0.0.0"/>
+
+
diff --git a/cave/com.raytheon.uf.viz.core/res/spring/viz.xml b/cave/com.raytheon.uf.viz.core/res/spring/viz.xml
index d717b020e3..ceb8bdc277 100644
--- a/cave/com.raytheon.uf.viz.core/res/spring/viz.xml
+++ b/cave/com.raytheon.uf.viz.core/res/spring/viz.xml
@@ -3,10 +3,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util-2.5.xsd">
+ http://www.springframework.org/schema/util/spring-util-3.1.xsd">
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/RecordFactory.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/RecordFactory.java
index 2caf926800..1fbb05fc3a 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/RecordFactory.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/RecordFactory.java
@@ -153,6 +153,15 @@ public class RecordFactory implements IPluginClassMapper {
map.put("dataURI", dataURI);
return map;
} catch (Exception e) {
+ // if this exception was caused by NoPlugin then throw that so that
+ // caller knows exactly why this happened.
+ Throwable cause = e.getCause();
+ while (cause != null) {
+ if (cause instanceof NoPluginException) {
+ throw (NoPluginException) cause;
+ }
+ cause = cause.getCause();
+ }
throw new VizException("Unable to create property map for "
+ dataURI, e);
}
@@ -251,7 +260,7 @@ public class RecordFactory implements IPluginClassMapper {
try {
return getPluginClass(pluginName);
} catch (NoPluginException e) {
- throw new PluginException(e.getLocalizedMessage());
+ throw new PluginException(e.getLocalizedMessage(), e);
}
}
}
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/auth/IUserManager.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/auth/IUserManager.java
index fc0d61f4ec..212f7bc1da 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/auth/IUserManager.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/auth/IUserManager.java
@@ -37,6 +37,7 @@ import com.raytheon.uf.viz.core.requests.INotAuthHandler;
* ------------ ---------- ----------- --------------------------
* May 21, 2010 mschenke Initial creation
* Nov 06, 2012 1302 djohnson Add ability to get roles/permissions for an application.
+ * Jun 07, 2013 1981 mpduff Add ability to update with the user id as a string.
*
*
*
@@ -85,4 +86,14 @@ public interface IUserManager {
* @return the list of roles
*/
List getRoles(String application);
+
+ /**
+ * Update the user object with the authentication data update
+ *
+ * @param userId
+ * User's id
+ * @param authData
+ * User's authentication data
+ */
+ void updateUserObject(String userId, IAuthenticationData authData);
}
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/auth/UserController.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/auth/UserController.java
index c63fa10b72..efc1d93cc8 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/auth/UserController.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/auth/UserController.java
@@ -55,6 +55,7 @@ import com.raytheon.uf.viz.core.requests.INotAuthHandler;
* Nov 06, 2012 1302 djohnson Add ability to retrieve the {@link IUserManager}.
* Jan 04, 2013 1451 djohnson Move static block code to an implementation of an interface.
* Mar 21, 2013 1794 djohnson ServiceLoaderUtil now requires the requesting class.
+ * Jun 07, 2013 1981 mpduff Add ability to update with the user id as a string.
*
*
*
@@ -166,6 +167,12 @@ public class UserController {
return Collections.emptyList();
}
+ @Override
+ public void updateUserObject(String userId,
+ IAuthenticationData authData) {
+
+ }
+
};
}
return manager;
@@ -194,6 +201,16 @@ public class UserController {
manager.updateUserObject(manager.getUserObject(), data);
}
+ /**
+ * Update the user's id.
+ *
+ * @param userID
+ * The user id
+ */
+ public static void updateUserData(String userID) {
+ manager.updateUserObject(userID, null);
+ }
+
public static INotAuthHandler getNotAuthHandler() {
return manager.getNotAuthHandler();
}
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/comm/CaveHttpsCredentialsHandler.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/comm/CaveHttpsCredentialsHandler.java
index b39ad87a26..2036322469 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/comm/CaveHttpsCredentialsHandler.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/comm/CaveHttpsCredentialsHandler.java
@@ -20,6 +20,7 @@
package com.raytheon.uf.viz.core.comm;
import com.raytheon.uf.common.comm.IHttpsCredentialsHandler;
+import com.raytheon.uf.viz.core.auth.UserController;
/**
* Cave implementation of the IHttpsCredentialsHandler. Displays the Cave login
@@ -31,7 +32,8 @@ import com.raytheon.uf.common.comm.IHttpsCredentialsHandler;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Mar 4, 2013 1786 mpduff Initial creation
+ * Mar 04, 2013 1786 mpduff Initial creation.
+ * Jun 07, 2013 1981 mpduff Save user's username in UserController.
*
*
*
@@ -52,6 +54,9 @@ public class CaveHttpsCredentialsHandler implements IHttpsCredentialsHandler {
}
HttpsLoginDlg login = new HttpsLoginDlg(message);
login.open();
- return login.getCredentials();
+ String[] credentials = login.getCredentials();
+ // Save off the user's username in the UserController
+ UserController.updateUserData(credentials[0]);
+ return credentials;
}
}
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractRequestableResourceData.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractRequestableResourceData.java
index a25b6313fb..8c8d8f0cf3 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractRequestableResourceData.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/AbstractRequestableResourceData.java
@@ -292,6 +292,8 @@ public abstract class AbstractRequestableResourceData extends
}
}
this.fireChangeListeners(ChangeType.DATA_UPDATE, updateData);
+ } else {
+ this.fireChangeListeners(ChangeType.DATA_UPDATE, updateData);
}
}
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/ResourceCatalog.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/ResourceCatalog.java
index 3ab303deaf..aab670da78 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/ResourceCatalog.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/ResourceCatalog.java
@@ -45,8 +45,10 @@ import com.raytheon.uf.viz.core.rsc.updater.DataUpdateTree;
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * 7/1/06 chammack Initial Creation.
+ * ------------ ---------- ----------- --------------------------
+ * Jul 01, 2006 chammack Initial Creation.
+ * Jun 07, 2013 2034 bsteffen Clear all locks in resource catalog
+ * before runAsync.
*
*
*
@@ -127,28 +129,34 @@ public class ResourceCatalog implements IDisposeListener {
* @param displayID
* the id of the display
*/
- public synchronized void removeResource(
+ public void removeResource(
final AbstractVizResource, ?> resource, String displayID) {
- Set list = theMapping.get(resource);
- if (list != null) {
- list.remove(displayID);
- if (list.size() == 0) {
- // Only dispose of resources if they have been initialized
- if (resource.getStatus() == ResourceStatus.INITIALIZED) {
- // this needs to be async, otherwise other components like
- // gfe can deadlock when this blocks but the UI thread is
- // blocked waiting on a different lock
- VizApp.runAsync(new Runnable() {
- @Override
- public void run() {
- resource.dispose();
- }
- });
- } else {
- disposed(resource);
+ boolean dispose = false;
+ synchronized (this) {
+ Set list = theMapping.get(resource);
+ if (list != null) {
+ list.remove(displayID);
+ if (list.size() == 0) {
+ // Only dispose of resources if they have been initialized
+ if (resource.getStatus() == ResourceStatus.INITIALIZED) {
+ dispose = true;
+ } else {
+ disposed(resource);
+ }
}
}
}
+ if (dispose) {
+ // this needs to be async outside the synchronized block, otherwise
+ // other components like gfe and warngen can deadlock when this
+ // blocks but the UI thread is blocked waiting on a different lock
+ VizApp.runAsync(new Runnable() {
+ @Override
+ public void run() {
+ resource.dispose();
+ }
+ });
+ }
}
/*
@@ -162,7 +170,9 @@ public class ResourceCatalog implements IDisposeListener {
public void disposed(AbstractVizResource, ?> resource) {
// Nothing points to this resource
// remove it from the map, and invoke dispose.
- theMapping.remove(resource);
+ synchronized (this) {
+ theMapping.remove(resource);
+ }
if (resource instanceof IResourceGroup) {
((IResourceGroup) resource).getResourceList().clear();
diff --git a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/capabilities/Capabilities.java b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/capabilities/Capabilities.java
index 73b2f0f2f6..fb32a90add 100644
--- a/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/capabilities/Capabilities.java
+++ b/cave/com.raytheon.uf.viz.core/src/com/raytheon/uf/viz/core/rsc/capabilities/Capabilities.java
@@ -52,6 +52,7 @@ import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 2, 2009 chammack Initial creation
+ * Jun 7, 2013 2074 mnash Fix for null capabilities trying to be added
*
*
*
@@ -191,7 +192,9 @@ public class Capabilities implements Iterable {
collection).iterator();
while (collectionIterator.hasNext()) {
AbstractCapability cap = collectionIterator.next();
- this.backingMap.put(cap.getClass(), cap);
+ if (cap != null) {
+ this.backingMap.put(cap.getClass(), cap);
+ }
}
}
diff --git a/cave/com.raytheon.uf.viz.cots.feature/feature.xml b/cave/com.raytheon.uf.viz.cots.feature/feature.xml
index 93c524c534..a99fb60162 100644
--- a/cave/com.raytheon.uf.viz.cots.feature/feature.xml
+++ b/cave/com.raytheon.uf.viz.cots.feature/feature.xml
@@ -43,8 +43,7 @@
id="com.sun.jna"
download-size="0"
install-size="0"
- version="0.0.0"
- unpack="false"/>
+ version="0.0.0"/>
+ version="0.0.0"/>
+
+
+
+
diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/OpenAWIPSProcedure.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/OpenAWIPSProcedure.java
index 306883f180..5d743cc132 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/OpenAWIPSProcedure.java
+++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/actions/OpenAWIPSProcedure.java
@@ -47,7 +47,7 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Sep 13, 2007 chammack Initial Creation.
* Oct 16, 2012 1229 rferrel Change to use ProcedureDlg.displayDialog.
* Oct 16, 2012 1229 rferrel Changes for non-blocking ProcedureListDlg.
- *
+ * Jun 7, 2013 2074 mnash Don't open the dialog if no procedures are deserialized
*
*
* @author chammack
@@ -77,10 +77,12 @@ public class OpenAWIPSProcedure extends AbstractHandler {
File f = selectedFile.getFile();
Procedure p = (Procedure) LoadSerializedXml
.deserialize(f);
- ProcedureDlg.displayDialog(LocalizationUtil
- .extractName(selectedFile.getName()), p,
- VizWorkbenchManager.getInstance()
- .getCurrentWindow().getShell());
+ if (p != null) {
+ ProcedureDlg.displayDialog(LocalizationUtil
+ .extractName(selectedFile.getName()), p,
+ VizWorkbenchManager.getInstance()
+ .getCurrentWindow().getShell());
+ }
}
dialog = null;
}
diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java
index 120c7fe66e..f50665e65d 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java
+++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureDlg.java
@@ -75,6 +75,7 @@ import com.raytheon.uf.viz.core.procedures.Procedure;
import com.raytheon.uf.viz.core.rsc.AbstractRequestableResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractResourceData;
import com.raytheon.uf.viz.core.rsc.AbstractVizResource;
+import com.raytheon.uf.viz.core.rsc.ResourceList;
import com.raytheon.uf.viz.d2d.ui.dialogs.procedures.ProcedureComm.BundlePair;
import com.raytheon.viz.ui.HistoryList;
import com.raytheon.viz.ui.UiUtil;
@@ -100,7 +101,7 @@ import com.raytheon.viz.ui.editor.AbstractEditor;
* Jan 15, 2013 DR 15699 D. Friedman Prompt for save when close button clicked.
* Jan 16, 2013 DR 15367 D. Friedman Enable save button for Up/Down changes.
* Feb 25, 2013 1640 bsteffen Dispose old display in BundleLoader
- *
+ * Jun 7, 2013 2074 mnash Remove resource if doesn't instantiate correctly
*
*
* @author unknown
@@ -193,15 +194,26 @@ public class ProcedureDlg extends CaveSWTDialog {
if (p != null && p.getBundles() != null) {
Bundle[] bund = p.getBundles();
for (Bundle b : bund) {
+ // remove any bad resource pairs from each display
+ for (AbstractRenderableDisplay display : b.getDisplays()) {
+ ResourceList rList = display.getDescriptor()
+ .getResourceList();
+ // modify the resource list so that we remove any null
+ // resource datas
+ for (ResourcePair rp : rList) {
+ if (rp.getResourceData() == null) {
+ rList.remove(rp);
+ }
+ }
+ }
// Check to see if frozen
for (AbstractRenderableDisplay display : b.getDisplays()) {
- for (ResourcePair rp : display.getDescriptor()
- .getResourceList()) {
- if (rp.getResourceData() != null) {
- if (rp.getResourceData().isFrozen()) {
- frozen = true;
- break;
- }
+ ResourceList rList = display.getDescriptor()
+ .getResourceList();
+ for (ResourcePair rp : rList) {
+ if (rp.getResourceData().isFrozen()) {
+ frozen = true;
+ break;
}
}
if (frozen) {
@@ -958,8 +970,7 @@ public class ProcedureDlg extends CaveSWTDialog {
}
}
- private void handleCloseRequest()
- {
+ private void handleCloseRequest() {
if (saved) {
close();
} else {
@@ -972,7 +983,8 @@ public class ProcedureDlg extends CaveSWTDialog {
* to close it
*/
private void showConfirmSaveDlg() {
- CaveSWTDialog dlg = new CaveSWTDialog(shell, SWT.DIALOG_TRIM | SWT.PRIMARY_MODAL, CAVE.DO_NOT_BLOCK) {
+ CaveSWTDialog dlg = new CaveSWTDialog(shell, SWT.DIALOG_TRIM
+ | SWT.PRIMARY_MODAL, CAVE.DO_NOT_BLOCK) {
@Override
protected void initializeComponents(Shell shell) {
diff --git a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java
index 51411554db..664d74ca44 100644
--- a/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java
+++ b/cave/com.raytheon.uf.viz.d2d.ui/src/com/raytheon/uf/viz/d2d/ui/dialogs/procedures/ProcedureListDlg.java
@@ -19,6 +19,8 @@
**/
package com.raytheon.uf.viz.d2d.ui.dialogs.procedures;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -32,6 +34,7 @@ import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
@@ -39,6 +42,7 @@ import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
@@ -52,6 +56,7 @@ import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
import com.raytheon.uf.common.localization.LocalizationFile;
import com.raytheon.uf.common.localization.LocalizationUtil;
import com.raytheon.uf.common.localization.PathManagerFactory;
+import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
@@ -175,7 +180,10 @@ public class ProcedureListDlg extends CaveSWTDialog {
* @param mainComp
*/
protected void createTextComp(Composite mainComp) {
- Composite textComp = new Composite(mainComp, SWT.NONE);
+ final Cursor cursor = getShell().getCursor();
+ getShell().setCursor(
+ Display.getCurrent().getSystemCursor(SWT.CURSOR_WAIT));
+ final Composite textComp = new Composite(mainComp, SWT.NONE);
textComp.setLayout(new GridLayout(1, true));
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
gd.widthHint = 150;
@@ -227,24 +235,41 @@ public class ProcedureListDlg extends CaveSWTDialog {
}
});
- fileTree = populateDataList(treeViewer);
+ Job job = new Job("Populating procedures...") {
+ protected org.eclipse.core.runtime.IStatus run(
+ org.eclipse.core.runtime.IProgressMonitor monitor) {
+ fileTree = populateDataList(treeViewer);
+ VizApp.runAsync(new Runnable() {
+ @Override
+ public void run() {
+ treeViewer
+ .setContentProvider(new ProcedureTreeContentProvider(
+ fileTree));
+ treeViewer
+ .setLabelProvider(new ProcedureTreeLabelProvider());
+ treeViewer.setSorter(new ProcedureTreeSorter());
- treeViewer
- .setContentProvider(new ProcedureTreeContentProvider(fileTree));
- treeViewer.setLabelProvider(new ProcedureTreeLabelProvider());
- treeViewer.setSorter(new ProcedureTreeSorter());
+ // uncomment following function call to enable the right
+ // click
+ // context
+ // menu
+ // createContextMenu();
- // uncomment following function call to enable the right click context
- // menu
- // createContextMenu();
+ // it didn't seem to start with null, the string doesn't
+ // actually mean
+ // anything in this case
+ treeViewer.setInput("kickstart");
- // it didn't seem to start with null, the string doesn't actually mean
- // anything in this case
- treeViewer.setInput("kickstart");
+ openUserInTreeViewer();
- openUserInTreeViewer();
-
- createExpandComp(textComp);
+ createExpandComp(textComp);
+ getShell().setCursor(cursor);
+ }
+ });
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
}
private void createContextMenu() {
diff --git a/cave/com.raytheon.uf.viz.datadelivery/localization/DataDelivery/DataTypeFilter.xml b/cave/com.raytheon.uf.viz.datadelivery/localization/DataDelivery/DataTypeFilter.xml
index 4002683720..f9bc49e0a1 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/localization/DataDelivery/DataTypeFilter.xml
+++ b/cave/com.raytheon.uf.viz.datadelivery/localization/DataDelivery/DataTypeFilter.xml
@@ -6,7 +6,7 @@
Level
Parameter
-
+
Data Provider
Data Set
diff --git a/cave/com.raytheon.uf.viz.datadelivery/localization/help/dataBrowserHelp.xml b/cave/com.raytheon.uf.viz.datadelivery/localization/help/dataBrowserHelp.xml
new file mode 100644
index 0000000000..84ca006a67
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/localization/help/dataBrowserHelp.xml
@@ -0,0 +1,83 @@
+
+
+ Dataset Discovery Browser Help
+
+
+
+
+ The Dataset Discovery Browser allows users to find Datasets using a filtering scheme.
+
+
+
+First is the optional Area filter. Selecting an area only displays datasets that have coverage over the area. Next select and available Data Type. Move the data type to the selected column using the arrows. Next select from the filtering options. Filters include Data Provider, Dataset, Level, and Parameter. Click the arrows to the left of the Filter titles to expand the filter selection sections. After Filters are selected, click Update Results to load the list of Datasets in the table. Select a Dataset and click the Subset... button. Optionally, select Subset information. Enter a Subset Name. Click the Subscribe button to subscribe to the subset. Click the Query button to find details about the subset.
+
+
+
+
+
+
+
+
+
+ Clear the current configuration settings.
+
+
+
+
+ Load Configuration...
+
+
+Load a previously saved configuration file. Select from the Available Configuration Files list and click the Load button to load a configuration file. Use the Preview button to view the XML associated with the configuration file.
+
+
+
+
+
+Save the current configuration settings to the most recently saved file name. The first time Save Configuration is accessed, select to save either at the User or Site level and enter a file name. Click the Save button to save the file. Use the Load Configuration menu item to load a saved configuration.
+
+
+
+
+ Save Configuration As...
+
+
+Save the current configuration settings to a named file that may be loaded in the future. In the Save Configuration dialog select to save either at the User or Site level and enter a file name. Click the Save button to save the file. Use the Load Configuration menu item to load a saved configuration.
+
+
+
+
+ Delete Configuration...
+
+
+Delete a saved configuration file.
+
+
+
+
+
+Exit the table.
+
+
+
+
+
+
+
+
+
+ Turn on mouseover tooltips for the controls.
+
+
+
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.datadelivery/localization/help/notificationHelp.xml b/cave/com.raytheon.uf.viz.datadelivery/localization/help/notificationHelp.xml
new file mode 100644
index 0000000000..34a8613c2d
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/localization/help/notificationHelp.xml
@@ -0,0 +1,134 @@
+
+
+ Notification Center Help
+
+
+
+
+ The Notification Center Table allows a user to view and delete data delivery notifications.
+
+
+
+
+
+
+
+
+
+
+
+Set the current configuration settings to be the default settings for the table. When the table is opened the saved default settings are applied.
+
+
+
+
+ Load Configuration...
+
+
+Load a previously saved configuration file. Select from the Available Configuration Files list and click the Load button to load a configuration file. Use the Preview button to view the XML
+ associated with the configuration file.
+
+
+
+
+
+Save the current configuration settings to the most recently saved file name. The first time Save Configuration is accessed, select to save either at the User or Site level and enter a file name. Click the Save button to save the file. Use the Load Configuration menu item to load a saved configuration.
+
+
+
+
+ Save Configuration As...
+
+
+Save the current configuration settings to a named file that may be loaded in the future. In the Save Configuration dialog select to save either at the User or Site level and enter a file name. Click the Save button to save the file. Use the Load Configuration menu item to load a saved configuration.
+
+
+
+
+ Delete Configuration...
+
+
+Delete a saved configuration file.
+
+
+
+
+
+Close the Notification Center.
+
+
+
+
+
+
+
+
+
+Find and highlight items in the table using the Find dialog. The Case Sensitive option allows a user to search text that is capitalization sensitive. The Exclude option allows a user to search the table for items that exclude the entered text. The Case Sensitive and Exclude options may be used in conjunction with another. The Column Selection grouping allows users to search a specific column in the table. After the search criteria has been selected, click the Find Next button to perform the search. The Highlight All button highlights all the rows matching the find criteria. Close the Find dialog using the Close button.
+
+
+
+
+
+Delete all rows in the table having a specific priority. (Note: Notifications only deleted from the user view and not permanently deleted from the database.)
+
+
+
+
+ Delete Older Than Selected
+
+
+Delete all rows in the table having a date in the Time column that is older than the currently highlighted row. (Note: Notifications only deleted from the user view and not permanently deleted from the database.)
+
+
+
+
+
+Delete the currently highlighted row(s) in the table. (Note: Notifications only deleted from the user view and not permanently deleted from the database.)
+
+
+
+
+
+
+
+
+
+The Initial Startup Configuration items are set when the table is opened. Check the Load All Messages check box to display all messages in the table that are contained in the database. Enter a number of messages or hours amount in the Load Last spinner to select the amount of messages or number of hours of messages to display in the table. Set the Initial Sort Column and either Sort Ascending or Sort Descending to sort the table by a specific column upon opening.
+
+The Display Configuration items refresh the table upon clicking OK. Select the number of Rows Per Page using the selection drop down. Select the image setting for the Priority table column using the radio buttons. Select to make columns hidden or visible using the arrows provided. After making selections, click the OK button to configure the table. (Note: Unless the configuration is set to the default or saved, changes will be lost when the table is closed.)
+
+
+
+
+
+A user may filter the table by user, by subscription or by priority. In the Filter by User section, the list of available user names are in the Available Users column. If users are moved to the Selected Users list, the corresponding columns containing those user names will be displayed in the Notification Table. Use the arrows to move users back and forth from the Available Users list to the Selected Users list. (Note: User names are not duplicated and appear only once either in the Available or Selected lists.) The Always include my notifications check box may be used to keep the currently logged in user in the Selected Users column.
+
+In the Filter by Subscription section, the list of available subscription names are in the Available Subscriptions column. If subscriptions are moved to the Selected Subscriptions list the corresponding columns containing those subscription names will be displayed in the Notification Table. Use the arrows to move subscriptions back and forth from the Available Subscriptions list to the Selected Subscriptions list. (Note: Subscription names are not duplicated and appear only once either in the Available or Selected lists.)
+
+In the Filter by Priority section, select which columns containing specific priorities to display using the checkboxes.
+
+
+
diff --git a/cave/com.raytheon.uf.viz.datadelivery/localization/help/subscriptionApprovalHelp.xml b/cave/com.raytheon.uf.viz.datadelivery/localization/help/subscriptionApprovalHelp.xml
new file mode 100644
index 0000000000..ea3491415c
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/localization/help/subscriptionApprovalHelp.xml
@@ -0,0 +1,64 @@
+
+
+ Subscription Approval Help
+
+
+
+
+ The Subscription Approval Dialog allows an authorized user to approve or deny subscriptions.
+
+
+
+
+
+
+
+
+
+
+
+
+ Close the dialog.
+
+
+
+
+
+
+
+
+
+ View the details of the highlighted subscription.
+
+
+
+
+
+
+
+
+
+ Approve the highlighted subscription.
+
+
+
+
+
+ Deny the highlighted subscription
+
+
+
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.datadelivery/localization/help/subscriptionManagerHelp.xml b/cave/com.raytheon.uf.viz.datadelivery/localization/help/subscriptionManagerHelp.xml
new file mode 100644
index 0000000000..2d312fbf6d
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/localization/help/subscriptionManagerHelp.xml
@@ -0,0 +1,137 @@
+
+
+ Subscription Manager Help
+
+
+
+
+ The Subscription Manager Table allows a user to add, edit, copy, view, and delete data delivery subscriptions.
+
+
+
+First is the optional Area filter. Selecting an area only displays datasets that have coverage over the area. Next select and available Data Type. Move the data type to the selected column using the arrows. Next select from the filtering options. Filters include Data Provider, Dataset, Level, and Parameter. Click the arrows to the left of the Filter titles to expand the filter selection sections. After Filters are selected, click Update Results to load the list of Datasets in the table. Select a Dataset and click the Subset... button. Optionally, select Subset information. Enter a Subset Name. Click the Subscribe button to subscribe to the subset. Click the Query button to find details about the subset.
+
+
+
+
+
+
+
+
+
+ The New Subscription menu option opens the Dataset Discovery Browser.
+
+
+
+
+
+ The New Group menu option allows the user to create a new subscription group. First enter a group name. Next select the Subscription Duration, Active Period, and Areal Coverage. Finally select which subscriptions to add to the new group.
+
+
+
+
+
+ Refresh the table data.
+
+
+
+
+ Approve Pending Subscriptions...
+
+
+ Opens the Subscription Approval dialog.
+
+
+
+
+
+ Close the dialog.
+
+
+
+
+
+
+
+
+
+Highlight a row in the table to edit. Modify the Subscription Delivery Options, the Subscription Duration, the Subscription Active Period, the Subscription Priority or the additional Subscription Information.
+
+Subscription Duration sets the start and expiration times for subscription delivery. Use the No Expiration radio button to continue to receive the subscription.
+
+The Subscription Active Period may be used to select a specified time range for the subscription to be active. (Note: The active period does not include the year.) The Subscription Priority sets the order of subscription fulfillment and may be set to High (1), Default (2), or Low (3).
+
+The Subscription Information allows the Description to be modified. The Subscription Name may not be modified.
+
+Click OK to perform the edit.
+
+
+
+
+
+ Highlight a row in the table to copy. Enter a New Subscription Name. Click OK to perform the copy.
+
+
+
+
+ Delete Subscription...
+
+
+ Highlight a row(s) in the table to delete. Click Yes to perform the deletion.
+
+
+
+
+
+ Edit the group settings. Select a group to edit, change the settings, click OK to save the edit.
+
+
+
+
+
+ Select a group to delete and click OK to delete the group.
+
+
+
+
+
+
+
+
+
+The Table Column Configuration Settings allow a user to hide and make visible table columns. The list of Hidden Columns is located on the left and the Visible Columns list is located on the right. If columns are moved to the Visible Columns list, the corresponding columns will be displayed in the Notification Table. Use the right and left arrows to move column names back and forth from the Hidden Columns list to the Visible Columns list. Use the up and down arrows to change the order of the visible columns as seen in the table. (Note: Column names are not duplicated and appear only once either in the Hidden or Visible lists.) After making selections, click the OK button to configure the table. (Note: Unless the configuration is set to the default or saved, changes will be lost when the table is closed.)
+
+
+
+
+
+Turns on the mouseover tooltips for the dialog's controls.
+
+
+
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.datadelivery/res/spring/datadelivery-handlers.xml b/cave/com.raytheon.uf.viz.datadelivery/res/spring/datadelivery-handlers.xml
index 4d65892ed8..f07a2434dc 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/res/spring/datadelivery-handlers.xml
+++ b/cave/com.raytheon.uf.viz.datadelivery/res/spring/datadelivery-handlers.xml
@@ -1,7 +1,7 @@
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
diff --git a/cave/com.raytheon.uf.viz.datadelivery/res/spring/datadelivery.xml b/cave/com.raytheon.uf.viz.datadelivery/res/spring/datadelivery.xml
index 3a9ccee31e..85bf5f83e4 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/res/spring/datadelivery.xml
+++ b/cave/com.raytheon.uf.viz.datadelivery/res/spring/datadelivery.xml
@@ -2,10 +2,10 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/util
- http://www.springframework.org/schema/util/spring-util-2.5.xsd">
+ http://www.springframework.org/schema/util/spring-util-3.1.xsd">
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/actions/SubscriptionManagerAction.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/actions/SubscriptionManagerAction.java
index 4c88e80f9f..c0eefec0dd 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/actions/SubscriptionManagerAction.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/actions/SubscriptionManagerAction.java
@@ -21,7 +21,6 @@ package com.raytheon.uf.viz.datadelivery.actions;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
@@ -33,7 +32,9 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
+import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionManagerFilter;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerDlg;
+import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters;
/**
* Subscription Manager Dialog Action class.
@@ -46,6 +47,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerDlg;
* ------------ ---------- ----------- --------------------------
* Jan 10, 2012 mpduff Initial creation
* Oct 03, 2012 1241 djohnson Use {@link DataDeliveryPermission}.
+ * May 28, 2013 1650 djohnson Allow using filters for the Subscription Manager Dialog.
*
*
*
@@ -54,6 +56,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerDlg;
*/
public class SubscriptionManagerAction extends AbstractHandler {
+
/** Status Handler */
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(SubscriptionManagerAction.class);
@@ -64,8 +67,24 @@ public class SubscriptionManagerAction extends AbstractHandler {
/** Permission String */
private final DataDeliveryPermission permission = DataDeliveryPermission.SUBSCRIPTION_VIEW;
+ /**
+ * Constructor.
+ */
+ public SubscriptionManagerAction() {
+ }
+
@Override
- public Object execute(ExecutionEvent arg0) throws ExecutionException {
+ public Object execute(ExecutionEvent arg0) {
+ return loadSubscriptionManager(SubscriptionManagerFilters.getAll());
+ }
+
+ /**
+ * Load the SubscriptionManager dialog with the specified filter.
+ *
+ * @param filter
+ * the filter
+ */
+ public Object loadSubscriptionManager(ISubscriptionManagerFilter filter) {
try {
// check if user is authorized
IUser user = UserController.getUserObject();
@@ -78,7 +97,7 @@ public class SubscriptionManagerAction extends AbstractHandler {
if ((dlg == null) || (dlg.isDisposed() == true)) {
Shell shell = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell();
- dlg = new SubscriptionManagerDlg(shell);
+ dlg = new SubscriptionManagerDlg(shell, filter);
dlg.open();
} else {
dlg.bringToTop();
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/browser/DataBrowserDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/browser/DataBrowserDlg.java
index 28ca1fb44e..6c36cabbb1 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/browser/DataBrowserDlg.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/browser/DataBrowserDlg.java
@@ -77,6 +77,7 @@ import com.raytheon.uf.viz.datadelivery.filter.MetaDataManager;
import com.raytheon.uf.viz.datadelivery.filter.config.FilterManager;
import com.raytheon.uf.viz.datadelivery.filter.config.xml.FilterSettingsXML;
import com.raytheon.uf.viz.datadelivery.filter.config.xml.FilterTypeXML;
+import com.raytheon.uf.viz.datadelivery.help.HelpManager;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.subscription.subset.SubsetManagerDlg;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryGUIUtils;
@@ -115,6 +116,9 @@ import com.vividsolutions.jts.geom.Coordinate;
* Jan 08, 2012 1436 bgonzale Fixed area text box display update check.
* Jan 14, 2012 1437 bgonzale Clear filters when creating a new configuration.
* May 15, 2013 1040 mpduff Put DataDeliveryGUIUtils.markNotBusyInUIThread in finally block.
+ * Jun 04, 2013 223 mpduff Add data type to filters.
+ * Jun 05, 2013 1800 mpduff Move the area filter below the data type selection.
+ * Jun 06, 2013 2030 mpduff Updates to help.
*
*
*
@@ -128,6 +132,9 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(DataBrowserDlg.class);
+ /** File containing help text */
+ private final String DATA_BROWSER_HELP_FILE = "help/dataBrowserHelp.xml";
+
/** Window Title string. */
private final String WINDOW_TITLE = "Dataset Discovery Browser";
@@ -139,9 +146,6 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
private static final String DEFAULT_CONFIG = FileUtil.join(CONFIG_PATH,
"DefaultBrowserConfig.xml");
- /** Help Dialog */
- private final DataBrowserHelpDlg help = null;
-
/** Filter expand bar. */
private FilterExpandBar filterExpandBar;
@@ -263,8 +267,8 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
protected void initializeComponents(Shell shell) {
createMenus();
- createAreaControls();
createDataTypeControls();
+ createAreaControls();
createSashForm();
createRetSubsControl();
@@ -713,14 +717,14 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
* Handle the help display dialog.
*/
private void handleHelp() {
-
- if (help == null || help.isDisposed()) {
- DataBrowserHelpDlg help = new DataBrowserHelpDlg(shell);
- help.open();
- } else {
- help.bringToTop();
+ try {
+ HelpManager.getInstance().displayHelpDialog(getShell(),
+ DATA_BROWSER_HELP_FILE);
+ } catch (Exception e) {
+ statusHandler.handle(Priority.ERROR,
+ "Error loading Help Text file: " + DATA_BROWSER_HELP_FILE,
+ e);
}
-
}
/**
@@ -1054,6 +1058,12 @@ public class DataBrowserDlg extends CaveSWTDialog implements IDataTableUpdate,
// Get selected filter settings
xml = new FilterSettingsXML();
filterExpandBar.populateFilterSettingsXml(xml);
+
+ String[] dataTypes = this.dataTypesDualList.getSelectedListItems();
+ for (String type : dataTypes) {
+ xml.addDataSetType(type);
+ }
+
final List matchingDataSets = new ArrayList();
final Shell jobParent = this.getShell();
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/browser/DataBrowserHelpDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/browser/DataBrowserHelpDlg.java
deleted file mode 100644
index d6231f6d57..0000000000
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/browser/DataBrowserHelpDlg.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package com.raytheon.uf.viz.datadelivery.browser;
-
-import org.eclipse.swt.widgets.Shell;
-
-import com.raytheon.uf.viz.datadelivery.help.DataDeliveryHelp;
-
-/**
- * Help dialog for the Data Discover Browser.
- *
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * May 21, 2012 645 jpiatt Initial creation.
- *
- *
- *
- * @author jpiatt
- * @version 1.0
- */
-
-public class DataBrowserHelpDlg extends DataDeliveryHelp {
-
- /**
- * Constructor.
- * @param parentShell
- * Parent shell.
- */
- public DataBrowserHelpDlg(Shell parentShell) {
-
- this.parentShell = parentShell;
- this.helpText = getHelpText();
-
- }
-
- /**
- * Get the Help Text.
- *
- * @return String
- * Help Text.
- */
- private String getHelpText() {
-
- String helpText = "Dataset Discovery Browser Help " +
- "The Dataset Discovery Browser allows a user to find Datasets using " +
- "filtering options. First, select an Area for the Areal Coverage. Optionally, use" +
- "the Set Area to select an Area. Next, select an available Data Type. Move the data type to " +
- "the selected column using the arrows. Next, select from the filtering options. Filters " +
- "include Data Provider, Data Set, Level or Parameter. Click the arrows to the left of the " +
- "Filter titles to expand the filter selection sections. After Filters are selected, click " +
- "Update Results to load the list of Datasets in the table. Select a Dataset and click the " +
- "Subset... button. Optionally, select Subset information. Enter a Subset Name. Click " +
- "the Subscribe button to subscribe to the subset. Click the Query button " +
- "to find details about the subset." +
- "" +
- " " +
- " File " +
- " New Configuration " +
- " Clear the current configuration settings. " +
- " Load Configuration... " +
- " Load a previously saved configuration file. Select from the Available " +
- " Configuration Files list and click the Load button to load a configuration " +
- " file. Use the Preview button to view the XML associated with the " +
- " configuration file. " +
- " Save Configuration " +
- " Save the current configuration settings to the most recently " +
- " saved file name. The first time Save Configuration is accessed, " +
- " select to save either at the User or Site level and enter a file name. " +
- " Click the Save button to save the file. Use the Load Configuration " +
- " menu item to load a saved configuration. " +
- " Save Configuration As... " +
- " Save the current configuration settings to a named file " +
- " that may be loaded in the future. In the Save Configuration dialog " +
- " select to save either at the User or Site level and enter a file name. " +
- " Click the Save button to save the file. Use the Load Configuration " +
- " menu item to load a saved configuration. " +
- " Delete Configuration... " +
- " Delete a saved configuration file. " +
- " Exit " +
- " Exit the table. " +
- " " +
- "";
-
- return helpText;
-
- }
-}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/AreaComp.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/AreaComp.java
index b6c2381089..051bf12ab9 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/AreaComp.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/AreaComp.java
@@ -68,11 +68,11 @@ import com.vividsolutions.jts.geom.Coordinate;
/**
* This is a common composite that is used to hold the area controls.
- *
+ *
*
- *
+ *
* SOFTWARE HISTORY
- *
+ *
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 28, 2012 lvenable Initial creation.
@@ -90,9 +90,10 @@ import com.vividsolutions.jts.geom.Coordinate;
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
* Dec 11, 2012 1264 mpduff Fix validaiton of lat/lon text fields.
* Mar 21, 2013 1638 mschenke Changed map scales not tied to d2d
- *
+ * Jun 14, 2013 2064 mpduff Reset controls on load.
+ *
*
- *
+ *
* @author lvenable
* @version 1.0
*/
@@ -187,7 +188,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Constructor.
- *
+ *
* @param parent
* Parent composite.
* @param groupTxt
@@ -237,6 +238,7 @@ public class AreaComp extends Composite implements ISubset {
setupData();
createControls();
+ updateRegionControls();
if (regionRdo.getSelection()) {
// Try to find the smallest region that intersects, assum regions
// are listed largest to smallest.
@@ -293,7 +295,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Create the bound controls.
- *
+ *
* @param group
* Group container.
*/
@@ -361,7 +363,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Create the region and bounding box controls.
- *
+ *
* @param group
* Group container.
*/
@@ -486,7 +488,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Add a separator line to the display.
- *
+ *
* @param parentComp
* Parent component.
*/
@@ -502,7 +504,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Enable/Disable the region and bounding box controls. The bounding box
* control will always be the disabled if the region controls are enabled.
- *
+ *
*/
public void updateRegionControls() {
enableCustomControls(manualRdo.getSelection());
@@ -513,7 +515,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Set controls enabled based on flag.
- *
+ *
* @param flag
* true if controls should be enabled
*/
@@ -524,7 +526,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Set text controls enabled based on flag.
- *
+ *
* @param flag
* true if text controls should be enabled
*/
@@ -544,7 +546,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Get the text background based on if the control is enabled or not
- *
+ *
* @param enabled
* enabled flag
*/
@@ -560,7 +562,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Enable the regions control based on the flag.
- *
+ *
* @param flag
* enabled state of the controls
*/
@@ -575,7 +577,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Enable the bounding box controls base on the flag.
- *
+ *
* @param flag
* enabled state of the controls
*/
@@ -585,7 +587,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Enable all controls using flag.
- *
+ *
* @param flag
* on/off toggle for controls.
*/
@@ -753,7 +755,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Get the user Regions.
- *
+ *
* @return array of user regions
*/
private String[] getUserRegions() {
@@ -852,7 +854,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Get a double from text.
- *
+ *
* @param text
* The double String
* @return double, Double.NaN if unable to parse
@@ -879,6 +881,10 @@ public class AreaComp extends Composite implements ISubset {
}
}
+ /**
+ * {@inheritDoc}
+ */
+ @Override
public void updateBounds(ReferencedEnvelope envelope) {
Coordinate ul = EnvelopeUtils.getUpperLeftLatLon(envelope);
Coordinate lr = EnvelopeUtils.getLowerRightLatLon(envelope);
@@ -895,7 +901,7 @@ public class AreaComp extends Composite implements ISubset {
/*
* (non-Javadoc)
- *
+ *
* @see com.raytheon.uf.viz.datadelivery.subscription.subset.ISubset#
* updateSelectionState(boolean, java.lang.String)
*/
@@ -906,7 +912,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Select the custom radio button
- *
+ *
* @param regionName
*/
public void setRegion(String regionName) {
@@ -941,12 +947,11 @@ public class AreaComp extends Composite implements ISubset {
}
index++;
}
-
}
/**
* Select the custom radio button.
- *
+ *
* @return region name
*/
public String getRegionName() {
@@ -980,7 +985,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* Switch to "My Regions" as the active selection and select the provided
* region name.
- *
+ *
* @param regionName
*/
public void showMyRegions(String regionName) {
@@ -1009,7 +1014,7 @@ public class AreaComp extends Composite implements ISubset {
/**
* @return the envelopeValid
*/
- public boolean isEnvelopeValid() {
+ public boolean isEnvelopeValid() {
return envelopeValid;
}
@@ -1033,6 +1038,6 @@ public class AreaComp extends Composite implements ISubset {
validateBoundsText();
}
- }
-
+ }
+
}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/LoadSaveConfigDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/LoadSaveConfigDlg.java
index 578ba96dcb..524336b5a8 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/LoadSaveConfigDlg.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/LoadSaveConfigDlg.java
@@ -62,6 +62,7 @@ import com.raytheon.uf.viz.datadelivery.filter.config.xml.FilterTypeXML;
import com.raytheon.uf.viz.datadelivery.notification.xml.NotificationConfigXML;
import com.raytheon.uf.viz.datadelivery.notification.xml.NotificationFilterXML;
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.DateRangeTimeXML;
+import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.PointTimeXML;
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SpecificDateTimeXML;
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML;
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.TimeXML;
@@ -84,6 +85,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Jun 19, 2012 717 jpiatt Save action update.
* Aug 22, 2012 0743 djohnson Add new TimeXML sub-classes.
* Apr 25, 2013 1820 mpduff Implement deletion of config file.
+ * Jun 04, 2013 223 mpduff Refactor method rename and add new class to JaxB context.
*
*
*
@@ -635,7 +637,7 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
NotificationFilterXML.class, FilterSettingsXML.class,
FilterTypeXML.class, SubscriptionManagerConfigXML.class,
SubsetXML.class, TimeXML.class, SpecificDateTimeXML.class,
- DateRangeTimeXML.class, VerticalXML.class };
+ DateRangeTimeXML.class, VerticalXML.class, PointTimeXML.class };
try {
jax = JAXBContext.newInstance(classes);
@@ -822,7 +824,7 @@ public class LoadSaveConfigDlg extends CaveSWTDialog {
if (obj instanceof IDisplayXml) {
IDisplayXml dispXml = (IDisplayXml) obj;
- previewTxt.setText(dispXml.getDisplayXmlString());
+ previewTxt.setText(dispXml.getPreviewString());
} else {
this.marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
true);
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/PriorityComp.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/PriorityComp.java
index 180afac3f5..19bcf377b7 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/PriorityComp.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/PriorityComp.java
@@ -46,6 +46,7 @@ import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPri
* Aug 21, 2012 712 mpduff Default to Default, and allow for setting the combo box.
* Jan 04, 2013 1420 mpduff Add latency.
* Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers.
+ * Jun 04, 2013 223 mpduff Changes for Point Data.
*
*
*
@@ -65,6 +66,10 @@ public class PriorityComp extends Composite {
/** The priority value */
private SubscriptionPriority priority;
+ private final boolean readOnlyLatency;
+
+ private Label latencyLabel;
+
/**
* Constructor.
*
@@ -74,10 +79,11 @@ public class PriorityComp extends Composite {
* @param priority
*/
public PriorityComp(Composite parent, int latency,
- SubscriptionPriority priority) {
+ SubscriptionPriority priority, boolean readOnlyLatency) {
super(parent, SWT.NONE);
this.latency = latency;
this.priority = priority;
+ this.readOnlyLatency = readOnlyLatency;
init();
}
@@ -151,12 +157,21 @@ public class PriorityComp extends Composite {
Label latencyLbl = new Label(latencyComp, SWT.NONE);
latencyLbl.setText("Latency (Minutes):");
- latencyText = new Text(latencyComp, SWT.BORDER);
- latencyText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true,
- false));
- latencyText
- .setToolTipText("Time in minutes allotted for a subscription to download");
- latencyText.setText(String.valueOf(this.latency));
+ if (readOnlyLatency) {
+ latencyLabel = new Label(latencyComp, SWT.BORDER);
+ latencyLabel.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT,
+ true, false));
+ latencyLabel
+ .setToolTipText("Point Data's latency is the retrieval interval.");
+ latencyLabel.setText(String.valueOf(this.latency));
+ } else {
+ latencyText = new Text(latencyComp, SWT.BORDER);
+ latencyText.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true,
+ false));
+ latencyText
+ .setToolTipText("Time in minutes allotted for a subscription to download");
+ latencyText.setText(String.valueOf(this.latency));
+ }
}
/**
@@ -185,7 +200,13 @@ public class PriorityComp extends Composite {
* entry entered
*/
public int getLatencyValue() {
- String latency = latencyText.getText().trim();
+ String latency;
+ if (latencyText != null) {
+ latency = latencyText.getText().trim();
+ } else {
+ latency = latencyLabel.getText();
+ }
+
int intLatency;
try {
intLatency = Integer.parseInt(latency);
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/SubscriptionViewer.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/SubscriptionViewer.java
index ade517177d..b2e70ca470 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/SubscriptionViewer.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/SubscriptionViewer.java
@@ -33,6 +33,8 @@ import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Shell;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionAction;
+import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionManagerFilter;
+import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionManagerFilters;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionTableComp;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionTableComp.SubscriptionType;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
@@ -53,6 +55,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* Dec 03, 2012 1269 mpduff Change to take a list of subscriptions for the view mode.
* Dec 10, 2012 1300 bgonzale Table filtering by dataset and provider.
* May 23, 2012 2020 mpduff Implement method.
+ * May 28, 2013 1650 djohnson Filters now control what subscriptions are shown.
*
*
* @author mpduff
@@ -179,16 +182,16 @@ public class SubscriptionViewer extends AbstractViewDlg implements
tableConfig.setTableStyle(SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
| SWT.MULTI | SWT.FULL_SELECTION);
tableConfig.setTableHeight(200);
- tableComp = new SubscriptionTableComp(shell, tableConfig, this,
- SubscriptionType.VIEWER);
- if (isTableFilteredByDatasetAndProvider()) {
- tableComp.populateActiveFilteredDataByDataSetAndProvider(
- datasetName, providerName);
- } else {
- tableComp.setSubscriptionNameList(this.subscriptionNameList);
- tableComp.populateData();
- }
+ ISubscriptionManagerFilter filter = (isTableFilteredByDatasetAndProvider()) ? SubscriptionManagerFilters
+ .getByProviderAndDataSet(providerName, datasetName) :
+SubscriptionManagerFilters
+ .getByNames(this.subscriptionNameList);
+
+ tableComp = new SubscriptionTableComp(shell, tableConfig, this,
+ SubscriptionType.VIEWER, filter);
+
+ tableComp.populateData();
tableComp.populateTable();
}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/UserSelectComp.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/UserSelectComp.java
index 3ba53d7ba4..df617e40b6 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/UserSelectComp.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/ui/UserSelectComp.java
@@ -93,6 +93,8 @@ import com.raytheon.viz.ui.widgets.duallist.IUpdate;
* Jan 02, 2013 1441 djohnson Access GroupDefinitionManager in a static fashion.
* Apr 08, 2013 1826 djohnson Remove unused code, delivery options.
* May 15, 2013 1040 mpduff OfficeID is now a list so need to add it rather than set it.
+ * May 23, 2013 1650 djohnson Fix creation of new GroupDefinitions.
+ * May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
*
*
* @author jpiatt
@@ -359,6 +361,10 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay,
// Get Group Definition
GroupDefinition groupDefinition = GroupDefinitionManager
.getGroup(groupName);
+ if (groupDefinition == null) {
+ groupDefinition = new GroupDefinition();
+ groupDefinition.setGroupName(groupName);
+ }
for (Subscription subscription : groupSubscriptions) {
@@ -499,15 +505,20 @@ public class UserSelectComp extends Composite implements IUpdate, IDisplay,
public String getOptionDisplayText(ForceApplyPromptResponse option,
int requiredLatency, Subscription subscription,
Set wouldBeUnscheduledSubscriptions) {
+ final boolean singleSubscription = wouldBeUnscheduledSubscriptions
+ .size() == 1;
switch (option) {
case CANCEL:
return "Do not update the group definition.";
case FORCE_APPLY:
- if (wouldBeUnscheduledSubscriptions.size() == 1) {
+ if (singleSubscription) {
return "Update the group definition and unschedule "
+ wouldBeUnscheduledSubscriptions.iterator().next();
}
return "Update the group definition and unschedule the subscriptions";
+ case EDIT_SUBSCRIPTIONS:
+ return "Edit the "
+ + ((singleSubscription) ? "subscription" : "subscriptions");
case INCREASE_LATENCY:
// Signifies it should not be an option
return null;
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/xml/AreaXML.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/xml/AreaXML.java
index 4c56283b12..d40039ebc7 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/xml/AreaXML.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/xml/AreaXML.java
@@ -46,6 +46,7 @@ import com.vividsolutions.jts.geom.Coordinate;
* Mar 27, 2012 mpduff Initial creation.
* Jun 7, 2012 684 jpiatt Added region name.
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
+ * Jun 04, 2013 223 mpduff Changed method name.
*
*
*
@@ -101,7 +102,7 @@ public class AreaXML implements IDisplayXml {
* ()
*/
@Override
- public String getDisplayXmlString() {
+ public String getPreviewString() {
StringBuilder sb = new StringBuilder();
sb.append("Type: Area\n");
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/xml/IDisplayXml.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/xml/IDisplayXml.java
index 2a9cbbfa48..20b147d620 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/xml/IDisplayXml.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/common/xml/IDisplayXml.java
@@ -29,6 +29,7 @@ package com.raytheon.uf.viz.datadelivery.common.xml;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 29, 2012 lvenable Initial creation
+ * Jun 04, 2013 223 mpduff Change method name to getPreviewString
*
*
*
@@ -37,5 +38,10 @@ package com.raytheon.uf.viz.datadelivery.common.xml;
*/
public interface IDisplayXml {
- String getDisplayXmlString();
+ /**
+ * Get the xml contents in a formatted string for display.
+ *
+ * @return the formatted string
+ */
+ String getPreviewString();
}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/MetaDataManager.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/MetaDataManager.java
index 51cd728996..d8036611bd 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/MetaDataManager.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/MetaDataManager.java
@@ -37,7 +37,7 @@ import com.raytheon.uf.common.datadelivery.registry.DataLevelType.LevelType;
import com.raytheon.uf.common.datadelivery.registry.DataSet;
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.Provider;
-import com.raytheon.uf.common.datadelivery.registry.Provider.ProviderType;
+import com.raytheon.uf.common.datadelivery.registry.ProviderType;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.status.IUFStatusHandler;
@@ -67,6 +67,7 @@ import com.raytheon.uf.viz.datadelivery.filter.config.xml.FilterTypeXML;
* Oct 05, 2012 1241 djohnson Replace RegistryManager calls with registry handler calls.
* Nov 19, 2012 1166 djohnson Clean up JAXB representation of registry objects.
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
+ * Jun 04, 2013 223 mpduff Add data set type to filter.
*
*
*
@@ -170,7 +171,7 @@ public class MetaDataManager {
.getAll()) {
for (ProviderType type : provider.getProviderType()) {
- typeSet.add(type.toString());
+ typeSet.add(type.getDataType().toString());
}
}
} catch (RegistryHandlerException e) {
@@ -291,10 +292,13 @@ public class MetaDataManager {
}
}
+ // Add data set types
+ List dataSetTypes = xml.getDataSetTypes();
+
try {
filteredDataSets.addAll(DataDeliveryHandlers.getDataSetHandler()
.getByFilters(providers, dataSetNames, levels,
- parameterNames, envelope));
+ parameterNames, dataSetTypes, envelope));
} catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM,
"Unable to retrieve the filtered datasets.", e);
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/config/xml/FilterSettingsXML.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/config/xml/FilterSettingsXML.java
index c2a428ceab..0c4e4ef25d 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/config/xml/FilterSettingsXML.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/config/xml/FilterSettingsXML.java
@@ -20,6 +20,7 @@
package com.raytheon.uf.viz.datadelivery.filter.config.xml;
import java.util.ArrayList;
+import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
@@ -39,7 +40,8 @@ import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Feb 27, 2012 mpduff Initial creation
+ * Feb 27, 2012 mpduff Initial creation.
+ * Jun 04, 2012 223 mpduff Add data set type and refactor method name change.
*
*
*
@@ -51,10 +53,13 @@ import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml;
public class FilterSettingsXML implements IDisplayXml {
@XmlElements({ @XmlElement(name = "Filter", type = FilterTypeXML.class) })
protected ArrayList filterTypeList = new ArrayList();
-
+
@XmlElement(name = "area", type = AreaXML.class)
protected AreaXML area;
+ @XmlElements({ @XmlElement(name = "DataSetType", type = String.class) })
+ protected List dataSetTypes = new ArrayList();
+
/**
* @return the filterTypeList
*/
@@ -87,17 +92,17 @@ public class FilterSettingsXML implements IDisplayXml {
* ()
*/
@Override
- public String getDisplayXmlString() {
+ public String getPreviewString() {
final String newline = "\n";
StringBuilder sb = new StringBuilder();
-
+
for (FilterTypeXML ftx : filterTypeList) {
- sb.append(ftx.getDisplayXmlString());
+ sb.append(ftx.getPreviewString());
sb.append(newline);
}
-
+
if (area != null) {
- sb.append(area.getDisplayXmlString()).append(newline);
+ sb.append(area.getPreviewString()).append(newline);
}
return sb.toString();
@@ -111,9 +116,33 @@ public class FilterSettingsXML implements IDisplayXml {
}
/**
- * @param area the area to set
+ * @param area
+ * the area to set
*/
public void setArea(AreaXML area) {
this.area = area;
}
+
+ /**
+ * @return the dataSetTypes
+ */
+ public List getDataSetTypes() {
+ return dataSetTypes;
+ }
+
+ /**
+ * @param dataSetTypes
+ * the dataSetTypes to set
+ */
+ public void setDataSetTypes(List dataSetTypes) {
+ this.dataSetTypes = dataSetTypes;
+ }
+
+ /**
+ * @param type
+ * the type to add
+ */
+ public void addDataSetType(String type) {
+ this.dataSetTypes.add(type);
+ }
}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/config/xml/FilterTypeXML.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/config/xml/FilterTypeXML.java
index 9db583d7a4..479e3e5cc8 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/config/xml/FilterTypeXML.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/filter/config/xml/FilterTypeXML.java
@@ -38,7 +38,8 @@ import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Jan 30, 2012 mpduff Initial creation
+ * Jan 30, 2012 mpduff Initial creation.
+ * Jun 04, 2013 mpduff Changed method name.
*
*
*
@@ -100,7 +101,7 @@ public class FilterTypeXML implements IDisplayXml {
* ()
*/
@Override
- public String getDisplayXmlString() {
+ public String getPreviewString() {
StringBuilder sb = new StringBuilder();
sb.append("Type: ").append(this.filterType).append("\n");
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/DataDeliveryHelp.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/DataDeliveryHelp.java
deleted file mode 100644
index 7d1dabf7af..0000000000
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/DataDeliveryHelp.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.raytheon.uf.viz.datadelivery.help;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.browser.Browser;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Find dialog for the Notification Table.
- *
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * May 18, 2012 645 jpiatt Initial creation.
- *
- *
- *
- * @author jpiatt
- * @version 1.0
- */
-
-public abstract class DataDeliveryHelp {
-
- /** Parent shell */
- protected Shell parentShell;
-
- /** Browser object */
- protected Browser browser;
-
- /** Help Text */
- protected String helpText;
-
- /** Parent shell. */
- Shell shell;
-
- /**
- * Open the browser to display the help text.
- */
- public void open() {
-
- Display display = parentShell.getDisplay();
- shell = new Shell(display);
- shell.setLayout(new FillLayout());
- Browser browser;
- try {
- browser = new Browser(shell, SWT.NONE);
- } catch (SWTError e) {
- System.out.println("Could not instantiate Browser: " + e.getMessage());
- display.dispose();
- return;
- }
-
- browser.setText(helpText);
- shell.open();
- while (!shell.isDisposed()) {
- if (!display.readAndDispatch())
- display.sleep();
- }
-
- close();
- shell.dispose();
-
- }
-
- /**
- * Set isDisposed boolean.
- *
- * @return boolean
- */
- public boolean isDisposed() {
- return (shell != null && shell.isDisposed());
- }
-
- /**
- * Bring the dialog to top.
- */
- public final void bringToTop() {
- if (shell != null && shell.isDisposed() == false) {
- shell.setVisible(true);
- shell.forceFocus();
- shell.forceActive();
- }
- }
-
- /**
- * Closes the shell.
- * @return
- * boolean
- *
- */
- public final boolean close() {
- if (shell != null && shell.isDisposed() == false) {
- shell.dispose();
- }
- return true;
- }
-
-}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/DataDeliveryHelpDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/DataDeliveryHelpDlg.java
new file mode 100644
index 0000000000..3d4bc82d05
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/DataDeliveryHelpDlg.java
@@ -0,0 +1,151 @@
+package com.raytheon.uf.viz.datadelivery.help;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Layout;
+import org.eclipse.swt.widgets.Shell;
+
+import com.raytheon.uf.common.util.StringUtil;
+import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
+
+/**
+ * Help dialog for Data Delivery.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * 06/06/2013 2030 mpduff Initial creation.
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+
+public class DataDeliveryHelpDlg extends CaveSWTDialog {
+ /** Styled Text control */
+ private StyledText styledText;
+
+ /** List of StyleRange objects */
+ private final List ranges = new ArrayList();
+
+ /** Pattern for 1 or more spaces */
+ private static final Pattern pattern = Pattern.compile(" +");
+
+ /** Help JaxB xml object */
+ private final DataDeliveryHelpXML helpXml;
+
+ /**
+ * Constructor.
+ *
+ * @param parentShell
+ * Parent shell.
+ * @param helpXml
+ * The JaxB xml object
+ */
+
+ public DataDeliveryHelpDlg(Shell parentShell, DataDeliveryHelpXML helpXml) {
+ super(parentShell, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE,
+ CAVE.DO_NOT_BLOCK | CAVE.NO_PACK);
+ this.helpXml = helpXml;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
+ */
+ @Override
+ protected Layout constructShellLayout() {
+ return new GridLayout(1, false);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayoutData()
+ */
+ @Override
+ protected Object constructShellLayoutData() {
+ return new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initializeComponents(Shell shell) {
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ GridLayout gl = new GridLayout(1, false);
+ shell.setLayout(gl);
+ shell.setLayoutData(gd);
+
+ gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gl = new GridLayout(1, false);
+
+ styledText = new StyledText(shell, SWT.WRAP | SWT.BORDER | SWT.V_SCROLL);
+ styledText.setLayout(gl);
+ styledText.setLayoutData(gd);
+
+ String text = getHelpText();
+ styledText.setText(text);
+ styledText.setLineAlignment(0, 1, SWT.CENTER);
+
+ for (StyleRange sr : ranges) {
+ styledText.setStyleRange(sr);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void opened() {
+ shell.setMinimumSize(400, 600);
+ }
+
+ /**
+ * Get the help text from the xml.
+ *
+ * @return The help text String
+ */
+ private String getHelpText() {
+ StringBuilder buffer = new StringBuilder();
+
+ this.setText(helpXml.getTitle());
+
+ // indices for style ranges start and end
+ int startIdx = 0;
+ for (HelpEntryXML entry : helpXml.getEntryList()) {
+ startIdx = buffer.length();
+ buffer.append(entry.getHeader().trim()).append(StringUtil.NEWLINE);
+ StyleRange sr = new StyleRange();
+ sr.start = startIdx;
+ sr.length = buffer.length() - startIdx;
+ sr.fontStyle = SWT.BOLD;
+ ranges.add(sr);
+ Matcher matcher = pattern.matcher(entry.getText().trim());
+ String text = matcher.replaceAll(" ");
+ if (text.length() > 0) {
+ buffer.append(text).append(StringUtil.NEWLINE)
+ .append(StringUtil.NEWLINE);
+ } else {
+ buffer.append(StringUtil.NEWLINE);
+ }
+ }
+
+ return buffer.toString();
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/DataDeliveryHelpXML.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/DataDeliveryHelpXML.java
new file mode 100644
index 0000000000..b08636f3c1
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/DataDeliveryHelpXML.java
@@ -0,0 +1,93 @@
+/**
+ * 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.uf.viz.datadelivery.help;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * JaxB xml object for Data Delivery Help.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 4, 2013 2030 mpduff Initial creation.
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+
+@XmlRootElement(name = "Help")
+@XmlAccessorType(XmlAccessType.NONE)
+public class DataDeliveryHelpXML {
+
+ /**
+ * The help title.
+ */
+ @XmlElement
+ private String title;
+
+ /**
+ * The help topic entries.
+ */
+ @XmlElements({ @XmlElement(name = "helpEntry", type = HelpEntryXML.class) })
+ protected List entryList = new ArrayList();
+
+ /**
+ * @return the title
+ */
+ public String getTitle() {
+ return title;
+ }
+
+ /**
+ * @param title
+ * the title to set
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+ /**
+ * @return the entryList
+ */
+ public List getEntryList() {
+ return entryList;
+ }
+
+ /**
+ * @param entryList
+ * the entryList to set
+ */
+ public void setEntryist(List entryList) {
+ this.entryList = entryList;
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/HelpEntryXML.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/HelpEntryXML.java
new file mode 100644
index 0000000000..2d2d3a66e2
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/HelpEntryXML.java
@@ -0,0 +1,89 @@
+/**
+ * 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.uf.viz.datadelivery.help;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * HelpEntry JaxB object.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 4, 2013 2030 mpduff Initial creation.
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+
+@XmlRootElement(name = "HelpEntry")
+@XmlAccessorType(XmlAccessType.NONE)
+public class HelpEntryXML {
+
+ /**
+ * Help entry header.
+ */
+ @XmlElement
+ private String header;
+
+ /**
+ * Help entry text.
+ */
+ @XmlElement
+ private String text;
+
+ /**
+ * @return the header
+ */
+ public String getHeader() {
+ return header;
+ }
+
+ /**
+ * @param header
+ * the header to set
+ */
+ public void setHeader(String header) {
+ this.header = header;
+ }
+
+ /**
+ * @return the text
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @param text
+ * the text to set
+ */
+ public void setText(String text) {
+ this.text = text;
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/HelpManager.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/HelpManager.java
new file mode 100644
index 0000000000..d5bd6b3f03
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/help/HelpManager.java
@@ -0,0 +1,146 @@
+/**
+ * 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.uf.viz.datadelivery.help;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
+import org.eclipse.swt.widgets.Shell;
+
+import com.raytheon.uf.common.localization.IPathManager;
+import com.raytheon.uf.common.localization.LocalizationFile;
+import com.raytheon.uf.common.localization.PathManagerFactory;
+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.viz.ui.dialogs.ICloseCallback;
+
+/**
+ * Data Delivery Help Dialog manager class.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 4, 2013 mpduff Initial creation
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+
+public class HelpManager {
+ /** Status Handler */
+ private final IUFStatusHandler statusHandler = UFStatus
+ .getHandler(HelpManager.class);
+
+ /** Class instance */
+ private static HelpManager instance = null;
+
+ /** JAXB context */
+ private JAXBContext jax;
+
+ /** Unmarshaller object */
+ private Unmarshaller unmarshaller;
+
+ /** Help dialog map for managing open help dialogs */
+ private final Map helpMap = new HashMap();
+
+ /**
+ * Private constructor.
+ *
+ * @throws JAXBException
+ */
+ private HelpManager() throws JAXBException {
+ createContext();
+ }
+
+ /**
+ * Get the only instance of this class.
+ *
+ * @return The instance
+ * @throws Exception
+ */
+ public static final synchronized HelpManager getInstance() throws Exception {
+ if (instance == null) {
+ instance = new HelpManager();
+ }
+ return instance;
+ }
+
+ /**
+ * Create the JAXB context
+ *
+ * @throws JAXBException
+ */
+ private void createContext() throws JAXBException {
+ Class[] classes = new Class[] { DataDeliveryHelpXML.class,
+ HelpEntryXML.class };
+
+ jax = JAXBContext.newInstance(classes);
+ this.unmarshaller = jax.createUnmarshaller();
+ }
+
+ /**
+ * Display a help dialog.
+ *
+ * @param shell
+ * The parent shell
+ * @param helpFile
+ * The file containing the text
+ */
+ public void displayHelpDialog(Shell shell, final String helpFile) {
+ if (helpMap.containsKey(helpFile)) {
+ helpMap.get(helpFile).bringToTop();
+ return;
+ }
+
+ IPathManager pm = PathManagerFactory.getPathManager();
+ LocalizationFile locFile = pm.getStaticLocalizationFile(helpFile);
+ DataDeliveryHelpXML xml = new DataDeliveryHelpXML();
+
+ if (locFile != null && locFile.exists()) {
+ try {
+ xml = (DataDeliveryHelpXML) unmarshaller.unmarshal(locFile
+ .getFile());
+ DataDeliveryHelpDlg helpDlg = new DataDeliveryHelpDlg(shell, xml);
+ helpDlg.setCloseCallback(new ICloseCallback() {
+ @Override
+ public void dialogClosed(Object returnValue) {
+ helpMap.remove(helpFile);
+ }
+ });
+
+ helpMap.put(helpFile, helpDlg);
+ helpDlg.open();
+ } catch (JAXBException e) {
+ statusHandler.handle(Priority.ERROR,
+ "Error displaying help dialog for file " + helpFile, e);
+ }
+ }
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationDlg.java
index 66c8f2c5a6..ee717a2033 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationDlg.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationDlg.java
@@ -65,6 +65,7 @@ import com.raytheon.uf.viz.datadelivery.common.ui.ITableChange;
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg;
import com.raytheon.uf.viz.datadelivery.common.ui.LoadSaveConfigDlg.DialogType;
import com.raytheon.uf.viz.datadelivery.common.ui.TableCompConfig;
+import com.raytheon.uf.viz.datadelivery.help.HelpManager;
import com.raytheon.uf.viz.datadelivery.notification.PriorityImages.Priority;
import com.raytheon.uf.viz.datadelivery.notification.xml.MessageLoadXML;
import com.raytheon.uf.viz.datadelivery.notification.xml.NotificationConfigXML;
@@ -97,6 +98,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Update title bar text when paused.
* Jan 22, 2013 1520 mpduff Change delete menus to hide.
* Apr 25, 2013 1820 mpduff Implemente delete config.
+ * Jun 06, 2013 2030 mpduff Refactored help.
*
*
*
@@ -108,7 +110,7 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
IMessageLoad, INotificationArrivedListener {
/** Status Handler */
- private final transient IUFStatusHandler statusHandler = UFStatus
+ private final IUFStatusHandler statusHandler = UFStatus
.getHandler(NotificationDlg.class);
private final String TITLE_TEXT = "Notification Center";
@@ -116,12 +118,12 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
/** Find Dialog */
private FindDlg fnd = null;
- /** Help Dialog */
- private final NotificationHelpDlg help = null;
-
/** Message load properties */
private MessageLoadXML messageLoad;
+ /** Help text file */
+ private final String NOTIFICATION_HELP_FILE = "help/notificationHelp.xml";
+
/** Path of the Notification Config xml file */
private final String CONFIG_PATH = "dataDelivery" + File.separator
+ "notificationManagerConfig";
@@ -490,15 +492,13 @@ public class NotificationDlg extends CaveSWTDialog implements ITableChange,
* Handle the help display dialog.
*/
private void handleHelp() {
-
- if (help == null || help.isDisposed()) {
- NotificationHelpDlg help = new NotificationHelpDlg(shell);
- help.open();
- help = null;
- } else {
- help.bringToTop();
+ try {
+ HelpManager.getInstance().displayHelpDialog(shell,
+ NOTIFICATION_HELP_FILE);
+ } catch (Exception e) {
+ statusHandler.error("Error loading Help Text file: "
+ + NOTIFICATION_HELP_FILE, e);
}
-
}
/**
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationHelpDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationHelpDlg.java
deleted file mode 100644
index a8da1fa8b8..0000000000
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/notification/NotificationHelpDlg.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package com.raytheon.uf.viz.datadelivery.notification;
-
-import org.eclipse.swt.widgets.Shell;
-
-import com.raytheon.uf.viz.datadelivery.help.DataDeliveryHelp;
-
-/**
- * Help dialog for the Notification Table.
- *
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * May 18, 2012 645 jpiatt Initial creation.
- *
- *
- *
- * @author jpiatt
- * @version 1.0
- */
-
-public class NotificationHelpDlg extends DataDeliveryHelp {
-
-
- /**
- * Constructor.
- * @param parentShell
- * Parent shell.
- */
-
- public NotificationHelpDlg(Shell parentShell) {
-
- this.parentShell = parentShell;
- this.helpText = getHelpText();
-
- }
-
- /**
- * Get the Help Text.
- *
- * @return String
- * Help Text.
- */
- private String getHelpText() {
-
- String helpText = "Notification Table Help " +
- "The Notification Center Table allows a user to view and delete " +
- "data delivery notifications. " +
-// "File " +
-// "Edit " +
-// "Settings " +
- "" +
- " " +
- " File "+
- " " +
- " Set As Default " +
- " Set the current configuration settings to be the default " +
- " settings for the table. When the table is opened the " +
- " saved default settings are applied. " +
- " Load Configuration... " +
- " Load a previously saved configuration file. Select from the Available " +
- " Configuration Files list and click the Load button to load a configuration " +
- " file. Use the Preview button to view the XML associated with the " +
- " configuration file. " +
- " Save Configuration " +
- " Save the current configuration settings to the most recently " +
- " saved file name. The first time Save Configuration is accessed, " +
- " select to save either at the User or Site level and enter a file name. " +
- " Click the Save button to save the file. Use the Load Configuration " +
- " menu item to load a saved configuration. " +
- " Save Configuration As... " +
- " Save the current configuration settings to a named file " +
- " that may be loaded in the future. In the Save Configuration dialog " +
- " select to save either at the User or Site level and enter a file name. " +
- " Click the Save button to save the file. Use the Load Configuration " +
- " menu item to load a saved configuration. " +
- " Delete Configuration... " +
- " Delete a saved configuration file. " +
- " Exit " +
- " Exit the table. " +
- " " +
- " Edit " +
- " " +
- " Find... " +
- " Find and highlight items in the table using the Find dialog. The " +
- " Case Sensitive option allows a user to search text that is capitalization " +
- " sensitive. The Exclude option allows a user to search the table for " +
- " items that exclude the entered text. The Case Sensitive and Exclude options " +
- " may be used in conjunction with another. The Column Selection grouping allows " +
- " users to search a specific column in the table. After the search criteria " +
- " has been selected, click the Find Next button to perform the search. The " +
- " Hightlight All button highlights all the rows matching the find " +
- " criteria. Close the Find dialog using the Close button. " +
- " Delete by Priority " +
- " Delete all rows in the table having a specific priority. (Note: Notifications " +
- " only deleted from the user view and not permanently deleted from the database.) " +
- " Delete Older Than Selected " +
- " Delete all rows in the table having a date in the Time column that is older " +
- " than the currently highlighted row. (Note: Notifications " +
- " only deleted from the user view and not permanently deleted from the database.) " +
- " Delete Notification(s) " +
- " Delete the currently highlighted row(s) in the table. (Note: Notifications " +
- " only deleted from the user view and not permanently deleted from the database.) " +
- " " +
- " Settings " +
- " " +
- " Configure Table... " +
- " The Initial Startup Configuration items are set when the table is opened. " +
- " Check the Load All Messages check box to display all messages in the table that " +
- " are contained in the database. Enter a number of messages or hours amount in the " +
- " Load Last spinner to select the amount of messages or number of hours of messages " +
- " to display in the table. Set the Initial Sort Column and either Sort Ascending " +
- " or Sort Descending to sort the table by a specific colum upon opening. " +
- " The Display Configuration items refresh the table upon clicking OK . Select the " +
- " number of Rows Per Page using the selection drop down. Select the image setting " +
- " for the Priority table column using the radio buttons. Select to make columns " +
- " hidden or visible using the arrows provided. After making selections, click the OK " +
- " button to configure the table. (Note: Unless the configuration is set to the default " +
- " or saved, changes will be lost when the table is closed.) " +
- " Filter Table... " +
- " A user may filter the table by user, by subscription or by priority. In the Filter by " +
- " User section, the list of available user names are in the Available Users column. If users are moved " +
- " to the Selected Users list, the corresponding columns containing those user names will be " +
- " displayed in the Notification Table. Use the arrows to move users back and forth from the " +
- " Available Users list to the Selected Users list. (Note: User names are not duplicated and " +
- " appear only once either in the Available or Selected lists.) The Always include my notifications " +
- " check box may be used to keep the currently logged in user in the Selected Users column. " +
- " In the Filter by Subscription section, the list of available subscription names are in the " +
- " Available Subscriptions column. If subscriptions are moved to the Selected Subscriptions list " +
- " the corresponding columns containing those subscription names will be displayed in the " +
- " Notification Table. Use the arrows to move subscriptions back and forth from the " +
- " Available Subscriptions list to the Selected Subscriptions list. (Note: Subscription " +
- " names are not duplicated and appear only once either in the Available or Selected lists.)" +
- " In the Filter by Priority section, select which columns containing specific priorities to " +
- " display using the checkboxes." +
- " " +
- "";
-
- return helpText;
-
- }
-
-}
-
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CancelForceApplyAndIncreaseLatencyDisplayText.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CancelForceApplyAndIncreaseLatencyDisplayText.java
index e3d5702ed7..4df123b53d 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CancelForceApplyAndIncreaseLatencyDisplayText.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CancelForceApplyAndIncreaseLatencyDisplayText.java
@@ -38,6 +38,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceA
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Dec 4, 2012 1286 djohnson Initial creation
+ * May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
*
*
*
@@ -78,17 +79,22 @@ public class CancelForceApplyAndIncreaseLatencyDisplayText implements
int requiredLatency, Subscription subscription,
Set wouldBeUnscheduledSubscriptions) {
final String name = subscription.getName();
+ final boolean singleSubscription = wouldBeUnscheduledSubscriptions
+ .size() == 1;
switch (option) {
case CANCEL:
return "Do not " + actionText + " " + name;
case FORCE_APPLY:
- if (wouldBeUnscheduledSubscriptions.size() == 1
+ if (singleSubscription
&& wouldBeUnscheduledSubscriptions.contains(name)) {
return titleCaseActionText + " " + name
+ " and leave in an unscheduled status";
}
return titleCaseActionText + " " + name
+ " and unschedule the others";
+ case EDIT_SUBSCRIPTIONS:
+ return "Edit the "
+ + ((singleSubscription) ? "subscription" : "subscriptions");
case INCREASE_LATENCY:
return "Increase the latency on " + name + " to " + requiredLatency
+ " minutes";
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CreateSubscriptionDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CreateSubscriptionDlg.java
index 1b9b757202..f7bc585894 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CreateSubscriptionDlg.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/CreateSubscriptionDlg.java
@@ -44,9 +44,12 @@ import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.raytheon.uf.common.auth.user.IUser;
+import com.raytheon.uf.common.datadelivery.registry.DataType;
+import com.raytheon.uf.common.datadelivery.registry.PointTime;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription.SubscriptionPriority;
import com.raytheon.uf.common.datadelivery.registry.ebxml.DataSetQuery;
+import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
@@ -97,6 +100,8 @@ import com.raytheon.viz.ui.presenter.components.CheckBoxConf;
* Jan 25, 2013 1528 djohnson Use priority enum instead of raw integers.
* Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Add Shared sites.
+ * Jun 04, 2013 223 mpduff Modify for point data.
+ * Jun 12, 2013 2038 djohnson No longer modal.
*
*
*
@@ -181,7 +186,7 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
* true for new subscription, false for edit
*/
public CreateSubscriptionDlg(Shell parent, boolean create) {
- super(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL,
+ super(parent, SWT.DIALOG_TRIM,
CAVE.INDEPENDENT_SHELL | CAVE.PERSPECTIVE_INDEPENDENT);
this.create = create;
@@ -218,13 +223,25 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
activePeriodComp = new ActivePeriodComp(mainComp);
// Get latency value
+ int latency = 15;
+ SubscriptionPriority priority = SubscriptionPriority.NORMAL;
SystemRuleManager ruleManager = SystemRuleManager.getInstance();
- int latency = ruleManager.getLatency(this.subscription, cycleTimes);
- SubscriptionPriority priority = ruleManager.getPriority(
- this.subscription, cycleTimes);
- priorityComp = new PriorityComp(mainComp, latency, priority);
- this.createCycleGroup();
+ if (this.subscription.getDataSetType() == DataType.GRID) {
+ latency = ruleManager.getLatency(subscription, cycleTimes);
+ priority = ruleManager.getPriority(subscription, cycleTimes);
+ priorityComp = new PriorityComp(mainComp, latency, priority, false);
+ } else if (this.subscription.getDataSetType() == DataType.POINT) {
+ // For point the latency is the retrieval interval
+ latency = ((PointTime) subscription.getTime()).getInterval();
+ priority = ruleManager.getPointDataPriority(subscription);
+ priorityComp = new PriorityComp(mainComp, latency, priority, true);
+ }
+
+ if (this.subscription.getDataSetType() == DataType.GRID) {
+ this.createCycleGroup();
+ }
+
createSiteSelection();
if (create == false) {
@@ -303,86 +320,89 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
GridLayout gl = new GridLayout(2, false);
- final Group group = new Group(mainComp, SWT.NONE);
- group.setLayout(gl);
- group.setLayoutData(gd);
- group.setText(" Shared Sites ");
+ if (DataDeliveryConstants.PHASE3_ENABLED) {
+ final Group group = new Group(mainComp, SWT.NONE);
+ group.setLayout(gl);
+ group.setLayoutData(gd);
+ group.setText(" Shared Sites ");
- gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false);
- gl = new GridLayout(2, false);
- final Composite c = new Composite(group, SWT.NONE);
- c.setLayout(gl);
- c.setLayoutData(gd);
+ gd = new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false);
+ gl = new GridLayout(2, false);
+ final Composite c = new Composite(group, SWT.NONE);
+ c.setLayout(gl);
+ c.setLayoutData(gd);
- gl = new GridLayout(1, false);
- gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
- final Button btn = new Button(c, SWT.NONE);
- btn.setLayoutData(new GridData(95, SWT.DEFAULT));
- btn.setText("Select Sites...");
- btn.setToolTipText("Select sites for sharing");
- btn.setEnabled(false);
+ gl = new GridLayout(1, false);
+ gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ final Button btn = new Button(c, SWT.NONE);
+ btn.setLayoutData(new GridData(95, SWT.DEFAULT));
+ btn.setText("Select Sites...");
+ btn.setToolTipText("Select sites for sharing");
+ btn.setEnabled(false);
- final DataDeliveryPermission permission = DataDeliveryPermission.SHARED_SUBSCRIPTION_CREATE;
- final IUser user = UserController.getUserObject();
- final String msg = user.uniqueId()
- + " is not authorized to create shared subscriptions. "
- + StringUtil.NEWLINE + "Permission: " + permission;
- try {
- if (DataDeliveryServices.getPermissionsService()
- .checkPermission(user, msg, permission).isAuthorized()) {
- btn.setEnabled(true);
- } else {
- c.addMouseTrackListener(new MouseTrackAdapter() {
+ final DataDeliveryPermission permission = DataDeliveryPermission.SHARED_SUBSCRIPTION_CREATE;
+ final IUser user = UserController.getUserObject();
+ final String msg = user.uniqueId()
+ + " is not authorized to create shared subscriptions. "
+ + StringUtil.NEWLINE + "Permission: " + permission;
+ try {
+ if (DataDeliveryServices.getPermissionsService()
+ .checkPermission(user, msg, permission).isAuthorized()) {
+ btn.setEnabled(true);
+ } else {
+ c.addMouseTrackListener(new MouseTrackAdapter() {
- @Override
- public void mouseExit(MouseEvent e) {
- DataDeliveryGUIUtils.hideToolTip();
- }
-
- @Override
- public void mouseHover(MouseEvent e) {
- handleMouseEvent(e, msg, group.getBounds());
- }
-
- @Override
- public void mouseEnter(MouseEvent e) {
- handleMouseEvent(e, msg, group.getBounds());
- }
- });
- }
- } catch (VizException e1) {
- statusHandler
- .handle(Priority.PROBLEM, e1.getLocalizedMessage(), e1);
- }
- btn.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- SiteSelectionDlg dlg = new SiteSelectionDlg(shell, "OAX",
- sharedSites);
- dlg.setCloseCallback(new ICloseCallback() {
- @Override
- public void dialogClosed(Object returnValue) {
- if (returnValue instanceof String[]) {
- String[] sites = (String[]) returnValue;
- processSites(sites);
+ @Override
+ public void mouseExit(MouseEvent e) {
+ DataDeliveryGUIUtils.hideToolTip();
}
- }
- });
- dlg.open();
+
+ @Override
+ public void mouseHover(MouseEvent e) {
+ handleMouseEvent(e, msg, group.getBounds());
+ }
+
+ @Override
+ public void mouseEnter(MouseEvent e) {
+ handleMouseEvent(e, msg, group.getBounds());
+ }
+ });
+ }
+ } catch (VizException e1) {
+ statusHandler.handle(Priority.PROBLEM,
+ e1.getLocalizedMessage(), e1);
}
- });
+ btn.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ SiteSelectionDlg dlg = new SiteSelectionDlg(shell, "OAX",
+ sharedSites);
+ dlg.setCloseCallback(new ICloseCallback() {
+ @Override
+ public void dialogClosed(Object returnValue) {
+ if (returnValue instanceof String[]) {
+ String[] sites = (String[]) returnValue;
+ processSites(sites);
+ }
+ }
+ });
+ dlg.open();
+ }
+ });
- selectedSiteLbl = new Label(group, SWT.BORDER);
- selectedSiteLbl.setFont(font);
- selectedSiteLbl.setText("");
- selectedSiteLbl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true,
- false));
+ selectedSiteLbl = new Label(group, SWT.BORDER);
+ selectedSiteLbl.setFont(font);
+ selectedSiteLbl.setText("");
+ selectedSiteLbl.setLayoutData(new GridData(SWT.FILL, SWT.CENTER,
+ true, false));
- if (!create) {
- if (subscription != null && subscription.getOfficeIDs().size() > 0) {
- String[] siteArr = subscription.getOfficeIDs().toArray(
- new String[subscription.getOfficeIDs().size()]);
- processSites(siteArr);
+ if (!create) {
+ if (subscription != null
+ && subscription.getOfficeIDs().size() > 0) {
+ String[] siteArr = subscription.getOfficeIDs().toArray(
+ new String[subscription.getOfficeIDs().size()]);
+ processSites(siteArr);
+ }
}
}
}
@@ -727,12 +747,15 @@ public class CreateSubscriptionDlg extends CaveSWTDialog implements
okBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
- status = Status.OK;
- getShell().setCursor(
- getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
- okConf.getOnClickAction().run();
- if (!getShell().isDisposed()) {
- getShell().setCursor(null);
+ try {
+ status = Status.OK;
+ getShell().setCursor(
+ getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
+ okConf.getOnClickAction().run();
+ } finally {
+ if (!getShell().isDisposed()) {
+ getShell().setCursor(null);
+ }
}
}
});
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/DisplayForceApplyPromptDialog.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/DisplayForceApplyPromptDialog.java
index 0cbfced6c9..189a34303b 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/DisplayForceApplyPromptDialog.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/DisplayForceApplyPromptDialog.java
@@ -19,52 +19,49 @@
**/
package com.raytheon.uf.viz.datadelivery.subscription;
-import java.util.Set;
-
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Shell;
+import com.google.common.collect.Lists;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
+import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.ForceApplyPromptResponse;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceApplyPromptDisplayText;
import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
/**
- * TODO Add Description
+ * Dialog allowing the user to choose how to continue with their subscription
+ * creation/modification request.
*
*
- *
+ *
* SOFTWARE HISTORY
- *
+ *
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 29, 2012 djohnson Initial creation
- *
+ * May 22, 2013 1650 djohnson Add more bandwidth information.
+ * Jun 12, 2013 2038 djohnson Maximum allowed size is returned in kilobytes.
+ *
*
- *
+ *
* @author djohnson
- * @version 1.0
+ * @version 1.0
*/
public class DisplayForceApplyPromptDialog extends CaveSWTDialog {
- private final String dialogTitle;
- private final String message;
-
- private final int requiredLatency;
-
- private final IForceApplyPromptDisplayText displayTextStrategy;
-
- private final Subscription subscription;
-
- private final Set wouldBeUnscheduledSubscriptions;
+ private final ForceApplyPromptConfiguration configuration;
/**
* Constructor.
@@ -75,61 +72,99 @@ public class DisplayForceApplyPromptDialog extends CaveSWTDialog {
* @param subscription
* @param wouldBeUnscheduledSubscriptions
*/
- public DisplayForceApplyPromptDialog(String title, String message,
- int requiredLatency,
- IForceApplyPromptDisplayText displayTextStrategy,
- Subscription subscription,
- Set wouldBeUnscheduledSubscriptions) {
- super(displayTextStrategy.getShell());
+ public DisplayForceApplyPromptDialog(
+ ForceApplyPromptConfiguration configuration) {
+ super(configuration.displayTextStrategy.getShell());
- this.dialogTitle = title;
- this.message = message;
- this.requiredLatency = requiredLatency;
- this.displayTextStrategy = displayTextStrategy;
- this.subscription = subscription;
- this.wouldBeUnscheduledSubscriptions = wouldBeUnscheduledSubscriptions;
+ this.configuration = configuration;
}
/**
* {@inheritDoc}
- * @param subscription
+ *
+ * @param subscription
*/
@Override
protected void initializeComponents(final Shell shell) {
- setText(dialogTitle);
+ setText(configuration.title);
// Initialize layout
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, false, true);
gd.widthHint = 400;
- gd.heightHint = 100;
Label textLabel = new Label(shell, SWT.WRAP);
textLabel.setLayoutData(gd);
- textLabel.setText(message);
+ textLabel.setText(configuration.message);
+
+ if (configuration.hasUnscheduledSubscriptions()) {
+ Composite unscheduledSubscriptionsComp = new Composite(shell,
+ SWT.NONE);
+ unscheduledSubscriptionsComp.setLayout(new GridLayout(1, false));
+ unscheduledSubscriptionsComp.setLayoutData(new GridData(SWT.FILL,
+ SWT.FILL, true, true));
+
+ final List list = new List(unscheduledSubscriptionsComp, SWT.MULTI
+ | SWT.BORDER);
+ list.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ final SelectionListener listener = new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ list.deselectAll();
+ }
+ };
+ list.setItems(configuration.wouldBeUnscheduledSubscriptions
+ .toArray(new String[configuration.wouldBeUnscheduledSubscriptions
+ .size()]));
+ list.addSelectionListener(listener);
+ }
+
+ if (configuration.hasBandwidthDetails()) {
+ Group group = new Group(shell, SWT.BORDER);
+ group.setText("Bandwidth Details");
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ group.setLayout(new GridLayout(1, false));
+
+ Label rulesLatency = new Label(group, SWT.WRAP);
+ rulesLatency.setText("Maximum latency recommended by rules: "
+ + configuration.maximumLatency + " minutes");
+ rulesLatency.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
+ true));
+
+ Label sizeLabel = new Label(group, SWT.WRAP);
+ sizeLabel
+ .setText("Maximum allowed size with current latency: "
+ + SizeUtil
+ .prettyKiloByteSize(configuration.maximumAllowedSize));
+ sizeLabel
+ .setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ }
+
+ Composite leftComp = new Composite(shell, SWT.NONE);
+ leftComp.setLayout(new GridLayout(1, false));
+ leftComp.setLayoutData(new GridData(SWT.LEFT, SWT.DEFAULT, true, false));
+
+ Label choiceLabel = new Label(leftComp, SWT.WRAP);
+ choiceLabel.setLayoutData(gd);
+ choiceLabel.setText("\nWhat would you like to do?\n");
// Add radio buttons
- Composite leftComp = new Composite(shell, SWT.NONE);
- GridLayout gl = new GridLayout(1, false);
- leftComp.setLayout(gl);
- GridData gd2 = new GridData(SWT.LEFT, SWT.DEFAULT, true, false);
- leftComp.setLayoutData(gd2);
-
- Button[] radios = getRadioButtons(leftComp, requiredLatency,
- displayTextStrategy, subscription);
+ Button[] radios = getRadioButtons(leftComp,
+ configuration.requiredLatency,
+ configuration.displayTextStrategy, configuration.subscription);
radios[0].setSelection(true);
setReturnValue(ForceApplyPromptResponse.CANCEL);
+ radios[0].setFocus();
- // Add a close button
+ // Add an OK button
Composite centeredComp = new Composite(shell, SWT.NONE);
- gl = new GridLayout(1, false);
- centeredComp.setLayout(gl);
- gd2 = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
- centeredComp.setLayoutData(gd2);
+ centeredComp.setLayout(new GridLayout(1, false));
+ gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
+ centeredComp.setLayoutData(gd);
- Button closeBtn = new Button(centeredComp, SWT.NONE);
- closeBtn.setText("OK");
- closeBtn.setLayoutData(gd2);
- closeBtn.addSelectionListener(new SelectionAdapter() {
+ Button okBtn = new Button(centeredComp, SWT.NONE);
+ okBtn.setText("OK");
+ okBtn.setLayoutData(gd);
+ okBtn.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
shell.dispose();
@@ -158,30 +193,29 @@ public class DisplayForceApplyPromptDialog extends CaveSWTDialog {
.values();
final int length = values.length;
- Button[] buttons = new Button[length];
+ java.util.List buttons = Lists.newArrayList();
for (int i = 0; i < length; i++) {
final ForceApplyPromptResponse promptResponse = values[i];
-
- buttons[i] = new Button(composite, SWT.RADIO);
final String optionDisplayText = displayTextStrategy
.getOptionDisplayText(promptResponse, requiredLatency,
- subscription, wouldBeUnscheduledSubscriptions);
+ subscription,
+ configuration.wouldBeUnscheduledSubscriptions);
// Skip any options that return a null display text
- if (optionDisplayText == null) {
- buttons[i].setVisible(false);
- continue;
+ if (optionDisplayText != null) {
+ Button button = new Button(composite, SWT.RADIO);
+ button.setText(optionDisplayText);
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setReturnValue(promptResponse);
+ }
+ });
+ buttons.add(button);
}
-
- buttons[i].setText(optionDisplayText);
- buttons[i].addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- setReturnValue(promptResponse);
- }
- });
}
- return buttons;
+ return buttons.toArray(new Button[buttons.size()]);
}
+
}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/ForceApplyPromptConfiguration.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/ForceApplyPromptConfiguration.java
new file mode 100644
index 0000000000..f45119623f
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/ForceApplyPromptConfiguration.java
@@ -0,0 +1,204 @@
+/**
+ * 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.uf.viz.datadelivery.subscription;
+
+import java.util.Set;
+
+import org.apache.commons.lang.builder.EqualsBuilder;
+import org.apache.commons.lang.builder.HashCodeBuilder;
+
+import com.raytheon.uf.common.datadelivery.bandwidth.IProposeScheduleResponse;
+import com.raytheon.uf.common.datadelivery.registry.Subscription;
+import com.raytheon.uf.common.util.StringUtil;
+import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceApplyPromptDisplayText;
+
+/**
+ * Configuration for a force apply prompt.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * May 22, 2013 1650 djohnson Initial creation
+ *
+ *
+ *
+ * @author djohnson
+ * @version 1.0
+ */
+
+public class ForceApplyPromptConfiguration {
+
+ public final String title;
+
+ public final String message;
+
+ public final int requiredLatency;
+
+ public final int maximumLatency;
+
+ public final long maximumAllowedSize;
+
+ public final IForceApplyPromptDisplayText displayTextStrategy;
+
+ public final Subscription subscription;
+
+ public final Set wouldBeUnscheduledSubscriptions;
+
+ /**
+ * Constructor used when there is a single subscription failing to schedule.
+ *
+ * @param title
+ * @param message
+ * @param requiredLatency
+ * @param maximumLatency
+ * @param maximumAllowedSize
+ * @param displayTextStrategy
+ * @param subscription
+ * @param wouldBeUnscheduledSubscriptions
+ */
+ public ForceApplyPromptConfiguration(String title, String message,
+ int requiredLatency, int maximumLatency, long maximumAllowedSize,
+ IForceApplyPromptDisplayText displayTextStrategy,
+ Subscription subscription,
+ Set wouldBeUnscheduledSubscriptions) {
+ this.title = title;
+ this.message = message;
+ this.requiredLatency = requiredLatency;
+ this.maximumLatency = maximumLatency;
+ this.maximumAllowedSize = maximumAllowedSize;
+ this.displayTextStrategy = displayTextStrategy;
+ this.subscription = subscription;
+ this.wouldBeUnscheduledSubscriptions = wouldBeUnscheduledSubscriptions;
+ }
+
+ /**
+ * Constructor used when there are multiple subscriptions failing to
+ * schedule.
+ *
+ * @param title
+ * @param message
+ * @param displayTextStrategy
+ */
+ public ForceApplyPromptConfiguration(String title, String message,
+ IForceApplyPromptDisplayText displayTextStrategy,
+ Set wouldBeUnscheduledSubscriptions) {
+ this(title, message, IProposeScheduleResponse.VALUE_NOT_SET,
+ IProposeScheduleResponse.VALUE_NOT_SET,
+ IProposeScheduleResponse.VALUE_NOT_SET, displayTextStrategy,
+ null, wouldBeUnscheduledSubscriptions);
+ }
+
+ /**
+ * Returns true if the configuration would unschedule subscriptions other
+ * than the one being modified/created.
+ *
+ * @return true or false
+ */
+ public boolean hasUnscheduledSubscriptions() {
+ return subscription == null
+ || wouldBeUnscheduledSubscriptions.size() > 1
+ || !wouldBeUnscheduledSubscriptions.contains(subscription
+ .getName());
+ }
+
+ /**
+ * Returns true if the configuration contains bandwidth manager details.
+ *
+ * @return true or false
+ */
+ public boolean hasBandwidthDetails() {
+ return requiredLatency != IProposeScheduleResponse.VALUE_NOT_SET;
+ }
+
+ /**
+ * Return true if the subscription attempting to be scheduled is the only
+ * subscription that wouldn't be able to schedule.
+ *
+ * @return true or false
+ */
+ public boolean isNotAbleToScheduleOnlyTheSubscription() {
+ return subscription != null
+ && wouldBeUnscheduledSubscriptions.size() == 1
+ && wouldBeUnscheduledSubscriptions.contains(subscription
+ .getName());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof ForceApplyPromptConfiguration) {
+ ForceApplyPromptConfiguration other = (ForceApplyPromptConfiguration) obj;
+
+ EqualsBuilder builder = new EqualsBuilder();
+ builder.append(this.title, other.title);
+ builder.append(this.message, other.message);
+ builder.append(this.requiredLatency, other.requiredLatency);
+ builder.append(this.maximumLatency, other.maximumLatency);
+ builder.append(this.maximumAllowedSize, other.maximumAllowedSize);
+ builder.append(this.subscription, other.subscription);
+ builder.append(this.wouldBeUnscheduledSubscriptions,
+ other.wouldBeUnscheduledSubscriptions);
+ return builder.isEquals();
+ }
+ return super.equals(obj);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode() {
+ HashCodeBuilder builder = new HashCodeBuilder();
+ builder.append(this.title);
+ builder.append(this.message);
+ builder.append(this.requiredLatency);
+ builder.append(this.maximumLatency);
+ builder.append(this.maximumAllowedSize);
+ builder.append(this.subscription);
+ builder.append(this.wouldBeUnscheduledSubscriptions);
+ return builder.toHashCode();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append("title: ").append(title).append(StringUtil.NEWLINE);
+ sb.append("message: ").append(message).append(StringUtil.NEWLINE);
+ sb.append("required latency: ").append(requiredLatency)
+ .append(StringUtil.NEWLINE);
+ sb.append("maximum latency: ").append(maximumLatency)
+ .append(StringUtil.NEWLINE);
+ sb.append("maximum allowed size: ").append(maximumAllowedSize)
+ .append(StringUtil.NEWLINE);
+ sb.append("subscription: ")
+ .append(subscription == null ? "null" : subscription.getName())
+ .append(StringUtil.NEWLINE);
+ sb.append("wouldBeUnscheduledSubscriptions: ").append(
+ wouldBeUnscheduledSubscriptions);
+
+ return sb.toString();
+ }
+
+}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/ISubscriptionManagerFilter.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/ISubscriptionManagerFilter.java
new file mode 100644
index 0000000000..173672985c
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/ISubscriptionManagerFilter.java
@@ -0,0 +1,58 @@
+/**
+ * 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.uf.viz.datadelivery.subscription;
+
+import java.util.List;
+
+import com.raytheon.uf.common.datadelivery.registry.Subscription;
+import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
+import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
+
+/**
+ * Allows calling code to specify a filter for the contents of the
+ * {@link SubscriptionManagerDlg}.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * May 23, 2013 1650 djohnson Initial creation
+ *
+ *
+ *
+ * @author djohnson
+ * @version 1.0
+ */
+
+public interface ISubscriptionManagerFilter {
+ /**
+ * Allows calling code to determine how to find the subscriptions to be
+ * included in the table.
+ *
+ * @param subscriptionHandler
+ * the subscription handler
+ * @return the list of subscriptions
+ * @throws RegistryHandlerException
+ */
+ List getSubscriptions(ISubscriptionHandler subscriptionHandler)
+ throws RegistryHandlerException;
+}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionHelpDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionHelpDlg.java
deleted file mode 100644
index 2aa1ad647b..0000000000
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionHelpDlg.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package com.raytheon.uf.viz.datadelivery.subscription;
-
-
-import org.eclipse.swt.widgets.Shell;
-
-import com.raytheon.uf.viz.datadelivery.help.DataDeliveryHelp;
-
-/**
- * Help dialog for the Subscription Table.
- *
- *
- *
- * SOFTWARE HISTORY
- *
- * Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * May 18, 2012 645 jpiatt Initial creation.
- *
- *
- *
- * @author jpiatt
- * @version 1.0
- */
-
-public class SubscriptionHelpDlg extends DataDeliveryHelp {
-
- /**
- * Constructor.
- * @param parentShell
- * Parent shell.
- */
-
- public SubscriptionHelpDlg(Shell parentShell) {
-
- this.parentShell = parentShell;
- this.helpText = getHelpText();
-
- }
-
- /**
- * Get the Help Text.
- *
- * @return String
- * Help Text.
- */
- private String getHelpText() {
-
- String helpText = "Subscription Table Help " +
- "The Subscription Manager Table allows a user to add, edit, copy, view, and delete " +
- "data delivery subscriptions. " +
-// "File " +
-// "Edit " +
-// "Settings " +
- "" +
- " " +
- " File "+
- " " +
- " New Subscription " +
- " The New Subscription menu option opens the Dataset Discovery Browser. " +
- " The Dataset Discovery Browser allows a user to find Datasets using " +
- " filtering options. First, select an Area for the Areal Coverage. Optionally, use" +
- " the Set Area to select an Area. Next, select an available Data Type. Move the data type to " +
- " the selected column using the arrows. Next, select from the filtering options. Filters " +
- " include Data Provider, Data Set, Level or Parameter. Click the arrows to the left of the " +
- " Filter titles to expand the filter selection sections. After Filters are selected, click " +
- " Update Results to load the list of Datasets in the table. Select a Dataset row(s) and click the " +
- " Subset... button. Optionally, select Subset information. Enter a Subset Name. Click " +
- " the Subscribe button to subscribe to the subset. Click the Query button " +
- " to perform an adhoc retrieval using the currently selected subset parameters. " +
- " Set As Default " +
- " Set the current configuration settings to be the default " +
- " settings for the table. When the table is opened the " +
- " saved default settings are applied. " +
- " Load Configuration... " +
- " Load a previously saved configuration file. Select from the Available " +
- " Configuration Files list and click the Load button to load a configuration " +
- " file. Use the Preview button to view the XML associated with the " +
- " configuration file. " +
- " Save Configuration " +
- " Save the current configuration settings to the most recently " +
- " saved file name. The first time Save Configuration is accessed, " +
- " select to save either at the User or Site level and enter a file name. " +
- " Click the Save button to save the file. Use the Load Configuration " +
- " menu item to load a saved configuration. " +
- " Save Configuration As... " +
- " Save the current configuration settings to a named file " +
- " that may be loaded in the future. In the Save Configuration dialog " +
- " select to save either at the User or Site level and enter a file name. " +
- " Click the Save button to save the file. Use the Load Configuration " +
- " menu item to load a saved configuration. " +
- " Refresh Table " +
- " Refresh the table data. " +
- " Exit " +
- " Exit the table. " +
- " " +
- " Edit " +
- " " +
- " Edit Subscription... " +
- " Highlight a row in the table to edit. Modify the Subscription Delivery Options, " +
- " the Subscription Duration, the Subscription Active Period, the Subscription " +
- " Priority or the additional Subscription Information. Subscription Duration sets " +
- " the start and expiration times for subscription delivery. Use the No Expiration " +
- " radio button to continue to receive the subscription. The Subscription Active " +
- " Period may be used to select a specified time range for the subscription to be " +
- " active. (Note: The active period does not include the year.) The Subscription " +
- " Priority sets the order of subscription fullfillment and may be set to High (1), " +
- " Default (2), or Low (3). The Subscription Information allows the Description " +
- " to be modified. The Subscription Name may not be modified. Click OK " +
- " to perform the edit. " +
- " Copy Subscription... " +
- " Highlight a row in the table to copy. Enter a New Subscription Name. Click " +
- " OK to perform the copy. " +
- " Delete Subscription... " +
- " Highlight a row(s) in the table to delete. Click Yes to perform the " +
- " deletion. " +
- " " +
- " Settings " +
- " " +
- " Configure Table... " +
- " The Table Column Configuration Settings allow a user to hide and make visible table " +
- " columns. The list of Hidden Columns is located on the left and the Visible Columns list is " +
- " located on the right. If columns are moved to the Visible Columns list, the corresponding " +
- " columns will be displayed in the Notification Table. Use the right and left arrows to " +
- " move column names back and forth from the Hidden Columns list to the Visible Columns list. " +
- " Use the up and down arrows to change the order of the visible columns as seen in the table. " +
- " (Note: Column names are not duplicated and appear only once either in the Hidden or Visible " +
- " lists.) After making selections, click the OK button to configure the table. (Note: " +
- " Unless the configuration is set to the default or saved, changes will be lost when the " +
- " table is closed.) " +
- " " +
- "";
-
- return helpText;
-
- }
-
-}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java
index f7a6499059..f297657e9f 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerDlg.java
@@ -21,6 +21,7 @@ package com.raytheon.uf.viz.datadelivery.subscription;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -67,6 +68,7 @@ import com.raytheon.uf.viz.datadelivery.actions.DataBrowserAction;
import com.raytheon.uf.viz.datadelivery.common.ui.IGroupAction;
import com.raytheon.uf.viz.datadelivery.common.ui.ITableChange;
import com.raytheon.uf.viz.datadelivery.common.ui.TableCompConfig;
+import com.raytheon.uf.viz.datadelivery.help.HelpManager;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.subscription.ISubscriptionService.ISubscriptionServiceResult;
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceApplyPromptDisplayText;
@@ -120,6 +122,10 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Mar 29, 2013 1841 djohnson Subscription implementations now provide a copy method.
* May 09, 2013 2000 djohnson Copy subscription now requires editing first to prevent duplicates, and remove duplicate code.
* May 17, 2013 1040 mpduff Change office id to list for shared subscription.
+ * May 28, 2013 1650 djohnson Allow specifying filters for what subscriptions to show.
+ * Jun 05, 2013 2064 mpduff Fix for filtering combo boxes.
+ * Jun 06, 2013 2030 mpduff Refactored help.
+ * Jun 14, 2013 2064 mpduff Check for null/disposed sort column.
*
*
* @author mpduff
@@ -133,24 +139,8 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(SubscriptionManagerDlg.class);
- /** Enumeration to use with Deliver Notify */
- public static enum SubscriptionNotification {
- /** Subscription notification of type Delivery */
- DELIVERY("Delivery"),
- /** Subscription notification of type Notify */
- NOTIFY("Notify");
-
- private String subnotif;
-
- private SubscriptionNotification(String subnotif) {
- this.subnotif = subnotif;
- }
-
- @Override
- public String toString() {
- return subnotif;
- }
- }
+ /** Help file */
+ private final String SUBSCRIPTION_MANAGER_HELP_FILE = "help/subscriptionManagerHelp.xml";
/** Enumeration to use with Data set */
public static enum FullDataset {
@@ -184,9 +174,6 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
/** Subscription Manager Configuration Dialog */
private SubscriptionManagerConfigDlg configDlg = null;
- /** Help Dialog */
- private final SubscriptionHelpDlg help = null;
-
/** Subscription table composite. */
private SubscriptionTableComp tableComp;
@@ -225,16 +212,31 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
private final ISubscriptionNotificationService subscriptionNotificationService = DataDeliveryServices
.getSubscriptionNotificationService();
+ private final ISubscriptionManagerFilter filter;
+
+ /** The selected office */
+ private String selectedOffice;
+
+ /** The selected group */
+ private String selectedGroup;
+
+ /** The office display list */
+ private final SortedSet officeDisplayItems = new TreeSet();
+
/**
* Constructor
*
* @param parent
* The parent shell
+ * @param filter
*/
- public SubscriptionManagerDlg(Shell parent) {
+ public SubscriptionManagerDlg(Shell parent,
+ ISubscriptionManagerFilter filter) {
super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE,
CAVE.INDEPENDENT_SHELL | CAVE.PERSPECTIVE_INDEPENDENT);
+ this.filter = filter;
+
setText("Data Delivery Subscription Manager");
}
@@ -489,7 +491,7 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
| SWT.MULTI | SWT.FULL_SELECTION);
tableConfig.setTableHeight(200);
tableComp = new SubscriptionTableComp(shell, tableConfig, this,
- SubscriptionType.MANAGER);
+ SubscriptionType.MANAGER, filter);
tableComp.populateData();
tableComp.populateTable();
@@ -786,10 +788,37 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
*/
private void handleFilterSelection() {
- String group = groupCbo.getText();
- String office = officeCbo.getText();
+ final String group = groupCbo.getText();
+ final String office = officeCbo.getText();
+ this.selectedOffice = office;
+ this.selectedGroup = group;
- tableComp.populateFilteredData(group, office);
+ tableComp.setSubscriptionFilter(new ISubscriptionManagerFilter() {
+ @Override
+ public List getSubscriptions(
+ ISubscriptionHandler subscriptionHandler)
+ throws RegistryHandlerException {
+ final List results = filter
+ .getSubscriptions(subscriptionHandler);
+
+ // Remove any that don't match the configured filters. TODO:
+ // This should be cleaned up at some point in the future
+ for (Iterator iter = results.iterator(); iter
+ .hasNext();) {
+ Subscription subscription = iter.next();
+ if ((office == null || "ALL".equals(office) || subscription
+ .getOfficeIDs().contains(office))
+ && (group == null
+ || "All Subscriptions".equals(group) || group
+ .equals(subscription.getGroupName()))) {
+ continue;
+ }
+ iter.remove();
+ }
+ return results;
+ }
+ });
+ tableComp.populateData();
tableComp.populateTable();
}
@@ -891,12 +920,13 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
* Handle the help display dialog.
*/
private void handleHelp() {
-
- if (help == null || help.isDisposed()) {
- SubscriptionHelpDlg help = new SubscriptionHelpDlg(shell);
- help.open();
- } else {
- help.bringToTop();
+ try {
+ HelpManager.getInstance().displayHelpDialog(getShell(),
+ SUBSCRIPTION_MANAGER_HELP_FILE);
+ } catch (Exception e) {
+ statusHandler.handle(Priority.ERROR,
+ "Error loading Help Text file: "
+ + SUBSCRIPTION_MANAGER_HELP_FILE, e);
}
}
@@ -936,17 +966,18 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
groupNameList.add(0, "All Subscriptions");
groupNames = groupNameList.toArray(new String[0]);
groupCbo.setItems(groupNames);
- groupCbo.select(0);
+
+ if (this.selectedGroup != null) {
+ groupCbo.select(groupNameList.indexOf(selectedGroup));
+ } else {
+ groupCbo.select(0);
+ }
}
/**
* Return the list of office names available. Default is "ALL" office ids
*/
public void loadOfficeNames() {
-
- // Create sorted set
- SortedSet officeDisplayItems = new TreeSet();
-
int numRows = tableComp.getTable().getItemCount();
if (numRows > 0) {
@@ -966,16 +997,21 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
officeAll[0] = "ALL";
System.arraycopy(officeNames, 0, officeAll, 1, officeNames.length);
- int idx = 0;
- for (String site : officeAll) {
- if (site.equalsIgnoreCase(CURRENT_SITE)) {
- break;
- }
- idx++;
- }
officeCbo.setItems(officeAll);
- officeCbo.select(idx);
+ String site = CURRENT_SITE;
+ if (this.selectedOffice != null) {
+ for (Iterator iter = officeDisplayItems.iterator(); iter
+ .hasNext();) {
+ String next = iter.next();
+ if (next.equals(selectedOffice)) {
+ site = next;
+ break;
+ }
+ }
+ }
+
+ officeCbo.select(officeCbo.indexOf(site));
}
/*
@@ -1015,6 +1051,11 @@ public class SubscriptionManagerDlg extends CaveSWTDialog implements
}
}
}
+
+ // If null get the first one
+ if (sortedTableColumn == null) {
+ sortedTableColumn = tableComp.getTable().getColumn(0);
+ }
tableComp.updateSortDirection(sortedTableColumn,
tableComp.getSubscriptionData(), false);
tableComp.populateTable();
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerFilters.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerFilters.java
new file mode 100644
index 0000000000..ecf9f3217f
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionManagerFilters.java
@@ -0,0 +1,104 @@
+/**
+ * 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.uf.viz.datadelivery.subscription;
+
+import java.util.Collection;
+import java.util.List;
+
+import com.raytheon.uf.common.datadelivery.registry.Subscription;
+import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
+import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
+
+/**
+ * Provides filters to use with the SubscriptionManagerDlg.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * May 23, 2013 1650 djohnson Initial creation
+ *
+ *
+ *
+ * @author djohnson
+ * @version 1.0
+ */
+
+public final class SubscriptionManagerFilters {
+
+ private static final ISubscriptionManagerFilter RETRIEVE_ALL = new ISubscriptionManagerFilter() {
+ @Override
+ public List getSubscriptions(
+ ISubscriptionHandler subscriptionHandler)
+ throws RegistryHandlerException {
+ return subscriptionHandler.getAll();
+ }
+ };
+
+ /**
+ * Prevent construction.
+ */
+ private SubscriptionManagerFilters() {
+ }
+
+ public static ISubscriptionManagerFilter getAll() {
+ return RETRIEVE_ALL;
+ }
+
+ /**
+ * Filter that only accepts subscriptions with the specified names.
+ *
+ * @param names
+ * the names
+ * @return the filter
+ */
+ public static ISubscriptionManagerFilter getByNames(
+ final Collection names) {
+ return new ISubscriptionManagerFilter() {
+ @Override
+ public List getSubscriptions(
+ ISubscriptionHandler subscriptionHandler)
+ throws RegistryHandlerException {
+ return subscriptionHandler.getByNames(names);
+ }
+ };
+ }
+
+ /**
+ * @param providerName
+ * @param datasetName
+ * @return
+ */
+ public static ISubscriptionManagerFilter getByProviderAndDataSet(
+ final String providerName, final String datasetName) {
+ return new ISubscriptionManagerFilter() {
+ @Override
+ public List getSubscriptions(
+ ISubscriptionHandler subscriptionHandler)
+ throws RegistryHandlerException {
+ return subscriptionHandler.getActiveByDataSetAndProvider(
+ datasetName, providerName);
+ }
+ };
+ }
+
+}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionService.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionService.java
index 8442ae8ad2..58ca553ba9 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionService.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionService.java
@@ -36,6 +36,7 @@ import org.eclipse.swt.widgets.Shell;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.bandwidth.IBandwidthService;
import com.raytheon.uf.common.datadelivery.bandwidth.IProposeScheduleResponse;
@@ -57,6 +58,8 @@ import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.viz.core.VizApp;
import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.exception.VizException;
+import com.raytheon.uf.viz.datadelivery.actions.SubscriptionManagerAction;
+import com.raytheon.uf.viz.datadelivery.system.SystemRuleManager;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
/**
@@ -79,6 +82,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Jan 28, 2013 1530 djohnson Reset unscheduled flag with each update.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* May 14, 2013 2000 djohnson Check for subscription overlap/duplication.
+ * May 23, 2013 1650 djohnson Move out some presentation logic to DisplayForceApplyPromptDialog.
+ * Jun 12, 2013 2038 djohnson Launch subscription manager on the UI thread.
*
*
*
@@ -105,14 +110,10 @@ public class SubscriptionService implements ISubscriptionService {
* @param subscription
*/
@Override
- public ForceApplyPromptResponse displayForceApplyPrompt(String title,
- String message, int requiredLatency,
- IForceApplyPromptDisplayText displayTextStrategy,
- Subscription subscription,
- Set wouldBeUnscheduledSubscriptions) {
+ public ForceApplyPromptResponse displayForceApplyPrompt(
+ ForceApplyPromptConfiguration configuration) {
DisplayForceApplyPromptDialog dlg = new DisplayForceApplyPromptDialog(
- title, message, requiredLatency, displayTextStrategy,
- subscription, wouldBeUnscheduledSubscriptions);
+ configuration);
forceApplyPromptResponse = (ForceApplyPromptResponse) dlg.open();
return forceApplyPromptResponse;
}
@@ -219,18 +220,12 @@ public class SubscriptionService implements ISubscriptionService {
private final class ProposeResult {
private final boolean promptUser;
- private final String message;
+ private final ForceApplyPromptConfiguration config;
- private final int requiredLatency;
-
- private final Set wouldBeUnscheduledSubscriptions;
-
- private ProposeResult(boolean promptUser, String message,
- int requiredLatency, Set wouldBeUnscheduledSubscriptions) {
+ private ProposeResult(boolean promptUser,
+ ForceApplyPromptConfiguration config) {
this.promptUser = promptUser;
- this.message = message;
- this.requiredLatency = requiredLatency;
- this.wouldBeUnscheduledSubscriptions = wouldBeUnscheduledSubscriptions;
+ this.config = config;
}
}
@@ -247,7 +242,7 @@ public class SubscriptionService implements ISubscriptionService {
* Enumeration of force apply responses.
*/
public static enum ForceApplyPromptResponse {
- CANCEL, INCREASE_LATENCY, FORCE_APPLY;
+ CANCEL, INCREASE_LATENCY, EDIT_SUBSCRIPTIONS, FORCE_APPLY;
}
/**
@@ -258,18 +253,13 @@ public class SubscriptionService implements ISubscriptionService {
/**
* Display the force apply prompt.
*
- * @param title
- * @param message
- * @param requiredLatency
- * @param displayTextStrategy
- * @param wouldBeUnscheduledSubscriptions
+ * @param configuration
+ * the configuration
+ *
* @return the response
*/
- ForceApplyPromptResponse displayForceApplyPrompt(String title,
- String message, int requiredLatency,
- IForceApplyPromptDisplayText displayTextStrategy,
- Subscription subscription,
- Set wouldBeUnscheduledSubscriptions);
+ ForceApplyPromptResponse displayForceApplyPrompt(
+ ForceApplyPromptConfiguration configuration);
ForceApplyPromptResponse getForceApplyPromptResponse();
@@ -586,41 +576,44 @@ public class SubscriptionService implements ISubscriptionService {
throws RegistryHandlerException {
for (Subscription subscription : subscriptions) {
- final ISubscriptionHandler subscriptionHandler = DataDeliveryHandlers
- .getSubscriptionHandler();
- final List potentialDuplicates = subscriptionHandler
- .getActiveByDataSetAndProvider(
- subscription.getDataSetName(),
- subscription.getProvider());
- List overlappingSubscriptions = Lists.newArrayList();
- for (Subscription potentialDuplicate : potentialDuplicates) {
- final ISubscriptionOverlapResponse overlapResponse = subscriptionOverlapService
- .isOverlapping(potentialDuplicate, subscription);
- final String potentialDuplicateName = potentialDuplicate
- .getName();
- if (overlapResponse.isDuplicate()) {
- return new SubscriptionServiceResult(true,
- "This subscription would be an exact duplicate of "
- + potentialDuplicateName);
+ if (!(subscription instanceof AdhocSubscription)) {
+ final ISubscriptionHandler subscriptionHandler = DataDeliveryHandlers
+ .getSubscriptionHandler();
+ final List potentialDuplicates = subscriptionHandler
+ .getActiveByDataSetAndProvider(
+ subscription.getDataSetName(),
+ subscription.getProvider());
+ List overlappingSubscriptions = Lists.newArrayList();
+ for (Subscription potentialDuplicate : potentialDuplicates) {
+ final ISubscriptionOverlapResponse overlapResponse = subscriptionOverlapService
+ .isOverlapping(potentialDuplicate, subscription);
+ final String potentialDuplicateName = potentialDuplicate
+ .getName();
+ if (overlapResponse.isDuplicate()) {
+ return new SubscriptionServiceResult(true,
+ "This subscription would be an exact duplicate of "
+ + potentialDuplicateName);
+ }
+ if (overlapResponse.isOverlapping()) {
+ overlappingSubscriptions.add(potentialDuplicateName);
+ }
}
- if (overlapResponse.isOverlapping()) {
- overlappingSubscriptions.add(potentialDuplicateName);
+ if (!overlappingSubscriptions.isEmpty()) {
+ Collections.sort(overlappingSubscriptions);
+ forceApplyPrompt
+ .displayMessage(
+ displayTextStrategy,
+ StringUtil
+ .createMessage(
+ ISubscriptionOverlapService.OVERLAPPING_SUBSCRIPTIONS,
+ overlappingSubscriptions));
}
}
- if (!overlappingSubscriptions.isEmpty()) {
- Collections.sort(overlappingSubscriptions);
- forceApplyPrompt.displayMessage(
- displayTextStrategy,
- StringUtil
- .createMessage(
- ISubscriptionOverlapService.OVERLAPPING_SUBSCRIPTIONS,
- overlappingSubscriptions));
- }
}
try {
final ProposeResult result = proposeScheduleAndAction(
- subscriptions, action);
+ subscriptions, action, displayTextStrategy);
if (result.promptUser) {
final Subscription subscription = (subscriptions.size() == 1) ? subscriptions
@@ -629,15 +622,13 @@ public class SubscriptionService implements ISubscriptionService {
VizApp.runSync(new Runnable() {
@Override
public void run() {
- forceApplyPrompt.displayForceApplyPrompt(TITLE,
- result.message, result.requiredLatency,
- displayTextStrategy, subscription,
- result.wouldBeUnscheduledSubscriptions);
+ forceApplyPrompt.displayForceApplyPrompt(result.config);
}
});
switch (forceApplyPrompt.getForceApplyPromptResponse()) {
case INCREASE_LATENCY:
- subscription.setLatencyInMinutes(result.requiredLatency);
+ subscription
+ .setLatencyInMinutes(result.config.requiredLatency);
// Intentional fall-through
case FORCE_APPLY:
// Have to make sure we set them to not be unscheduled, let
@@ -657,13 +648,25 @@ public class SubscriptionService implements ISubscriptionService {
return new SubscriptionServiceResult(sb.toString());
case CANCEL:
return new SubscriptionServiceResult(true);
+ case EDIT_SUBSCRIPTIONS:
+ if (!result.config.isNotAbleToScheduleOnlyTheSubscription()) {
+ VizApp.runSync(new Runnable() {
+ @Override
+ public void run() {
+ new SubscriptionManagerAction()
+ .loadSubscriptionManager(SubscriptionManagerFilters
+ .getByNames(result.config.wouldBeUnscheduledSubscriptions));
+ }
+ });
+ }
+ return new SubscriptionServiceResult(true);
default:
throw new IllegalArgumentException(
"Unknown force apply prompt response! Did you add a new type that must be handled?");
}
}
- return new SubscriptionServiceResult(result.message);
+ return new SubscriptionServiceResult(result.config.message);
} catch (RegistryHandlerException e) {
// The in-memory objects must be corrupted since we schedule first,
// then store to the registry, so a reinitialize is called for
@@ -685,7 +688,8 @@ public class SubscriptionService implements ISubscriptionService {
*/
private ProposeResult proposeScheduleAndAction(
List subscriptions,
- ServiceInteraction serviceInteraction)
+ ServiceInteraction serviceInteraction,
+ IForceApplyPromptDisplayText displayTextStrategy)
throws RegistryHandlerException {
IProposeScheduleResponse proposeScheduleresponse = bandwidthService
@@ -694,17 +698,18 @@ public class SubscriptionService implements ISubscriptionService {
.getUnscheduledSubscriptions();
boolean wouldUnscheduleSubs = !unscheduledSubscriptions.isEmpty();
- String response = null;
+ ForceApplyPromptConfiguration response = null;
if (wouldUnscheduleSubs) {
response = getWouldCauseUnscheduledSubscriptionsPortion(
- unscheduledSubscriptions, subscriptions);
+ unscheduledSubscriptions, subscriptions,
+ proposeScheduleresponse, displayTextStrategy);
} else {
- response = serviceInteraction.call();
+ response = new ForceApplyPromptConfiguration(TITLE,
+ serviceInteraction.call(), displayTextStrategy,
+ unscheduledSubscriptions);
}
- return new ProposeResult(wouldUnscheduleSubs, response,
- proposeScheduleresponse.getRequiredLatency(),
- unscheduledSubscriptions);
+ return new ProposeResult(wouldUnscheduleSubs, response);
}
/**
@@ -714,15 +719,19 @@ public class SubscriptionService implements ISubscriptionService {
* the unscheduled subscriptions
* @param subscriptions
* the subscriptions which were attempting to schedule
+ * @param dataSize
*/
- private String getWouldCauseUnscheduledSubscriptionsPortion(
+ private ForceApplyPromptConfiguration getWouldCauseUnscheduledSubscriptionsPortion(
Set unscheduledSubscriptions,
- List subscriptions) {
+ List subscriptions,
+ IProposeScheduleResponse proposeScheduleResponse,
+ IForceApplyPromptDisplayText displayTextStrategy) {
StringBuilder msg = new StringBuilder();
// Handle the case where it's just the subscription we're changing
// itself that would not schedule
- if ((subscriptions.size() == 1 && unscheduledSubscriptions.size() == 1)
+ final boolean singleSubscription = subscriptions.size() == 1;
+ if ((singleSubscription && unscheduledSubscriptions.size() == 1)
&& (subscriptions.get(0).getName()
.equals(unscheduledSubscriptions.iterator().next()))) {
final Subscription subscription = subscriptions.get(0);
@@ -731,15 +740,26 @@ public class SubscriptionService implements ISubscriptionService {
: "Subscription " + subscription.getName())
.append(" would not fully schedule with the bandwidth management system if this action were performed.");
} else {
- msg.append(StringUtil
- .createMessage(
- "The following subscriptions would not fully schedule with the bandwidth management system if this action were performed:",
- unscheduledSubscriptions));
+ msg.append("The following subscriptions would not fully schedule with the bandwidth management system if this action were performed:");
}
- msg.append("\n\nWhat would you like to do?");
+ if (singleSubscription) {
+ Subscription subscription = subscriptions.get(0);
+ final int maximumLatencyFromRules = SystemRuleManager.getInstance()
+ .getLatency(
+ subscription,
+ Sets.newTreeSet(subscription.getTime()
+ .getCycleTimes()));
- return msg.toString();
+ return new ForceApplyPromptConfiguration(TITLE, msg.toString(),
+ proposeScheduleResponse.getRequiredLatency(),
+ maximumLatencyFromRules,
+ proposeScheduleResponse.getRequiredDataSetSize(),
+ displayTextStrategy, subscription, unscheduledSubscriptions);
+ } else {
+ return new ForceApplyPromptConfiguration(TITLE, msg.toString(),
+ displayTextStrategy, unscheduledSubscriptions);
+ }
}
/**
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionTableComp.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionTableComp.java
index 62026ac02b..2735dfccd5 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionTableComp.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/SubscriptionTableComp.java
@@ -46,7 +46,6 @@ import org.eclipse.swt.widgets.TableItem;
import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.PendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
-import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
import com.raytheon.uf.common.datadelivery.registry.handlers.ISubscriptionHandler;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.datadelivery.service.BaseSubscriptionNotificationResponse;
@@ -102,6 +101,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
* May 09, 2013 2000 djohnson Consolidate and remove duplicate code.
* May 15, 2013 1040 mpduff Place markNotBusyInUIThread in a finally block.
* May 23, 2013 2020 mpduff Call updateControls();
+ * May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
+ * Jun 14, 2013 2064 mpduff Null check for sorted column.
*
*
*
@@ -131,6 +132,9 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
private final NotificationMessageContainsType notificationMessageChecker = new NotificationMessageContainsType(
BaseSubscriptionNotificationResponse.class);
+ /** Filters out which subscriptions to show **/
+ private ISubscriptionManagerFilter subscriptionFilter;
+
/**
* Enumeration to determine the type of subscription dialog this class is
* used with.
@@ -149,10 +153,6 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
/** The subscription type. */
private SubscriptionType subType = SubscriptionType.VIEWER;
- // volatile so Eclipse job threads will see the reference that is set on the
- // UI thread
- private volatile List subscriptionNameList;
-
/**
* Constructor.
*
@@ -164,13 +164,17 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
* Subscription action callback.
* @param subType
* Subscription type.
+ * @param filter
+ * @param filter
*/
public SubscriptionTableComp(Composite parent, TableCompConfig tableConfig,
- ISubscriptionAction callback, SubscriptionType subType) {
+ ISubscriptionAction callback, SubscriptionType subType,
+ ISubscriptionManagerFilter subscriptionFilter) {
super(parent, tableConfig, true);
this.subType = subType;
this.subActionCallback = callback;
+ this.subscriptionFilter = subscriptionFilter;
init();
}
@@ -359,66 +363,10 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
updateColumnSortImage();
}
- /**
- * Populate the table data according to the filter selections, .
- *
- * @param groupName
- * name of subscription group
- *
- * @param officeId
- * Office identifier, such as OAX
- */
- public void populateFilteredData(String groupName, String officeId) {
- subManagerData.clearAll();
-
- if ("All Subscriptions".equals(groupName)) {
- groupName = null;
- }
-
- if ("ALL".equals(officeId)) {
- officeId = null;
- }
-
- try {
- List lo = DataDeliveryHandlers
- .getSubscriptionHandler().getByFilters(groupName, officeId);
- for (Subscription subscription : lo) {
- addSubscription(subscription);
- }
- } catch (RegistryHandlerException e) {
- statusHandler.handle(Priority.PROBLEM,
- "Unable to retrieve the list of subscriptions.", e);
- }
- }
-
- /**
- * Populate the table data according to the filter selections, .
- *
- * @param datasetName
- * name of dataset. e.g. gfs
- *
- * @param provider
- * name of provider. e.g. NOMADS
- */
- public void populateActiveFilteredDataByDataSetAndProvider(
- String datasetName, String providerName) {
- subManagerData.clearAll();
-
- try {
- List lo = DataDeliveryHandlers
- .getSubscriptionHandler().getActiveByDataSetAndProvider(
- datasetName, providerName);
- for (Subscription subscription : lo) {
- addSubscription(subscription);
- }
- } catch (RegistryHandlerException e) {
- statusHandler.handle(Priority.PROBLEM,
- "Unable to retrieve the list of subscriptions.", e);
- }
- }
-
/**
* Populate the data.
+ *
+ * @param filter
*/
public void populateData() {
subManagerData.clearAll();
@@ -433,18 +381,7 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
protected IStatus run(IProgressMonitor monitor) {
try {
DataDeliveryGUIUtils.markBusyInUIThread(jobShell);
- if (subscriptionNameList == null
- || subscriptionNameList.isEmpty()) {
- List lo = handler.getAll();
- subList.addAll(lo);
- } else {
- for (String subName : subscriptionNameList) {
- Subscription sub = handler.getByName(subName);
- if (sub != null) {
- subList.add(sub);
- }
- }
- }
+ subList.addAll(subscriptionFilter.getSubscriptions(handler));
return Status.OK_STATUS;
} catch (RegistryHandlerException e) {
statusHandler.handle(Priority.PROBLEM,
@@ -637,6 +574,11 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
sortDirectionMap.put(tc.getText(), SortDirection.ASCENDING);
}
+ // If no sorted column specified then use the first column
+ if (sortedColumn == null || sortedColumn.isDisposed()) {
+ sortedColumn = table.getColumn(0);
+ }
+
populateTable();
}
@@ -822,15 +764,6 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
return groupName;
}
- /**
- * Set the subscription list.
- *
- * @param subscriptionNameList
- */
- public void setSubscriptionNameList(List subscriptionNameList) {
- this.subscriptionNameList = subscriptionNameList;
- }
-
/**
* Return the selected subscription.
*
@@ -842,4 +775,12 @@ public class SubscriptionTableComp extends TableComp implements IGroupAction {
idx);
return row.getSubscription();
}
+
+ /**
+ * @param subscriptionFilter
+ */
+ public void setSubscriptionFilter(
+ ISubscriptionManagerFilter subscriptionFilter) {
+ this.subscriptionFilter = subscriptionFilter;
+ }
}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/approve/SubscriptionApprovalDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/approve/SubscriptionApprovalDlg.java
index 002435af03..6bfea221e7 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/approve/SubscriptionApprovalDlg.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/approve/SubscriptionApprovalDlg.java
@@ -54,6 +54,7 @@ import com.raytheon.uf.viz.core.notification.NotificationException;
import com.raytheon.uf.viz.core.notification.NotificationMessage;
import com.raytheon.uf.viz.datadelivery.common.ui.TableCompConfig;
import com.raytheon.uf.viz.datadelivery.common.ui.TableDataManager;
+import com.raytheon.uf.viz.datadelivery.help.HelpManager;
import com.raytheon.uf.viz.datadelivery.services.DataDeliveryServices;
import com.raytheon.uf.viz.datadelivery.subscription.CancelForceApplyAndIncreaseLatencyDisplayText;
import com.raytheon.uf.viz.datadelivery.subscription.IPermissionsService;
@@ -90,6 +91,7 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Dec 12, 2012 1433 bgonzale Use new subscription copy ctor method for approval of pending subscription.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* Apr 05, 2013 1841 djohnson Add support for shared subscriptions.
+ * Jun 06, 2013 2030 mpduff Refactored help.
*
*
*
@@ -128,6 +130,9 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
}
}
+ /** Help file */
+ protected final String HELP_FILE = "help/subscriptionApprovalHelp.xml";
+
private final IUFStatusHandler statusHandler = UFStatus
.getHandler(SubscriptionApprovalDlg.class);
@@ -144,21 +149,21 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
private String denyMessage;
-
/**
* Constructor.
- *
+ *
* @param parent
* The parent Shell
*/
public SubscriptionApprovalDlg(Shell parent) {
- super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE, CAVE.INDEPENDENT_SHELL);
+ super(parent, SWT.DIALOG_TRIM | SWT.MIN | SWT.RESIZE,
+ CAVE.INDEPENDENT_SHELL | CAVE.DO_NOT_BLOCK);
setText("Subscription Approval");
}
/*
* (non-Javadoc)
- *
+ *
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayoutData()
*/
@@ -169,7 +174,7 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
/*
* (non-Javadoc)
- *
+ *
* @see com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#constructShellLayout()
*/
@Override
@@ -184,7 +189,7 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
/*
* (non-Javadoc)
- *
+ *
* @see
* com.raytheon.viz.ui.dialogs.CaveSWTDialogBase#initializeComponents(org
* .eclipse.swt.widgets.Shell)
@@ -273,7 +278,13 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
aboutMI.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
-
+ try {
+ HelpManager.getInstance().displayHelpDialog(getShell(),
+ HELP_FILE);
+ } catch (Exception e) {
+ statusHandler.handle(Priority.ERROR,
+ "Error loading Help Text file: " + HELP_FILE, e);
+ }
}
});
@@ -281,8 +292,10 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
}
private void createTable() {
- TableCompConfig tableConfig = new TableCompConfig(TABLE_TYPE.PENDING_SUBSCRIPTION);
- tableConfig.setTableStyle(SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
+ TableCompConfig tableConfig = new TableCompConfig(
+ TABLE_TYPE.PENDING_SUBSCRIPTION);
+ tableConfig.setTableStyle(SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
+ | SWT.MULTI | SWT.FULL_SELECTION);
tableConfig.setTableHeight(200);
tableComp = new SubApprovalTableComp(shell, tableConfig, this);
}
@@ -323,8 +336,8 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
@Override
public void handleApprove() {
if (tableComp.getTable().getSelectionCount() == 0) {
- DataDeliveryUtils
- .showMessage(shell, SWT.ERROR, "No Rows Selected", "Please select a row or rows to Approve");
+ DataDeliveryUtils.showMessage(shell, SWT.ERROR, "No Rows Selected",
+ "Please select a row or rows to Approve");
return;
}
getShell().setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
@@ -334,7 +347,8 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
IAuthorizedPermissionResponse response = allowed(user);
if (response.isAuthorized()) {
- // Check if user or site permissions, compare to owner of sub if user permission
+ // Check if user or site permissions, compare to owner of sub if
+ // user permission
boolean site = false;
if (response
@@ -342,11 +356,13 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
site = true;
}
- TableDataManager pendingSubData = tableComp.getPendingSubData();
+ TableDataManager pendingSubData = tableComp
+ .getPendingSubData();
ArrayList approveList = new ArrayList();
ArrayList notApprovedSubList = new ArrayList();
for (int idx : tableComp.getTable().getSelectionIndices()) {
- SubscriptionApprovalRowData approvedItem = pendingSubData.getDataRow(idx);
+ SubscriptionApprovalRowData approvedItem = pendingSubData
+ .getDataRow(idx);
if (site) {
approveList.add(approvedItem);
} else {
@@ -363,9 +379,11 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
}
if (notApprovedSubList.size() > 0) {
- StringBuilder buffer = new StringBuilder(user.uniqueId().toString() + " is not authorized to approve pending subscriptions belonging to other users. " +
- "\nNot authorized to approve the following subscriptions:\n\n");
- for (String name: notApprovedSubList) {
+ StringBuilder buffer = new StringBuilder(
+ user.uniqueId().toString()
+ + " is not authorized to approve pending subscriptions belonging to other users. "
+ + "\nNot authorized to approve the following subscriptions:\n\n");
+ for (String name : notApprovedSubList) {
buffer.append(name).append("\n");
}
@@ -408,7 +426,8 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
public void handleDeny() {
if (tableComp.getTable().getSelectionCount() == 0) {
DataDeliveryUtils
- .showMessage(getShell(), SWT.ERROR, "No Rows Selected", "Please select a row or rows to delete");
+ .showMessage(getShell(), SWT.ERROR, "No Rows Selected",
+ "Please select a row or rows to delete");
return;
}
getShell().setCursor(getDisplay().getSystemCursor(SWT.CURSOR_WAIT));
@@ -417,7 +436,8 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
IAuthorizedPermissionResponse response = allowed(user);
if (response.isAuthorized()) {
if (confirm()) {
- // Check if user or site permissions, compare to owner of sub if user permission
+ // Check if user or site permissions, compare to owner of sub if
+ // user permission
boolean site = false;
if (response
@@ -425,11 +445,13 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
site = true;
}
- TableDataManager pendingSubData = tableComp.getPendingSubData();
+ TableDataManager pendingSubData = tableComp
+ .getPendingSubData();
ArrayList deleteList = new ArrayList();
final String username = user.uniqueId().toString();
for (int idx : tableComp.getTable().getSelectionIndices()) {
- SubscriptionApprovalRowData removedItem = pendingSubData.getDataRow(idx);
+ SubscriptionApprovalRowData removedItem = pendingSubData
+ .getDataRow(idx);
if (site) {
deleteList.add(removedItem);
@@ -465,7 +487,8 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
tableComp.repopulate();
} else {
- String msg = username + " is not authorized to deny pending subscriptions belonging to other users.";
+ String msg = username
+ + " is not authorized to deny pending subscriptions belonging to other users.";
statusHandler.handle(Priority.WARN, msg);
}
}
@@ -486,11 +509,10 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
return false;
}
-
private void approveSubs(ArrayList subList) {
tableComp.getPendingSubData().removeAll(subList);
String username = System.getenv().get("LOGNAME");
- for (SubscriptionApprovalRowData rd: subList) {
+ for (SubscriptionApprovalRowData rd : subList) {
InitialPendingSubscription ps = rd.getSubscription();
Subscription s = ps.subscription();
@@ -527,7 +549,7 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
/*
* (non-Javadoc)
- *
+ *
* @see com.raytheon.uf.viz.core.notification.INotificationObserver#
* notificationArrived
* (com.raytheon.uf.viz.core.notification.NotificationMessage[])
@@ -565,7 +587,6 @@ public class SubscriptionApprovalDlg extends CaveSWTDialog implements
*/
@Override
public boolean displayYesNoPopup(String title, String message) {
- return DataDeliveryUtils.showYesNoMessage(getShell(), title,
- message) == SWT.YES;
+ return DataDeliveryUtils.showYesNoMessage(getShell(), title, message) == SWT.YES;
}
}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/presenter/CreateSubscriptionDlgPresenter.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/presenter/CreateSubscriptionDlgPresenter.java
index e5d3694bc1..77a36e58f5 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/presenter/CreateSubscriptionDlgPresenter.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/presenter/CreateSubscriptionDlgPresenter.java
@@ -39,6 +39,7 @@ import com.google.common.base.Strings;
import com.google.common.collect.Sets;
import com.raytheon.uf.common.auth.user.IUser;
import com.raytheon.uf.common.datadelivery.registry.DataSet;
+import com.raytheon.uf.common.datadelivery.registry.DataType;
import com.raytheon.uf.common.datadelivery.registry.GroupDefinition;
import com.raytheon.uf.common.datadelivery.registry.InitialPendingSubscription;
import com.raytheon.uf.common.datadelivery.registry.Network;
@@ -110,6 +111,7 @@ import com.raytheon.viz.ui.presenter.components.ComboBoxConf;
* Apr 05, 2013 1841 djohnson Add support for shared subscriptions.
* Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Add shared sites.
+ * Jun 04, 2013 223 mpduff Add point data.
*
*
* @author mpduff
@@ -168,7 +170,7 @@ public class CreateSubscriptionDlgPresenter {
private final IGuiThreadTaskExecutor guiThreadTaskExecutor;
- private final Set cycleTimes;
+ private Set cycleTimes;
private final ISubscriptionNotificationService subscriptionNotificationService = DataDeliveryServices
.getSubscriptionNotificationService();
@@ -193,9 +195,11 @@ public class CreateSubscriptionDlgPresenter {
this.create = create;
this.guiThreadTaskExecutor = guiThreadTaskExecutor;
- // Get cycles
- cycleTimes = Sets.newTreeSet(((OpenDapGriddedDataSet) dataSet)
- .getCycles());
+ if (dataSet.getDataSetType() == DataType.GRID) {
+ // Get cycles
+ cycleTimes = Sets.newTreeSet(((OpenDapGriddedDataSet) dataSet)
+ .getCycles());
+ }
groupComboAction = new Runnable() {
@Override
@@ -284,26 +288,27 @@ public class CreateSubscriptionDlgPresenter {
public void init() {
view.setOkConf(OK_CONF);
- final boolean hasCycleTimes = !cycleTimes.isEmpty();
+ if (this.dataSet.getDataSetType() == DataType.GRID) {
+ final boolean hasCycleTimes = !cycleTimes.isEmpty();
- this.cycleChkList = new ArrayList(cycleTimes.size());
- for (int cycle : cycleTimes) {
- String hour = Strings.padStart(String.valueOf(cycle), 2, '0');
+ this.cycleChkList = new ArrayList(cycleTimes.size());
+ for (int cycle : cycleTimes) {
+ String hour = Strings.padStart(String.valueOf(cycle), 2, '0');
- CheckBoxConf cb = new CheckBoxConf(hour, false, "Model Cycle Time",
- CheckBoxConf.DO_NOTHING);
- cycleChkList.add(cb);
+ CheckBoxConf cb = new CheckBoxConf(hour, false,
+ "Model Cycle Time", CheckBoxConf.DO_NOTHING);
+ cycleChkList.add(cb);
+ }
+
+ view.setCycleConf(cycleChkList);
+ ButtonConf sa = new ButtonConf(hasCycleTimes, "Select All",
+ "Select all cycle times", ButtonConf.DO_NOTHING);
+ ButtonConf da = new ButtonConf(hasCycleTimes, "Deselect All",
+ "Deselect all cycle times", ButtonConf.DO_NOTHING);
+
+ view.setSelectAllButton(sa);
+ view.setDeselectAllButton(da);
}
-
- view.setCycleConf(cycleChkList);
- ButtonConf sa = new ButtonConf(hasCycleTimes, "Select All",
- "Select all cycle times", ButtonConf.DO_NOTHING);
- ButtonConf da = new ButtonConf(hasCycleTimes, "Deselect All",
- "Deselect all cycle times", ButtonConf.DO_NOTHING);
-
- view.setSelectAllButton(sa);
- view.setDeselectAllButton(da);
-
populate();
}
@@ -375,21 +380,22 @@ public class CreateSubscriptionDlgPresenter {
view.setPriority(subscription.getPriority());
}
- List cycleTimes = subscription.getTime().getCycleTimes();
- if (cycleTimes != null) {
- List cycleStrings = new ArrayList();
+ if (this.dataSet.getDataSetType() == DataType.GRID) {
+ List cycleTimes = subscription.getTime().getCycleTimes();
+ if (cycleTimes != null) {
+ List cycleStrings = new ArrayList();
- for (int cycle : cycleTimes) {
- if (cycle < 10) {
- cycleStrings.add("0" + String.valueOf(cycle));
- } else {
- cycleStrings.add(String.valueOf(cycle));
+ for (int cycle : cycleTimes) {
+ if (cycle < 10) {
+ cycleStrings.add("0" + String.valueOf(cycle));
+ } else {
+ cycleStrings.add(String.valueOf(cycle));
+ }
}
+
+ view.selectCycles(cycleStrings);
}
-
- view.selectCycles(cycleStrings);
}
-
if (!Strings.isNullOrEmpty(subscription.getGroupName())) {
view.setGroupName(subscription.getGroupName());
}
@@ -520,7 +526,9 @@ public class CreateSubscriptionDlgPresenter {
subscription.setDescription(view.getSubscriptionDescription());
- subscription.getTime().setCycleTimes(view.getCycleTimes());
+ if (this.dataSet.getDataSetType() == DataType.GRID) {
+ subscription.getTime().setCycleTimes(view.getCycleTimes());
+ }
subscription.setLatencyInMinutes(view.getLatencyValue());
@@ -550,16 +558,25 @@ public class CreateSubscriptionDlgPresenter {
DataDeliveryGUIUtils.markBusyInUIThread(jobShell);
ISubscriptionServiceResult result = storeSubscription(
subscription, username);
- if (result.isAllowFurtherEditing()) {
- return new Status(Status.CANCEL,
- CreateSubscriptionDlgPresenter.class
- .getName(),
- result.getMessageToDisplay());
+ if (result != null) {
+ if (result.isAllowFurtherEditing()) {
+ return new Status(
+ Status.CANCEL,
+ CreateSubscriptionDlgPresenter.class
+ .getName(), result
+ .getMessageToDisplay());
+ } else {
+ return new Status(
+ Status.OK,
+ CreateSubscriptionDlgPresenter.class
+ .getName(), result
+ .getMessageToDisplay());
+ }
} else {
- return new Status(Status.OK,
+ return new Status(Status.ERROR,
CreateSubscriptionDlgPresenter.class
.getName(),
- result.getMessageToDisplay());
+ "Error Storing Subscription");
}
}
};
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/GriddedSubsetManagerDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/GriddedSubsetManagerDlg.java
index 25398f7348..679be81fba 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/GriddedSubsetManagerDlg.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/GriddedSubsetManagerDlg.java
@@ -45,15 +45,21 @@ import org.geotools.geometry.jts.ReferencedEnvelope;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Ordering;
+import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
+import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
import com.raytheon.uf.common.datadelivery.registry.DataSetMetaData;
import com.raytheon.uf.common.datadelivery.registry.Ensemble;
+import com.raytheon.uf.common.datadelivery.registry.GriddedCoverage;
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSetMetaData;
+import com.raytheon.uf.common.datadelivery.registry.Levels;
import com.raytheon.uf.common.datadelivery.registry.Network;
+import com.raytheon.uf.common.datadelivery.registry.Parameter;
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
+import com.raytheon.uf.common.gridcoverage.GridCoverage;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.serialization.JAXBManager;
import com.raytheon.uf.common.status.IUFStatusHandler;
@@ -66,6 +72,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.GriddedTim
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.GriddedTimingSubsetPresenter;
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SpecificDateTimeXML;
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML;
+import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.VerticalXML;
import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
/**
@@ -90,6 +97,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Mar 21, 2013 1794 djohnson Add option to create a shared subscription, if phase3 code is available.
* Mar 29, 2013 1841 djohnson Subscription is now UserSubscription.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
+ * Jun 04, 2013 223 mpduff Added grid specific items to this class.
+ * Jun 11, 2013 2064 mpduff Fix editing of subscriptions.
*
*
*
@@ -101,6 +110,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
public class GriddedSubsetManagerDlg
extends
SubsetManagerDlg {
+ private static final String TIMING_TAB_GRID = "Forecast Hours";
+
@VisibleForTesting
final String POPUP_TITLE = "Notice";
@@ -131,6 +142,8 @@ public class GriddedSubsetManagerDlg
private GriddedEnsembleSubsetTab ensembleTab;
+ private TabItem timingTab;
+
/**
* Constructor.
*
@@ -167,8 +180,33 @@ public class GriddedSubsetManagerDlg
}
@Override
- protected void createGridTabs(TabFolder tabFolder) {
- super.createGridTabs(tabFolder);
+ protected void createTabs(TabFolder tabFolder) {
+ GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
+ GridLayout gl = new GridLayout(1, false);
+
+ TabItem verticalTab = new TabItem(tabFolder, SWT.NONE);
+ verticalTab.setText(VERTICAL_TAB);
+ verticalTab.setData("valid", false);
+ Composite vertComp = new Composite(tabFolder, SWT.NONE);
+ vertComp.setLayout(gl);
+ vertComp.setLayoutData(gd);
+ verticalTab.setControl(vertComp);
+ vTab = new VerticalSubsetTab(vertComp, dataSet, this);
+
+ gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ gl = new GridLayout(1, false);
+
+ timingTab = new TabItem(tabFolder, SWT.NONE);
+ timingTab.setText(TIMING_TAB_GRID);
+ timingTab.setData("valid", false);
+ Composite timingComp = new Composite(tabFolder, SWT.NONE);
+ timingComp.setLayout(gl);
+ timingComp.setLayoutData(gd);
+ timingTab.setControl(timingComp);
+ timingTabControls = getDataTimingSubsetPresenter(timingComp, dataSet,
+ this, shell);
+ timingTabControls.init();
+
Ensemble e = dataSet.getEnsemble();
if (e != null && e.getMembers() != null) {
TabItem ensembleTabItem = new TabItem(tabFolder, SWT.NONE, 2);
@@ -190,6 +228,15 @@ public class GriddedSubsetManagerDlg
if (ensembleTab != null && !ensembleTab.isValid()) {
invalidTabs.add(ensembleTab.getName());
}
+
+ if (!vTab.isValid()) {
+ invalidTabs.add(VERTICAL_TAB);
+ }
+
+ if (!timingTabControls.isValid()) {
+ invalidTabs.add(timingTab.getText());
+ }
+
return invalidTabs;
}
@@ -207,6 +254,13 @@ public class GriddedSubsetManagerDlg
if (ensembleTab != null) {
ensembleTab.loadFromSubsetXML(subsetXml);
}
+
+ ArrayList vertList = subsetXml.getVerticalList();
+ vTab.populate(vertList, dataSet);
+
+ SpecificDateTimeXML time = subsetXml.getTime();
+ this.timingTabControls.populate(time, dataSet);
+
updateDataSize();
}
@@ -224,6 +278,52 @@ public class GriddedSubsetManagerDlg
if (ensembleTab != null) {
ensembleTab.loadFromSubscription(subscription);
}
+
+ // Cycle time
+ SpecificDateTimeXML timeXml = getTimeXmlFromSubscription();
+
+ timeXml.setLatestData(true);
+
+ this.timingTabControls.populate(timeXml, dataSet);
+
+ // Vertical/Parameters
+ Map levelMap = new HashMap();
+ List paramaterList = this.subscription.getParameter();
+
+ for (Parameter p : paramaterList) {
+ for (DataLevelType levelType : p.getLevelType()) {
+ if (!levelMap.containsKey(levelType.getKey())) {
+ VerticalXML v = new VerticalXML();
+ if (levelType.getUnit() == null) {
+ v.setLayerType(String.valueOf(levelType
+ .getDescription()));
+ } else {
+ v.setLayerType(levelType.getDescription() + " ("
+ + levelType.getUnit() + "" + ")");
+ }
+ levelMap.put(levelType.getKey(), v);
+ }
+ VerticalXML v = levelMap.get(levelType.getKey());
+ v.addParameter(p.getProviderName());
+
+ // TODO - This is set up to only have one level type with
+ // Multiple parameters. This will need to change if other
+ // Data providers have parameters with multiple level types
+ // containing multiple levels
+ if (levelType.getId() == 100) {
+ final Levels levels = p.getLevels();
+ final List selectedLevelIndices = levels
+ .getSelectedLevelIndices();
+ for (int index : selectedLevelIndices) {
+ v.addLevel(String.valueOf(levels.getLevel().get(index)));
+ }
+ }
+ }
+ }
+
+ ArrayList vertList = new ArrayList(
+ levelMap.values());
+ vTab.populate(vertList, dataSet);
}
@Override
@@ -494,4 +594,52 @@ public class GriddedSubsetManagerDlg
return (this.useLatestDate || this.metaData == null) ? null
: this.metaData.getUrl();
}
+
+ @Override
+ protected T populateSubscription(T sub,
+ boolean create) {
+ ArrayList selectedParameterObjs = vTab.getParameters();
+ sub.setParameter(selectedParameterObjs);
+
+ Time dataSetTime = dataSet.getTime();
+
+ Time newTime = new Time();
+
+ if (sub instanceof AdhocSubscription) {
+ newTime = setupDataSpecificTime(newTime, sub);
+ sub.setTime(newTime);
+ } else if (!create) {
+ Time time = sub.getTime();
+ List fcstHours = time.getFcstHours();
+ String[] selectedItems = this.timingTabControls
+ .getSelectedFcstHours();
+ List fcstIndices = new ArrayList();
+ for (String hr : selectedItems) {
+ fcstIndices.add(fcstHours.indexOf(hr));
+ }
+
+ time.setSelectedTimeIndices(fcstIndices);
+ subscription.setTime(time);
+ } else {
+ newTime.setEnd(dataSetTime.getEnd());
+ newTime.setFormat(dataSetTime.getFormat());
+ newTime.setNumTimes(dataSetTime.getNumTimes());
+ newTime.setRequestEnd(dataSetTime.getRequestEnd());
+ newTime.setRequestStart(dataSetTime.getRequestStart());
+ newTime.setStart(dataSetTime.getStart());
+ newTime.setStep(dataSetTime.getStep());
+ newTime.setStepUnit(dataSetTime.getStepUnit());
+ sub.setTime(newTime);
+ }
+
+ GriddedCoverage cov = (GriddedCoverage) dataSet.getCoverage();
+ cov.setModelName(dataSet.getDataSetName());
+ cov.setGridName(getNameText());
+ GridCoverage coverage = cov.getGridCoverage();
+ coverage.setName(getNameText());
+
+ setCoverage(sub, cov);
+
+ return sub;
+ }
}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/GriddedTimingSelectionDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/GriddedTimingSelectionDlg.java
index 5720184333..3c7dfd8679 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/GriddedTimingSelectionDlg.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/GriddedTimingSelectionDlg.java
@@ -60,6 +60,7 @@ import com.raytheon.viz.ui.presenter.components.ListConf;
* Jan 04, 2013 1420 mpduff Add Priority Composite.
* Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
* Feb 26, 2013 1592 djohnson When the shell is closed, don't submit the query.
+ * Jun 04, 2013 223 mpduff PriorityComp constructor changed.
*
*
*
@@ -142,9 +143,9 @@ public class GriddedTimingSelectionDlg extends CaveSWTDialog implements
// Get latency value
SystemRuleManager ruleManager = SystemRuleManager.getInstance();
int latency = ruleManager.getLatency(this.subscription, cycleTimes);
- SubscriptionPriority priority = ruleManager
- .getPriority(this.subscription, cycleTimes);
- priorityComp = new PriorityComp(shell, latency, priority);
+ SubscriptionPriority priority = ruleManager.getPriority(
+ this.subscription, cycleTimes);
+ priorityComp = new PriorityComp(shell, latency, priority, false);
gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
gl = new GridLayout(2, false);
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/PointSubsetManagerDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/PointSubsetManagerDlg.java
new file mode 100644
index 0000000000..70dc5b8ec3
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/PointSubsetManagerDlg.java
@@ -0,0 +1,235 @@
+/**
+ * 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.uf.viz.datadelivery.subscription.subset;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.TabFolder;
+import org.eclipse.swt.widgets.TabItem;
+
+import com.raytheon.uf.common.datadelivery.registry.Coverage;
+import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
+import com.raytheon.uf.common.datadelivery.registry.DataType;
+import com.raytheon.uf.common.datadelivery.registry.Parameter;
+import com.raytheon.uf.common.datadelivery.registry.PointDataSet;
+import com.raytheon.uf.common.datadelivery.registry.PointTime;
+import com.raytheon.uf.common.datadelivery.registry.Subscription;
+import com.raytheon.uf.common.datadelivery.registry.Time;
+import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.PointTimeSubsetPresenter;
+import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.PointTimeXML;
+import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML;
+
+/**
+ * {@link SubsetManagerDlg} for point data sets.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 04, 2013 223 mpduff Initial creation.
+ * Jun 11, 2013 2064 mpduff Fix editing of subscriptions.
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+
+public class PointSubsetManagerDlg extends
+ SubsetManagerDlg {
+
+ private static final String TIMING_TAB_TEXT = "Retrieval Interval";
+
+ /**
+ * Constructor.
+ *
+ * @param shell
+ * parent shell
+ * @param loadDataSet
+ * load data set flag
+ * @param subscription
+ * Subscription object
+ */
+ public PointSubsetManagerDlg(Shell shell, boolean loadDataSet,
+ Subscription subscription) {
+ super(shell, loadDataSet, subscription);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param shell
+ * parent shell
+ * @param dataSet
+ * the data set
+ * @param loadDataSet
+ * load data set flag
+ * @param subsetXml
+ * the subset xml object
+ */
+ public PointSubsetManagerDlg(Shell shell, PointDataSet dataSet,
+ boolean loadDataSet, SubsetXML subsetXml) {
+ super(shell, dataSet, loadDataSet, subsetXml);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param shell
+ * the parent shell
+ * @param dataSet
+ * the data set
+ */
+ public PointSubsetManagerDlg(Shell shell, PointDataSet dataSet) {
+ super(shell, dataSet);
+ }
+
+ @Override
+ void createTabs(TabFolder tabFolder) {
+ GridData gd = new GridData(SWT.CENTER, SWT.DEFAULT, true, false);
+ GridLayout gl = new GridLayout(1, false);
+
+ TabItem timingTab = new TabItem(tabFolder, SWT.NONE);
+ timingTab.setText(TIMING_TAB_TEXT);
+ timingTab.setData("valid", false);
+ Composite timingComp = new Composite(tabFolder, SWT.NONE);
+ timingComp.setLayout(gl);
+ timingComp.setLayoutData(gd);
+ timingTab.setControl(timingComp);
+ timingTabControls = getDataTimingSubsetPresenter(timingComp, dataSet,
+ this, shell);
+ timingTabControls.init();
+ }
+
+ @Override
+ public void updateDataSize() {
+ // Not used for point
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected PointTimeSubsetPresenter getDataTimingSubsetPresenter(
+ Composite parentComp, PointDataSet dataSet, IDataSize callback,
+ Shell shell) {
+ PointTimeSubsetTab view = new PointTimeSubsetTab(parentComp, callback,
+ shell);
+ return new PointTimeSubsetPresenter(dataSet, view);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected Time setupDataSpecificTime(Time newTime, Subscription sub) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected PointTimeXML getTimeXmlFromSubscription() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected T populateSubscription(T sub,
+ boolean create) {
+
+ PointTime newTime = new PointTime();
+ int interval = timingTabControls.getSaveInfo()
+ .getDataRetrievalInterval();
+ newTime.setInterval(interval);
+ newTime.setStartDate(new Date());
+ newTime.setEndDate(new Date());
+ sub.setTime(newTime);
+
+ Coverage cov = new Coverage();
+ cov.setEnvelope(dataSet.getCoverage().getEnvelope());
+ setCoverage(sub, cov);
+
+ List paramList = new ArrayList();
+ Map paramMap = dataSet.getParameters();
+ List levelTypeList = new ArrayList();
+ levelTypeList.add(new DataLevelType(DataLevelType.LevelType.SFC));
+ for (String key : paramMap.keySet()) {
+ Parameter p = paramMap.get(key);
+ p.setDataType(DataType.POINT);
+ p.setLevelType(levelTypeList);
+ paramList.add(p);
+ }
+
+ sub.setParameter(paramList);
+ return sub;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.viz.datadelivery.subscription.subset.SubsetManagerDlg
+ * #loadFromSubsetXML
+ * (com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML)
+ */
+ @Override
+ protected void loadFromSubsetXML(SubsetXML subsetXml) {
+ super.loadFromSubsetXML(subsetXml);
+
+ PointTimeXML time = subsetXml.getTime();
+ this.timingTabControls.populate(time, dataSet);
+
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.viz.datadelivery.subscription.subset.SubsetManagerDlg
+ * #loadFromSubscription
+ * (com.raytheon.uf.common.datadelivery.registry.Subscription)
+ */
+ @Override
+ protected void loadFromSubscription(Subscription subscription) {
+ super.loadFromSubscription(subscription);
+
+ PointTimeXML time = new PointTimeXML();
+ time.setDataRetrievalInterval(((PointTime) subscription.getTime())
+ .getInterval());
+
+ this.timingTabControls.populate(time, dataSet);
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/PointTimeSubsetTab.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/PointTimeSubsetTab.java
new file mode 100644
index 0000000000..4431194428
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/PointTimeSubsetTab.java
@@ -0,0 +1,140 @@
+/**
+ * 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.uf.viz.datadelivery.subscription.subset;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+import com.raytheon.uf.common.datadelivery.registry.PointTime;
+import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.IPointDataTimingSubsetView;
+
+/**
+ * Point Time Subset Tab. Sets the data retrieval interval.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 223 mpduff Initial creation.
+ * Jun 06, 2013 2038 djohnson Place refresh intervals into PointTime so BandwidthManager has access.
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+
+public class PointTimeSubsetTab extends DataTimingSubsetTab implements
+ IPointDataTimingSubsetView {
+
+ /** Data Retrieval Intervals */
+ private final String[] INTERVALS;
+
+ /** Retrieval Interval Selection Combo */
+ private Combo intervalCombo;
+
+ /**
+ * Constructor.
+ *
+ * @param parentComp
+ * parent composite
+ * @param callback
+ * dataSize callback
+ * @param shell
+ * Shell
+ */
+ public PointTimeSubsetTab(Composite parentComp, IDataSize callback,
+ Shell shell) {
+ super(parentComp, callback, shell);
+
+ // Use the string version of the refresh intervals found in PointTime
+ final List allowedRefreshIntervals = new ArrayList();
+ for (Iterator iter = PointTime.getAllowedRefreshIntervals()
+ .iterator(); iter.hasNext();) {
+ allowedRefreshIntervals.add(Integer.toString(iter.next()));
+ }
+ INTERVALS = allowedRefreshIntervals
+ .toArray(new String[allowedRefreshIntervals.size()]);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.viz.datadelivery.subscription.subset.DataTimingSubsetTab
+ * #init()
+ */
+ @Override
+ public void init() {
+ super.init();
+
+ GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
+ GridLayout gl = new GridLayout(2, false);
+ Group intervalGroup = new Group(parentComp, SWT.NONE);
+ intervalGroup.setText(" Set Data Retrieval Interval ");
+ intervalGroup.setLayout(gl);
+ intervalGroup.setLayoutData(gd);
+
+ Label intervalLabel = new Label(intervalGroup, SWT.NONE);
+ intervalLabel.setText("Retrieval Interval (minutes): ");
+
+ GridData comboData = new GridData(85, SWT.DEFAULT);
+ intervalCombo = new Combo(intervalGroup, SWT.READ_ONLY);
+ intervalCombo.setLayoutData(comboData);
+ intervalCombo.setItems(INTERVALS);
+ intervalCombo.select(0);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void setDataRetrievalInterval(int interval) {
+ int idx = 0;
+ for (String s : INTERVALS) {
+ if (String.valueOf(interval).equals(s)) {
+ intervalCombo.select(idx);
+ break;
+ }
+ idx++;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int getDataRetrievalInterval() {
+ return Integer.parseInt(intervalCombo.getItem(intervalCombo
+ .getSelectionIndex()));
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SpatialSubsetTab.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SpatialSubsetTab.java
index be78e0f33c..f6766fc14b 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SpatialSubsetTab.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SpatialSubsetTab.java
@@ -59,6 +59,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Dec 18, 2012 1439 mpduff Redo subset name validation.
* Dec 10, 2012 1259 bsteffen Switch Data Delivery from LatLon to referenced envelopes.
* Feb 20, 2013 1589 mpduff Fix to allow saving custom areas.
+ * Jun 14, 2013 2064 mpudff Force an update of region controls.
*
*
*
@@ -333,10 +334,9 @@ public class SpatialSubsetTab extends SubsetTab implements IDataSize {
i++;
}
- } else {
- areaComp.updateRegionControls();
}
-
+
+ areaComp.updateRegionControls();
}
/**
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SubsetFileManager.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SubsetFileManager.java
index 8e174fa23b..6b54c5712d 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SubsetFileManager.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SubsetFileManager.java
@@ -41,6 +41,7 @@ import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.datadelivery.common.xml.AreaXML;
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.DateRangeTimeXML;
+import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.PointTimeXML;
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SpecificDateTimeXML;
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML;
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.TimeXML;
@@ -62,6 +63,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Jul 30, 2012 702 jpiatt Code cleanup.
* Aug 22, 2012 0743 djohnson Add TimeXML subclasses.
* Nov 19, 2012 1289 bgonzale Added deleteArea(String) method.
+ * Jun 04, 2013 223 mpduff Added PointTimeXML to JaxB context.
*
*
*
@@ -70,15 +72,17 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
*/
public class SubsetFileManager {
- private static SubsetFileManager instance = null;
+ private static SubsetFileManager instance = new SubsetFileManager();
- private final String AREA_PATH = "dataDelivery" + File.separator + "subset" + File.separator + "area"
- + File.separator;
+ private final String AREA_PATH = "dataDelivery" + File.separator + "subset"
+ + File.separator + "area" + File.separator;
- private final String SUBSET_PATH = "dataDelivery" + File.separator + "subset" + File.separator;
+ private final String SUBSET_PATH = "dataDelivery" + File.separator
+ + "subset" + File.separator;
/** Status Handler */
- private final IUFStatusHandler statusHandler = UFStatus.getHandler(SubsetFileManager.class);
+ private final IUFStatusHandler statusHandler = UFStatus
+ .getHandler(SubsetFileManager.class);
/** JAXB context */
private JAXBContext jax;
@@ -101,10 +105,6 @@ public class SubsetFileManager {
* @return instance
*/
public static SubsetFileManager getInstance() {
- if (instance == null) {
- instance = new SubsetFileManager();
- }
-
return instance;
}
@@ -115,8 +115,7 @@ public class SubsetFileManager {
private void createContext() {
Class[] classes = new Class[] { AreaXML.class, SubsetXML.class,
SpecificDateTimeXML.class, DateRangeTimeXML.class,
- TimeXML.class,
- VerticalXML.class };
+ TimeXML.class, VerticalXML.class, PointTimeXML.class };
try {
jax = JAXBContext.newInstance(classes);
@@ -133,7 +132,7 @@ public class SubsetFileManager {
*
* @param area
* The area xml object to save
- * @param shell
+ * @param shell
* @return true if save successful
*/
public boolean saveArea(AreaXML area, Shell shell) {
@@ -142,13 +141,17 @@ public class SubsetFileManager {
}
IPathManager pm = PathManagerFactory.getPathManager();
- LocalizationContext context = pm.getContext(LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
- LocalizationFile areaLocFile = pm.getLocalizationFile(context, AREA_PATH + area.getRegionName());
+ LocalizationContext context = pm.getContext(
+ LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
+ LocalizationFile areaLocFile = pm.getLocalizationFile(context,
+ AREA_PATH + area.getRegionName());
if (areaLocFile.getFile().exists()) {
- String msg = "The file " + areaLocFile.getFile().getName()
+ String msg = "The file "
+ + areaLocFile.getFile().getName()
+ " already exists.\n\nWould you like to overwrite the file?";
- int response = DataDeliveryUtils.showMessage(shell, SWT.YES | SWT.NO, "File Exists", msg);
+ int response = DataDeliveryUtils.showMessage(shell, SWT.YES
+ | SWT.NO, "File Exists", msg);
if (response == SWT.NO) {
return false;
}
@@ -221,7 +224,7 @@ public class SubsetFileManager {
File file = locFile.getFile();
AreaXML area = new AreaXML();
try {
- area = (AreaXML)unmarshaller.unmarshal(file);
+ area = (AreaXML) unmarshaller.unmarshal(file);
} catch (JAXBException e) {
statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e);
e.printStackTrace();
@@ -237,9 +240,11 @@ public class SubsetFileManager {
public LocalizationFile[] getSubsets() {
IPathManager pm = PathManagerFactory.getPathManager();
- LocalizationContext context = pm.getContext(LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
+ LocalizationContext context = pm.getContext(
+ LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
String[] extensions = new String[] { "xml" };
- this.subsetFiles = pm.listFiles(context, SUBSET_PATH, extensions, false, true);
+ this.subsetFiles = pm.listFiles(context, SUBSET_PATH, extensions,
+ false, true);
return subsetFiles;
}
@@ -249,19 +254,23 @@ public class SubsetFileManager {
*
* @param subset
* the object to save
- * @param shell
+ * @param shell
* @return true if successfully saved
*/
public boolean saveSubset(SubsetXML subset, Shell shell) {
IPathManager pm = PathManagerFactory.getPathManager();
- LocalizationContext context = pm.getContext(LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
- LocalizationFile subsetLocFile = pm.getLocalizationFile(context, SUBSET_PATH + subset.getSubsetName());
+ LocalizationContext context = pm.getContext(
+ LocalizationType.CAVE_STATIC, LocalizationLevel.USER);
+ LocalizationFile subsetLocFile = pm.getLocalizationFile(context,
+ SUBSET_PATH + subset.getSubsetName());
if (subsetLocFile.getFile().exists()) {
- String msg = "The file " + subsetLocFile.getFile().getName()
+ String msg = "The file "
+ + subsetLocFile.getFile().getName()
+ " already exists.\n\nWould you like to overwrite the file?";
- int response = DataDeliveryUtils.showMessage(shell, SWT.YES | SWT.NO, "File Exists", msg);
+ int response = DataDeliveryUtils.showMessage(shell, SWT.YES
+ | SWT.NO, "File Exists", msg);
if (response == SWT.NO) {
return false;
}
@@ -271,8 +280,7 @@ public class SubsetFileManager {
marshaller.marshal(subset, subsetLocFile.getFile());
subsetLocFile.save();
System.out.println("Saved " + subsetLocFile.getFile().getPath());
-
-
+
return true;
} catch (JAXBException e) {
statusHandler.handle(Priority.ERROR, e.getLocalizedMessage(), e);
@@ -304,7 +312,8 @@ public class SubsetFileManager {
try {
return (SubsetXML>) unmarshaller.unmarshal(lf.getFile());
} catch (JAXBException e) {
- statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
+ statusHandler.handle(Priority.PROBLEM,
+ e.getLocalizedMessage(), e);
}
}
}
@@ -329,7 +338,8 @@ public class SubsetFileManager {
try {
lf.delete();
} catch (LocalizationOpFailedException e) {
- statusHandler.handle(Priority.PROBLEM, e.getLocalizedMessage(), e);
+ statusHandler.handle(Priority.PROBLEM,
+ e.getLocalizedMessage(), e);
}
}
}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SubsetManagerDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SubsetManagerDlg.java
index ba1f0236f0..5796ae19fe 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SubsetManagerDlg.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/SubsetManagerDlg.java
@@ -21,9 +21,6 @@ package com.raytheon.uf.viz.datadelivery.subscription.subset;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.eclipse.core.runtime.Status;
@@ -48,14 +45,12 @@ import org.opengis.referencing.operation.TransformException;
import com.google.common.base.Preconditions;
import com.raytheon.uf.common.datadelivery.registry.AdhocSubscription;
-import com.raytheon.uf.common.datadelivery.registry.DataLevelType;
+import com.raytheon.uf.common.datadelivery.registry.Coverage;
import com.raytheon.uf.common.datadelivery.registry.DataSet;
import com.raytheon.uf.common.datadelivery.registry.DataType;
-import com.raytheon.uf.common.datadelivery.registry.GriddedCoverage;
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
-import com.raytheon.uf.common.datadelivery.registry.Levels;
import com.raytheon.uf.common.datadelivery.registry.Network;
-import com.raytheon.uf.common.datadelivery.registry.Parameter;
+import com.raytheon.uf.common.datadelivery.registry.PointDataSet;
import com.raytheon.uf.common.datadelivery.registry.SiteSubscription;
import com.raytheon.uf.common.datadelivery.registry.Subscription;
import com.raytheon.uf.common.datadelivery.registry.Time;
@@ -63,7 +58,6 @@ import com.raytheon.uf.common.datadelivery.request.DataDeliveryConstants;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryPermission;
import com.raytheon.uf.common.datadelivery.retrieval.util.DataSizeUtils;
import com.raytheon.uf.common.geospatial.MapUtil;
-import com.raytheon.uf.common.gridcoverage.GridCoverage;
import com.raytheon.uf.common.registry.ebxml.RegistryUtil;
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
import com.raytheon.uf.common.status.IUFStatusHandler;
@@ -81,6 +75,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.ForceAp
import com.raytheon.uf.viz.datadelivery.subscription.SubscriptionService.IForceApplyPromptDisplayText;
import com.raytheon.uf.viz.datadelivery.subscription.presenter.CreateSubscriptionDlgPresenter;
import com.raytheon.uf.viz.datadelivery.subscription.subset.presenter.DataTimingSubsetPresenter;
+import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.PointTimeXML;
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SpecificDateTimeXML;
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.SubsetXML;
import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.TimeXML;
@@ -136,6 +131,9 @@ import com.raytheon.viz.ui.presenter.IDisplay;
* Apr 08, 2013 1826 djohnson Remove delivery options.
* May 15, 2013 1040 mpduff Implement shared subscriptions.
* May 21, 2013 2020 mpduff Rename UserSubscription to SiteSubscription.
+ * May 28, 2013 1650 djohnson More information when failing to schedule subscriptions.
+ * Jun 04, 2013 223 mpduff Moved data type specific code to sub classes.
+ * Jun 11, 2013 2064 mpduff Fix editing of subscriptions.
*
*
* @author mpduff
@@ -203,9 +201,7 @@ public abstract class SubsetManagerDlg T populateSubscription(T sub,
+ boolean create);
+
/** Create the information composite */
private void createInfoComp() {
GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
@@ -478,6 +448,8 @@ public abstract class SubsetManagerDlg selectedParameterObjs = vTab.getParameters();
-
sub.setRoute(defaultRoute);
sub.setName(nameText.getText());
if (subscription == null || subscription.getOfficeIDs() == null) {
@@ -636,55 +608,14 @@ public abstract class SubsetManagerDlg getInvalidTabs() {
Collection invalidTabs = new ArrayList(3);
- // Get the tabs to validate
- // TODO Hardcoding the tabs for now, fix this later
-
- // Validate the vertical tab
- if (!vTab.isValid()) {
- invalidTabs.add(VERTICAL_TAB);
- }
-
- if (!timingTabControls.isValid()) {
- invalidTabs.add(TIMING_TAB);
- }
-
- // Next is spatial subset tab
if (!spatialTabControls.isValid()) {
invalidTabs.add(SPATIAL_TAB);
}
@@ -870,9 +788,13 @@ public abstract class SubsetManagerDlg vertList = vTab.getSaveInfo();
- subset.setVerticalList(vertList);
+ // TODO Only save this for grid. Once Obs have parameters then this will
+ // need to be saved for obs
+ if (dataSet.getDataSetType() == DataType.GRID) {
+ // next save vertical layer/parameter info
+ ArrayList vertList = vTab.getSaveInfo();
+ subset.setVerticalList(vertList);
+ }
// finally the date/cycle/forecast data
TIMEXML time = timingTabControls.getSaveInfo();
@@ -898,12 +820,6 @@ public abstract class SubsetManagerDlg subsetXml) {
- ArrayList vertList = subsetXml.getVerticalList();
- vTab.populate(vertList, dataSet);
-
- TIMEXML time = subsetXml.getTime();
- this.timingTabControls.populate(time, dataSet);
-
if (this.subsetXml == subsetXml) {
// only populate area and name if subsetXml is loading from initial
// load, not from the saved subsets tab.
@@ -918,13 +834,6 @@ public abstract class SubsetManagerDlg levelMap = new HashMap();
- List paramaterList = this.subscription.getParameter();
-
- for (Parameter p : paramaterList) {
- for (DataLevelType levelType : p.getLevelType()) {
- if (!levelMap.containsKey(levelType.getKey())) {
- VerticalXML v = new VerticalXML();
- if (levelType.getUnit() == null) {
- v.setLayerType(String.valueOf(levelType
- .getDescription()));
- } else {
- v.setLayerType(levelType.getDescription() + " ("
- + levelType.getUnit() + "" + ")");
- }
- levelMap.put(levelType.getKey(), v);
- }
- VerticalXML v = levelMap.get(levelType.getKey());
- v.addParameter(p.getProviderName());
-
- // TODO - This is set up to only have one level type with
- // Multiple parameters. This will need to change if other
- // Data providers have parameters with multiple level types
- // containing multiple levels
- if (levelType.getId() == 100) {
- final Levels levels = p.getLevels();
- final List selectedLevelIndices = levels
- .getSelectedLevelIndices();
- for (int index : selectedLevelIndices) {
- v.addLevel(String.valueOf(levels.getLevel().get(index)));
- }
- }
- }
- }
-
- ArrayList vertList = new ArrayList(
- levelMap.values());
- vTab.populate(vertList, dataSet);
}
/**
@@ -994,7 +865,7 @@ public abstract class SubsetManagerDlg fromDataSet(Shell shell,
DataSet data) {
- if (data instanceof GriddedDataSet) {
+ if (data.getDataSetType() == DataType.GRID) {
return new GriddedSubsetManagerDlg(shell, (GriddedDataSet) data);
+ } else if (data.getDataSetType() == DataType.POINT) {
+ return new PointSubsetManagerDlg(shell, (PointDataSet) data);
}
throw new IllegalArgumentException(String.format(
DATASETS_NOT_SUPPORTED, data.getClass().getName()));
@@ -1053,6 +928,8 @@ public abstract class SubsetManagerDlg) subset);
+ } else if (data instanceof PointDataSet) {
+ return new PointSubsetManagerDlg(shell, (PointDataSet) data, true,
+ (SubsetXML) subset);
}
throw new IllegalArgumentException(String.format(
DATASETS_NOT_SUPPORTED, data.getClass().getName()));
@@ -1099,11 +979,13 @@ public abstract class SubsetManagerDlg wouldBeUnscheduledSubscriptions) {
+ final boolean singleSubscription = wouldBeUnscheduledSubscriptions
+ .size() == 1;
switch (option) {
case CANCEL:
return "Do not store the adhoc query";
case FORCE_APPLY:
- if (wouldBeUnscheduledSubscriptions.size() == 1
+ if (singleSubscription
&& wouldBeUnscheduledSubscriptions.contains(subscription
.getName())) {
// Can't force apply a query that won't ever be processed
@@ -1113,9 +995,36 @@ public abstract class SubsetManagerDlg
*
@@ -53,12 +54,6 @@ public abstract class DataTimingSubsetPresenter {
+ @VisibleForTesting
+ final String NO_DATA_FOR_DATE_AND_CYCLE = "No data is available for the specified date and cycle combination.";
+
+ @VisibleForTesting
+ final String MORE_THAN_ONE_CYCLE_SELECTED = "Adhoc queries can only be requested for a single cycle.";
+
/**
* Constructor.
*
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/presenter/IPointDataTimingSubsetView.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/presenter/IPointDataTimingSubsetView.java
new file mode 100644
index 0000000000..0d24490ed1
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/presenter/IPointDataTimingSubsetView.java
@@ -0,0 +1,54 @@
+/**
+ * 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.uf.viz.datadelivery.subscription.subset.presenter;
+
+/**
+ * TODO Add Description
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 mpduff Initial creation
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+
+public interface IPointDataTimingSubsetView extends IDataTimingSubsetView {
+ /**
+ * Set the Data Retrieval Interval.
+ *
+ * @param interval
+ * the interval to set
+ */
+ void setDataRetrievalInterval(int interval);
+
+ /**
+ * Get the Data Retrieval Interval.
+ *
+ * @return the data retrieval interval
+ */
+ int getDataRetrievalInterval();
+}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/presenter/PointTimeSubsetPresenter.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/presenter/PointTimeSubsetPresenter.java
new file mode 100644
index 0000000000..586dc3f2b2
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/presenter/PointTimeSubsetPresenter.java
@@ -0,0 +1,96 @@
+/**
+ * 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.uf.viz.datadelivery.subscription.subset.presenter;
+
+import com.raytheon.uf.common.datadelivery.registry.DataSet;
+import com.raytheon.uf.common.datadelivery.registry.PointDataSet;
+import com.raytheon.uf.common.datadelivery.registry.PointDataSetMetaData;
+import com.raytheon.uf.common.datadelivery.registry.ebxml.PointDataSetMetaDataQuery;
+import com.raytheon.uf.viz.datadelivery.subscription.subset.xml.PointTimeXML;
+
+/**
+ * Point timing tab Presenter.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 223 mpduff Initial creation.
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+
+public class PointTimeSubsetPresenter
+ extends
+ DataTimingSubsetPresenter {
+
+ /**
+ * Constructor.
+ *
+ * @param dataSet
+ * the PointDataSet
+ * @param view
+ * The View
+ */
+ public PointTimeSubsetPresenter(PointDataSet dataSet,
+ IPointDataTimingSubsetView view) {
+ super(dataSet, view);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isValid() {
+ // This is a combo box. Something is always selected. Just return true.
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public PointTimeXML getSaveInfo() {
+ PointTimeXML ptx = new PointTimeXML();
+ ptx.setDataRetrievalInterval(view.getDataRetrievalInterval());
+ return ptx;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void populate(PointTimeXML time, DataSet dataSet) {
+ view.setDataRetrievalInterval(time.getDataRetrievalInterval());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void updateSettings(PointTimeXML time) {
+ view.setDataRetrievalInterval(time.getDataRetrievalInterval());
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/DateRangeTimeXML.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/DateRangeTimeXML.java
index ddf3748f16..972ef10fd7 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/DateRangeTimeXML.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/DateRangeTimeXML.java
@@ -34,6 +34,7 @@ import javax.xml.bind.annotation.XmlRootElement;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Aug 22, 2012 0743 djohnson Moved in range specific code from TimeXML.
+ * Jun 04, 2013 223 mpduff Changed hierarchy.
*
*
*
@@ -43,14 +44,14 @@ import javax.xml.bind.annotation.XmlRootElement;
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "rangeDateTime")
-public class DateRangeTimeXML extends TimeXML {
+public class DateRangeTimeXML extends GriddedTimeXML {
@XmlElement(name = "rangeStart", type = String.class)
protected String rangeStart;
@XmlElement(name = "rangeEnd", type = String.class)
protected String rangeEnd;
-
+
/**
* @return the rangeStart
*/
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/GriddedTimeXML.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/GriddedTimeXML.java
new file mode 100644
index 0000000000..2814d8734e
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/GriddedTimeXML.java
@@ -0,0 +1,171 @@
+/**
+ * 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.uf.viz.datadelivery.subscription.subset.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+
+import org.apache.commons.lang.StringUtils;
+
+import com.raytheon.uf.common.util.CollectionUtil;
+import com.raytheon.uf.common.util.FileUtil;
+
+/**
+ * Subset Timing Tab saved settings object.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Mar 29, 2012 mpduff Initial creation
+ * Aug 21, 2012 0743 djohnson Add specificDate, use append rather than concatenate strings.
+ * Feb 15, 2013 1638 mschenke Moved Util.EOL into FileUtil
+ * Jun 04, 2013 223 mpduff Changed hierarchy.
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+@XmlAccessorType(XmlAccessType.NONE)
+public abstract class GriddedTimeXML extends TimeXML {
+
+ @XmlElement(name = "latestData")
+ protected boolean latestData;
+
+ @XmlElements({ @XmlElement(name = "cycle", type = Integer.class) })
+ protected List cycleList = new ArrayList();
+
+ @XmlElements({ @XmlElement(name = "fcstHour", type = String.class) })
+ protected List fcstHourList = new ArrayList();
+
+ /**
+ * @return the latestData
+ */
+ public boolean isLatestData() {
+ return latestData;
+ }
+
+ /**
+ * @param latestData
+ * the latestData to set
+ */
+ public void setLatestData(boolean latestData) {
+ this.latestData = latestData;
+ }
+
+ /**
+ * @return the cycle
+ */
+ public List getCycles() {
+ return cycleList;
+ }
+
+ /**
+ * @param cycle
+ * the cycle to set
+ */
+ public void setCycles(List cycles) {
+ this.cycleList = cycles;
+ }
+
+ /**
+ * @param cycle
+ */
+ public void addCycle(int cycle) {
+ this.cycleList.add(cycle);
+ }
+
+ /**
+ * @return the fcstHour
+ */
+ public List getFcstHours() {
+ return fcstHourList;
+ }
+
+ /**
+ * @param fcstHours
+ * the fcstHour to set
+ */
+ public void setFcstHours(List fcstHours) {
+ this.fcstHourList = fcstHours;
+ }
+
+ /**
+ * Add Forecast Hour
+ *
+ * @param hour
+ */
+ public void addHour(String hour) {
+ this.fcstHourList.add(hour);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml#getDisplayXmlString
+ * ()
+ */
+ @Override
+ public String getPreviewString() {
+ StringBuilder sb = new StringBuilder();
+
+ sb.append(FileUtil.EOL);
+ if (latestData) {
+ sb.append("Requesting Latest Data");
+ } else {
+ sb.append(getNonLatestData());
+ }
+ sb.append(FileUtil.EOL);
+
+ if (!CollectionUtil.isNullOrEmpty(cycleList)) {
+ sb.append("Cycles:").append(FileUtil.EOL);
+ for (Integer cycle : cycleList) {
+ sb.append(" ").append(
+ StringUtils.leftPad(cycle.toString(), 2, '0'));
+ }
+ sb.append(FileUtil.EOL);
+ }
+
+ if (!CollectionUtil.isNullOrEmpty(fcstHourList)) {
+ sb.append("Forecast Hours:").append(FileUtil.EOL);
+ for (String fcst : fcstHourList) {
+ sb.append(" ").append(fcst);
+ }
+ sb.append(FileUtil.EOL);
+ }
+ return sb.toString();
+ }
+
+ /**
+ * Return the display string for non-latest data.
+ *
+ * @return the display string
+ */
+ protected abstract String getNonLatestData();
+}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/PointTimeXML.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/PointTimeXML.java
new file mode 100644
index 0000000000..caabf2d2b3
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/PointTimeXML.java
@@ -0,0 +1,72 @@
+/**
+ * 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.uf.viz.datadelivery.subscription.subset.xml;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * Point time xml object.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * May 29, 2013 223 mpduff Initial creation.
+ *
+ *
+ *
+ * @author mpduff
+ * @version 1.0
+ */
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlRootElement
+public class PointTimeXML extends TimeXML {
+ @XmlElement
+ private int dataRetrievalInterval;
+
+ /**
+ * @return the dataRetrievalInterval
+ */
+ public int getDataRetrievalInterval() {
+ return dataRetrievalInterval;
+ }
+
+ /**
+ * @param dataRetrievalInterval
+ * the dataRetrievalInterval to set
+ */
+ public void setDataRetrievalInterval(int dataRetrievalInterval) {
+ this.dataRetrievalInterval = dataRetrievalInterval;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String getPreviewString() {
+ return "Data Retrieval Interval: " + dataRetrievalInterval;
+ }
+
+}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/SpecificDateTimeXML.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/SpecificDateTimeXML.java
index f0e4588fbb..c016d0ac1a 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/SpecificDateTimeXML.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/SpecificDateTimeXML.java
@@ -33,7 +33,8 @@ import javax.xml.bind.annotation.XmlRootElement;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Aug 22, 2012 0743 djohnson Initial creation
+ * Aug 22, 2012 0743 djohnson Initial creation.
+ * Jun 04, 2013 223 mpduff Changed hierarchy.
*
*
*
@@ -42,7 +43,7 @@ import javax.xml.bind.annotation.XmlRootElement;
*/
@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "specificDateTime")
-public class SpecificDateTimeXML extends TimeXML {
+public class SpecificDateTimeXML extends GriddedTimeXML {
@XmlElement(name = "specificDate")
protected String specificDate;
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/SubsetXML.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/SubsetXML.java
index 75cfc8c559..723f037d3c 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/SubsetXML.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/SubsetXML.java
@@ -44,7 +44,8 @@ import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml;
* ------------ ---------- ----------- --------------------------
* Mar 29, 2012 mpduff Initial creation
* Aug 10, 2012 1022 djohnson {@link SubsetXML} requires provider name.
- * Feb 15, 2013 1638 mschenke Moved Util.EOL into FileUtil
+ * Feb 15, 2013 1638 mschenke Moved Util.EOL into FileUtil.
+ * Jun 04, 2013 223 mpduff Refactoring method name change.
*
*
*
@@ -58,7 +59,7 @@ public class SubsetXML implements IDisplayXml {
@XmlElement(name = "datasetName", type = String.class)
protected String datasetName;
-
+
@XmlElement(name = "providerName", type = String.class)
private String providerName;
@@ -70,10 +71,10 @@ public class SubsetXML implements IDisplayXml {
@XmlElement
protected Ensemble ensemble;
-
+
@XmlElements({ @XmlElement(name = "vertical", type = VerticalXML.class) })
protected ArrayList verticalList = new ArrayList();
-
+
@XmlElementRef
protected TIMEXML time;
@@ -85,7 +86,8 @@ public class SubsetXML implements IDisplayXml {
}
/**
- * @param subsetName the subsetName to set
+ * @param subsetName
+ * the subsetName to set
*/
public void setSubsetName(String subsetName) {
this.subsetName = subsetName;
@@ -114,7 +116,8 @@ public class SubsetXML implements IDisplayXml {
}
/**
- * @param area the area to set
+ * @param area
+ * the area to set
*/
public void setArea(AreaXML area) {
this.area = area;
@@ -128,16 +131,18 @@ public class SubsetXML implements IDisplayXml {
}
/**
- * @param verticalList the verticalList to set
+ * @param verticalList
+ * the verticalList to set
*/
public void setVerticalList(ArrayList verticalList) {
this.verticalList = verticalList;
}
-
+
/**
* Add a VerticalXML object to the list
*
- * @param vertical VerticalXML object to add
+ * @param vertical
+ * VerticalXML object to add
*/
public void addVertical(VerticalXML vertical) {
this.verticalList.add(vertical);
@@ -151,7 +156,8 @@ public class SubsetXML implements IDisplayXml {
}
/**
- * @param time the time to set
+ * @param time
+ * the time to set
*/
public void setTime(TIMEXML time) {
this.time = time;
@@ -165,7 +171,8 @@ public class SubsetXML implements IDisplayXml {
}
/**
- * @param datasetName the datasetName to set
+ * @param datasetName
+ * the datasetName to set
*/
public void setDatasetName(String datasetName) {
this.datasetName = datasetName;
@@ -186,26 +193,30 @@ public class SubsetXML implements IDisplayXml {
this.providerName = providerName;
}
- /* (non-Javadoc)
- * @see com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml#getDisplayXmlString()
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml#getDisplayXmlString
+ * ()
*/
@Override
- public String getDisplayXmlString() {
+ public String getPreviewString() {
StringBuilder sb = new StringBuilder();
sb.append("Subset Name : ").append(subsetName).append(FileUtil.EOL);
sb.append("Dataset Name: ").append(datasetName).append(FileUtil.EOL);
sb.append("Provider: " + providerName);
-
- for (VerticalXML v: verticalList) {
- sb.append(v.getDisplayXmlString());
+
+ for (VerticalXML v : verticalList) {
+ sb.append(v.getPreviewString());
}
-
+
sb.append(FileUtil.EOL);
-
- sb.append(area.getDisplayXmlString());
-
- sb.append(time.getDisplayXmlString());
-
+
+ sb.append(area.getPreviewString());
+
+ sb.append(time.getPreviewString());
+
return sb.toString();
}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/TimeXML.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/TimeXML.java
index 4b0d4d6cf1..e54b26b709 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/TimeXML.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/TimeXML.java
@@ -19,18 +19,9 @@
**/
package com.raytheon.uf.viz.datadelivery.subscription.subset.xml;
-import java.util.ArrayList;
-import java.util.List;
-
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElements;
-import org.apache.commons.lang.StringUtils;
-
-import com.raytheon.uf.common.util.CollectionUtil;
-import com.raytheon.uf.common.util.FileUtil;
import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml;
/**
@@ -45,6 +36,7 @@ import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml;
* Mar 29, 2012 mpduff Initial creation
* Aug 21, 2012 0743 djohnson Add specificDate, use append rather than concatenate strings.
* Feb 15, 2013 1638 mschenke Moved Util.EOL into FileUtil
+ * Jun 04, 2013 223 mpduff Changed hierarchy.
*
*
*
@@ -53,111 +45,4 @@ import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml;
*/
@XmlAccessorType(XmlAccessType.NONE)
public abstract class TimeXML implements IDisplayXml {
-
- @XmlElement(name = "latestData")
- protected boolean latestData;
-
- @XmlElements({ @XmlElement(name = "cycle", type = Integer.class) })
- protected List cycleList = new ArrayList();
-
- @XmlElements({ @XmlElement(name = "fcstHour", type = String.class) })
- protected List fcstHourList = new ArrayList();
-
- /**
- * @return the latestData
- */
- public boolean isLatestData() {
- return latestData;
- }
-
- /**
- * @param latestData the latestData to set
- */
- public void setLatestData(boolean latestData) {
- this.latestData = latestData;
- }
-
- /**
- * @return the cycle
- */
- public List getCycles() {
- return cycleList;
- }
-
- /**
- * @param cycle the cycle to set
- */
- public void setCycles(List cycles) {
- this.cycleList = cycles;
- }
-
- /**
- * @param cycle
- */
- public void addCycle(int cycle) {
- this.cycleList.add(cycle);
- }
-
- /**
- * @return the fcstHour
- */
- public List getFcstHours() {
- return fcstHourList;
- }
-
- /**
- * @param fcstHours the fcstHour to set
- */
- public void setFcstHours(List fcstHours) {
- this.fcstHourList = fcstHours;
- }
-
- /**
- * Add Forecast Hour
- * @param hour
- */
- public void addHour(String hour) {
- this.fcstHourList.add(hour);
- }
-
- /* (non-Javadoc)
- * @see com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml#getDisplayXmlString()
- */
- @Override
- public String getDisplayXmlString() {
- StringBuilder sb = new StringBuilder();
-
- sb.append(FileUtil.EOL);
- if (latestData) {
- sb.append("Requesting Latest Data");
- } else {
- sb.append(getNonLatestData());
- }
- sb.append(FileUtil.EOL);
-
- if (!CollectionUtil.isNullOrEmpty(cycleList)) {
- sb.append("Cycles:").append(FileUtil.EOL);
- for (Integer cycle : cycleList) {
- sb.append(" ").append(
- StringUtils.leftPad(cycle.toString(), 2, '0'));
- }
- sb.append(FileUtil.EOL);
- }
-
- if (!CollectionUtil.isNullOrEmpty(fcstHourList)) {
- sb.append("Forecast Hours:").append(FileUtil.EOL);
- for (String fcst: fcstHourList) {
- sb.append(" ").append(fcst);
- }
- sb.append(FileUtil.EOL);
- }
- return sb.toString();
- }
-
- /**
- * Return the display string for non-latest data.
- *
- * @return the display string
- */
- protected abstract String getNonLatestData();
}
\ No newline at end of file
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/VerticalXML.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/VerticalXML.java
index 50e0301ae5..530397b3dc 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/VerticalXML.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/subscription/subset/xml/VerticalXML.java
@@ -37,7 +37,8 @@ import com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Mar 29, 2012 mpduff Initial creation
+ * Mar 29, 2012 mpduff Initial creation.
+ * Jun 04, 2013 223 mpudff Refactored Method name change.
*
*
*
@@ -116,7 +117,7 @@ public class VerticalXML implements IDisplayXml {
* @see com.raytheon.uf.viz.datadelivery.common.xml.IDisplayXml#getDisplayXmlString()
*/
@Override
- public String getDisplayXmlString() {
+ public String getPreviewString() {
final String nl = "\n";
StringBuilder sb = new StringBuilder();
sb.append(nl);
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/system/BandwidthTab.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/system/BandwidthTab.java
index a7e51bcc09..6155fd3ec2 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/system/BandwidthTab.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/system/BandwidthTab.java
@@ -48,6 +48,8 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 14, 2013 2000 djohnson Initial creation
+ * May 23, 2013 1650 djohnson Reword change bandwidth message.
+ * Jun 12, 2013 2064 mpduff Update label.
*
*
*
@@ -90,8 +92,7 @@ public class BandwidthTab extends SystemApplyCancelTab {
protected void initializeTabComponents(Composite mainComp) {
GridLayout gl = new GridLayout(1, false);
GridData gd = new GridData(SWT.VERTICAL, SWT.DEFAULT, true, false);
- Composite configurationComposite = new Composite(mainComp,
- SWT.NONE);
+ Composite configurationComposite = new Composite(mainComp, SWT.NONE);
configurationComposite.setLayout(gl);
configurationComposite.setLayoutData(gd);
@@ -113,7 +114,7 @@ public class BandwidthTab extends SystemApplyCancelTab {
gd = new GridData(165, SWT.DEFAULT);
Label availBandwith = new Label(outerComp, SWT.NONE);
availBandwith.setLayoutData(gd);
- availBandwith.setText("OPSNET Bandwidth (KB):");
+ availBandwith.setText("OPSNET Bandwidth (kB/s):");
final Spinner availBandwidthSpinner = new Spinner(outerComp, SWT.BORDER);
availBandwidthSpinner.setMinimum(0);
@@ -159,7 +160,7 @@ public class BandwidthTab extends SystemApplyCancelTab {
}
StringBuilder sb = new StringBuilder(StringUtil.createMessage(
- "Changing the default bandwidth for " + Network.OPSNET
+ "Changing the bandwidth for " + Network.OPSNET
+ " will unschedule the following subscriptions:",
subscriptionNames));
sb.append(StringUtil.NEWLINE).append(StringUtil.NEWLINE);
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/system/SystemManagementDlg.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/system/SystemManagementDlg.java
index 4161c41df3..3b8fe66cb5 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/system/SystemManagementDlg.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/system/SystemManagementDlg.java
@@ -256,11 +256,13 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
public String getOptionDisplayText(ForceApplyPromptResponse option,
int requiredLatency, Subscription subscription,
Set wouldBeUnscheduledSubscriptions) {
+ final boolean singleSubscription = wouldBeUnscheduledSubscriptions
+ .size() == 1;
switch (option) {
case CANCEL:
return "Do not update the rules";
case FORCE_APPLY:
- if (wouldBeUnscheduledSubscriptions.size() == 1) {
+ if (singleSubscription) {
return "Update the rules and unschedule "
+ wouldBeUnscheduledSubscriptions.iterator().next();
}
@@ -268,6 +270,9 @@ public class SystemManagementDlg extends CaveSWTDialog implements IDisplay,
case INCREASE_LATENCY:
// Signifies it should not be an option
return null;
+ case EDIT_SUBSCRIPTIONS:
+ return "Edit the "
+ + ((singleSubscription) ? "subscription" : "subscriptions");
default:
throw new IllegalArgumentException(
"Don't know how to handle option [" + option + "]");
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/system/SystemRuleManager.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/system/SystemRuleManager.java
index 42307452c0..6846876fa3 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/system/SystemRuleManager.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/system/SystemRuleManager.java
@@ -51,6 +51,7 @@ import com.raytheon.uf.viz.datadelivery.subscription.xml.PriorityRuleXML;
import com.raytheon.uf.viz.datadelivery.subscription.xml.PriorityRulesXML;
import com.raytheon.uf.viz.datadelivery.subscription.xml.RuleXML;
import com.raytheon.uf.viz.datadelivery.subscription.xml.RulesXML;
+import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils;
import com.raytheon.uf.viz.datadelivery.utils.DataSetFrequency;
import com.raytheon.uf.viz.datadelivery.utils.NameOperationItems;
import com.raytheon.uf.viz.datadelivery.utils.TypeOperationItems;
@@ -67,7 +68,8 @@ import com.raytheon.uf.viz.datadelivery.utils.TypeOperationItems;
* Sep 17, 2012 730 jpiatt Initial creation.
* Oct 23, 2012 1286 djohnson Hook into bandwidth management.
* Jan 04, 2013 1420 mpduff Move rules into a single file.
- * Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
+ * Jan 25, 2013 1528 djohnson Subscription priority is now an enum.
+ * Jun 04, 2013 223 mpduff Implement point data types.
*
*
*
@@ -468,6 +470,38 @@ public class SystemRuleManager {
return freq.getDefaultLatency();
}
+ /**
+ * Get latency value for point data.
+ *
+ * @param sub
+ * the subscription object
+ * @return the latency value
+ */
+ public int getPointDataLatency(Subscription sub) {
+ LatencyRulesXML rulesXml = this.getLatencyRules(false);
+
+ for (LatencyRuleXML rule : rulesXml.getRules()) {
+ if (OpsNetFieldNames.NAME.toString().equals(rule.getRuleField())) {
+ if (rule.matches(sub, null)) {
+ return rule.getLatency();
+ }
+ } else if (OpsNetFieldNames.SIZE.toString().equals(
+ rule.getRuleField())) {
+ if (rule.matches(sub, null)) {
+ return rule.getLatency();
+ }
+ } else if (OpsNetFieldNames.TYPE.toString().equals(
+ rule.getRuleField())) {
+ if (rule.matches(sub, null)) {
+ return rule.getLatency();
+ }
+ }
+ }
+
+ // Set default if none found
+ return DataDeliveryUtils.POINT_DATASET_DEFAULT_LATENCY_IN_MINUTES;
+ }
+
/**
* Return the lowest latency value defined by the rules.
*
@@ -499,6 +533,36 @@ public class SystemRuleManager {
return latency;
}
+ /**
+ * Get the priority for the point data subscription.
+ *
+ * @param sub
+ * the subscription object
+ * @return the priority
+ */
+ public SubscriptionPriority getPointDataPriority(Subscription sub) {
+ PriorityRulesXML rulesXml = this.getPriorityRules(false);
+ for (PriorityRuleXML rule : rulesXml.getRules()) {
+ if (OpsNetFieldNames.NAME.toString().equals(rule.getRuleField())) {
+ if (rule.matches(sub, null)) {
+ return rule.getPriority();
+ }
+ } else if (OpsNetFieldNames.SIZE.toString().equals(
+ rule.getRuleField())) {
+ if (rule.matches(sub, null)) {
+ return rule.getPriority();
+ }
+ } else if (OpsNetFieldNames.TYPE.toString().equals(
+ rule.getRuleField())) {
+ if (rule.matches(sub, null)) {
+ return rule.getPriority();
+ }
+ }
+ }
+
+ return SubscriptionPriority.NORMAL;
+ }
+
/**
* Return the lowest priority value defined by the rules.
*
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryUtils.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryUtils.java
index f5e727788f..e941aaac03 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryUtils.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataDeliveryUtils.java
@@ -43,6 +43,7 @@ import com.raytheon.uf.common.datadelivery.registry.Time;
import com.raytheon.uf.common.datadelivery.request.DataDeliveryAuthRequest;
import com.raytheon.uf.common.time.util.TimeUtil;
import com.raytheon.uf.common.util.CollectionUtil;
+import com.raytheon.uf.common.util.SizeUtil;
import com.raytheon.uf.common.util.StringUtil;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
@@ -75,6 +76,9 @@ import com.vividsolutions.jts.geom.Coordinate;
* Apr 10, 2013 1891 djohnson Add getDisplayData() method to pending subscription columns.
* May 15, 2013 1040 mpduff Using Set for office Ids.
* May 20, 2013 2000 djohnson Add message to inform the user changes were applied.
+ * Jun 04, 2013 223 mpduff Add point data stuff.
+ * Jun 11, 2013 2064 mpduff Don't output Parameter header if none exist.
+ * Jun 12, 2013 2064 mpduff Use SizeUtil to format data size output.
*
*
* @author mpduff
@@ -86,12 +90,17 @@ public class DataDeliveryUtils {
/**
* Default latency applied to hourly datasets.
*/
- public static final int HOURLY_DATASET_LATENCY_IN_MINUTES = 40;
+ public static final int GRIDDED_HOURLY_DATASET_LATENCY_IN_MINUTES = 40;
/**
* Default latency applied non-hourly datasets.
*/
- public static final int NON_HOURLY_DATASET_LATENCY_IN_MINUTES = 75;
+ public static final int GRIDDED_NON_HOURLY_DATASET_LATENCY_IN_MINUTES = 75;
+
+ /**
+ * Required default latency value for point data.
+ */
+ public static final int POINT_DATASET_DEFAULT_LATENCY_IN_MINUTES = 15;
private static final int UNSET = -1;
@@ -269,7 +278,7 @@ public class DataDeliveryUtils {
DATA_SIZE("Data Size", null) {
@Override
public String getDisplayData(SubscriptionManagerRowData rd) {
- return String.valueOf(rd.getDataSetSize());
+ return SizeUtil.prettyKiloByteSize(rd.getDataSetSize());
}
},
/** Column Group Name */
@@ -622,7 +631,8 @@ public class DataDeliveryUtils {
.append(newline);
fmtStr.append("Dataset Name: ").append(sub.getDataSetName())
.append(newline);
- fmtStr.append("Dataset Size: ").append(sub.getDataSetSize())
+ fmtStr.append("Dataset Size: ")
+ .append(SizeUtil.prettyKiloByteSize(sub.getDataSetSize()))
.append(newline);
fmtStr.append("Provider: ").append(sub.getProvider()).append(newline);
fmtStr.append("Office IDs: ")
@@ -679,7 +689,7 @@ public class DataDeliveryUtils {
fmtStr.append(newline);
}
final List cycles = subTime.getCycleTimes();
- if (cycles != null) {
+ if (cycles != null && !cycles.isEmpty()) {
fmtStr.append("Cycles: ").append(newline);
fmtStr.append("------ ");
for (int cycle : cycles) {
@@ -689,28 +699,31 @@ public class DataDeliveryUtils {
fmtStr.append(newline);
}
- fmtStr.append("Parameters:").append(newline);
List parmArray = sub.getParameter();
- for (Parameter p : parmArray) {
- fmtStr.append("------ Name: ").append(p.getName()).append(newline);
- fmtStr.append("------ Provider Name: ").append(p.getProviderName())
- .append(newline);
- fmtStr.append("------ Definition: ").append(p.getDefinition())
- .append(newline);
- fmtStr.append("------ Data Type: ").append(p.getDataType())
- .append(newline);
+ if (!CollectionUtil.isNullOrEmpty(parmArray)) {
+ fmtStr.append("Parameters:").append(newline);
+ for (Parameter p : parmArray) {
+ fmtStr.append("------ Name: ").append(p.getName())
+ .append(newline);
+ fmtStr.append("------ Provider Name: ")
+ .append(p.getProviderName()).append(newline);
+ fmtStr.append("------ Definition: ").append(p.getDefinition())
+ .append(newline);
+ fmtStr.append("------ Data Type: ").append(p.getDataType())
+ .append(newline);
- fmtStr.append("------ Level Type: ").append(newline);
- for (DataLevelType dlt : p.getLevelType()) {
- fmtStr.append("------------ Type: ").append(dlt.getType())
- .append(newline);
- fmtStr.append("------------ ID: ").append(dlt.getId())
- .append(newline);
- if (dlt.getUnit() != null) {
- fmtStr.append("------------ Unit: ").append(dlt.getUnit())
+ fmtStr.append("------ Level Type: ").append(newline);
+ for (DataLevelType dlt : p.getLevelType()) {
+ fmtStr.append("------------ Type: ").append(dlt.getType())
.append(newline);
- } else {
- fmtStr.append("------------ Unit: ").append(newline);
+ fmtStr.append("------------ ID: ").append(dlt.getId())
+ .append(newline);
+ if (dlt.getUnit() != null) {
+ fmtStr.append("------------ Unit: ")
+ .append(dlt.getUnit()).append(newline);
+ } else {
+ fmtStr.append("------------ Unit: ").append(newline);
+ }
}
}
}
diff --git a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataSetFrequency.java b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataSetFrequency.java
index 70d49d782c..497a131eae 100644
--- a/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataSetFrequency.java
+++ b/cave/com.raytheon.uf.viz.datadelivery/src/com/raytheon/uf/viz/datadelivery/utils/DataSetFrequency.java
@@ -34,6 +34,7 @@ import com.raytheon.uf.common.time.util.TimeUtil;
* ------------ ---------- ----------- --------------------------
* Jan 08, 2013 1420 mpduff Initial creation.
* Jan 22, 2013 1519 djohnson Correct the non-hourly default latency to match requirements.
+ * Jun 04, 2013 223 mpduff Refactored constant name changes.
*
*
*
@@ -42,10 +43,10 @@ import com.raytheon.uf.common.time.util.TimeUtil;
*/
public enum DataSetFrequency {
- HOURLY(DataDeliveryUtils.HOURLY_DATASET_LATENCY_IN_MINUTES), SIX_HOURLY(
- DataDeliveryUtils.NON_HOURLY_DATASET_LATENCY_IN_MINUTES), TWELVE_HOURLY(
- DataDeliveryUtils.NON_HOURLY_DATASET_LATENCY_IN_MINUTES), DAILY(
- DataDeliveryUtils.NON_HOURLY_DATASET_LATENCY_IN_MINUTES);
+ HOURLY(DataDeliveryUtils.GRIDDED_HOURLY_DATASET_LATENCY_IN_MINUTES), SIX_HOURLY(
+ DataDeliveryUtils.GRIDDED_NON_HOURLY_DATASET_LATENCY_IN_MINUTES), TWELVE_HOURLY(
+ DataDeliveryUtils.GRIDDED_NON_HOURLY_DATASET_LATENCY_IN_MINUTES), DAILY(
+ DataDeliveryUtils.GRIDDED_NON_HOURLY_DATASET_LATENCY_IN_MINUTES);
private int defaultLatency;
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/META-INF/MANIFEST.MF b/cave/com.raytheon.uf.viz.derivparam.python/META-INF/MANIFEST.MF
index 1a0f1e7664..36a778a9ea 100644
--- a/cave/com.raytheon.uf.viz.derivparam.python/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.uf.viz.derivparam.python/META-INF/MANIFEST.MF
@@ -17,6 +17,7 @@ Require-Bundle: com.raytheon.uf.common.status;bundle-version="1.12.1174",
org.jep;bundle-version="1.0.0",
org.eclipse.ui;bundle-version="3.6.1",
org.eclipse.core.runtime;bundle-version="3.6.0",
- com.raytheon.uf.common.util;bundle-version="1.12.1174"
+ com.raytheon.uf.common.util;bundle-version="1.12.1174",
+ com.raytheon.uf.common.python.concurrent;bundle-version="1.0.0"
Export-Package: com.raytheon.uf.viz.derivparam.python,
com.raytheon.uf.viz.derivparam.python.function
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Cape.py b/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Cape.py
index cc3c7bc057..61c86dce06 100644
--- a/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Cape.py
+++ b/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Cape.py
@@ -18,10 +18,7 @@
# further licensing information.
##
-# determine the location of the python ported meteolib
-# TODO put the meteolib location in the java MasterDerivScript instead of having
-# to manually determine its location like this
-import sys
+from com.raytheon.uf.viz.derivparam.python.function import CapeFunc
from numpy import zeros
def execute(*args):
@@ -93,104 +90,9 @@ def __execute(*args):
pressureValue = pressure
pressure = zeros(temperatureValues.shape, temperatureValues.dtype)
pressure[:] = pressureValue
-
- return capeFunc(useVirtualTemp, pressureValues, temperatureValues, pressure, potentialTemperature, specificHumidity, upperTerminationPressure)
-
-import numpy as np
-import ctypes as ct
-from com.raytheon.edex.meteoLib import MeteoLibUtil
-
-def capeFunc(usetv, p_dat, tve_dat, p0, th0, sh0, ptop = None):
- """ Use the native capeFunc function
- """
-
- # define the c_float_ptr type
- c_float_ptr = ct.POINTER(ct.c_float)
-
- # determine the input dimensions
- dataShape = tve_dat.shape
-
- nx = dataShape[2] if len(dataShape) > 2 else None
- ny = dataShape[1] if len(dataShape) > 1 else None
- nz = dataShape[0]
-
- gridArea = nx * ny
-
- # flatten all input arrays
- p_dat = np.copy(p_dat)
- tve_dat = np.copy(tve_dat)
- p0 = np.copy(p0)
- th0 = np.copy(th0)
- sh0 = np.copy(sh0)
-
- p_dat[np.isnan(p_dat)] = 1e37
- tve_dat[np.isnan(tve_dat)] = 1e37
- p0[np.isnan(p0)] = 1e37
- th0[np.isnan(th0)] = 1e37
- sh0[np.isnan(sh0)] = 1e37
-
- p_dat.resize((nz, nx * ny,))
- tve_dat.resize((nz, nx * ny,))
- p0.resize((p0.size,))
- th0.resize((th0.size,))
- sh0.resize((sh0.size,))
-
- if ptop != None:
- ptop.resize((ptop.size,))
-
-
- # load the library
- meteoLibPath = MeteoLibUtil.getSoPath()
- meteoLib = np.ctypeslib.load_library(meteoLibPath,"")
- capeFunc = meteoLib.capeFunc if ptop == None else meteoLib.capeFuncTop
-
- # "define" the capeFunc signature
- capeFunc.restype = ct.c_int # return type
- capeFunc.argtypes = [ct.c_float,
- ct.POINTER(c_float_ptr),
- ct.POINTER(c_float_ptr),
- c_float_ptr,
- c_float_ptr,
- c_float_ptr,
- ct.c_int,
- ct.c_int,
- ct.c_int,
- ct.c_int,
- c_float_ptr,
- c_float_ptr]
-
- if ptop != None:
- capeFunc.argtypes.append(c_float_ptr)
-
- # result arrays
- cape_dat = np.zeros(gridArea,p_dat.dtype)
- cin_dat = np.zeros(gridArea,p_dat.dtype)
-
- capeFuncArgs = [ct.c_float(usetv),
-
- # get c_style pointers to the 2D input arrays
- (c_float_ptr*len(p_dat))(*[row.ctypes.data_as(c_float_ptr) for row in p_dat]),
- (c_float_ptr*len(tve_dat))(*[row.ctypes.data_as(c_float_ptr) for row in tve_dat]),
-
- p0.ctypes.data_as(c_float_ptr),
- th0.ctypes.data_as(c_float_ptr),
- sh0.ctypes.data_as(c_float_ptr),
- ct.c_int(nx),
- ct.c_int(nx),
- ct.c_int(ny),
- ct.c_int(nz),
- cape_dat.ctypes.data_as(c_float_ptr),
- cin_dat.ctypes.data_as(c_float_ptr)]
-
- if ptop != None:
- capeFuncArgs.append(ptop.ctypes.data_as(c_float_ptr))
-
- val = capeFunc(*capeFuncArgs)
- if val == 1 :
- raise MemoryError('Cape derived parameter ran out of memory')
- exit
- # resize the cape and cin data to the appropriate grid size
- cape_dat.resize((ny,nx))
- cin_dat.resize((ny,nx))
-
- return cape_dat, cin_dat
+ if upperTerminationPressure is None:
+ threeDshape = pressureValues.shape
+ return CapeFunc.capeFunc(useVirtualTemp, pressureValues, temperatureValues, pressure, potentialTemperature, specificHumidity, threeDshape[1], threeDshape[2], threeDshape[0]).__numpy__
+ else:
+ threeDshape = pressureValues.shape
+ return CapeFunc.capeFuncTop(useVirtualTemp, pressureValues, temperatureValues, pressure, potentialTemperature, specificHumidity, upperTerminationPressure, threeDshape[1], threeDshape[2], threeDshape[0]).__numpy__
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Dcape.py b/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Dcape.py
index 69413dd048..bb996fe7ab 100644
--- a/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Dcape.py
+++ b/cave/com.raytheon.uf.viz.derivparam.python/localization/derivedParameters/functions/Dcape.py
@@ -22,13 +22,12 @@
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
-# 17 Feb 2010 #4502 jelkins Initial Creation.
+# Feb 17, 2010 4502 jelkins Initial Creation.
+# Jun 05, 2013 2043 bsteffen Ported from meteolib C
-# determine the location of the python ported meteolib
-# TODO put the meteolib location in the java MasterDerivScript instead of having
-# to manually determine its location like this
-import sys
from numpy import zeros
+from com.raytheon.uf.viz.derivparam.python.function import DCapeFunc
+
def execute(threeDtemperature, threeDdewpoint, pressure, potentialTemperature, specificHumidity,maxEvaporation,maxRelativeHumidity,useVirtualTemp):
""" Calculate Downdraft Convective Available Potential Energy
@@ -62,89 +61,6 @@ def execute(threeDtemperature, threeDdewpoint, pressure, potentialTemperature, s
pressureValue = pressure
pressure = zeros(potentialTemperature.shape, potentialTemperature.dtype)
pressure[:] = pressureValue
+ threeDshape = threeDpressure.shape
+ return DCapeFunc.dcapeFunc(useVirtualTemp, threeDpressure, threeDtemperature[0], threeDdewpoint[0], pressure, potentialTemperature, specificHumidity, threeDshape[1], threeDshape[2], threeDshape[0], maxEvaporation, maxRelativeHumidity).__numpy__[0]
- return dcapeFunc(useVirtualTemp, threeDpressure, threeDtemperature[0], threeDdewpoint[0], pressure, potentialTemperature, specificHumidity, maxEvaporation, maxRelativeHumidity)
-
-from com.raytheon.edex.meteoLib import MeteoLibUtil
-import numpy as np
-import ctypes as ct
-
-def dcapeFunc(usetv, p_dat, t_dat, td_dat, p0, th0, sh0, max_evap, max_rh):
- """ Use the native dcapeFunc function
- """
-
- # define the c_float_ptr type
- c_float_ptr = ct.POINTER(ct.c_float)
-
- # determine the input dimensions
- dataShape = t_dat.shape
-
- nx = dataShape[2] if len(dataShape) > 2 else None
- ny = dataShape[1] if len(dataShape) > 1 else None
- nz = dataShape[0]
-
- gridArea = nx * ny
-
- # flatten all input arrays
- p_dat = np.copy(p_dat)
- t_dat = np.copy(t_dat)
- td_dat = np.copy(td_dat)
- p0 = np.copy(p0)
- th0 = np.copy(th0)
- sh0 = np.copy(sh0)
- p_dat.resize((nz, nx * ny,))
- t_dat.resize((nz, nx * ny,))
- td_dat.resize((nz, nx * ny,))
- p0.resize((p0.size,))
- th0.resize((th0.size,))
- sh0.resize((sh0.size,))
-
- # load the library
- meteoLibPath = MeteoLibUtil.getSoPath()
- meteoLib = np.ctypeslib.load_library(meteoLibPath,"")
- dcapeFunc = meteoLib.dcapeFunc
-
- # "define" the capeFunc signature
- dcapeFunc.restype = None # return type
- dcapeFunc.argtypes = [ct.c_float,
- ct.POINTER(c_float_ptr),
- ct.POINTER(c_float_ptr),
- ct.POINTER(c_float_ptr),
- c_float_ptr,
- c_float_ptr,
- c_float_ptr,
- ct.c_int,
- ct.c_int,
- ct.c_int,
- ct.c_int,
- ct.c_float,
- ct.c_float,
- c_float_ptr]
-
- # result arrays
- dcape_dat = np.zeros(gridArea,p_dat.dtype)
-
- dcapeFuncArgs = [ct.c_float(usetv),
-
- # get c_style pointers to the 2D input arrays
- (c_float_ptr*len(p_dat))(*[row.ctypes.data_as(c_float_ptr) for row in p_dat]),
- (c_float_ptr*len(t_dat))(*[row.ctypes.data_as(c_float_ptr) for row in t_dat]),
- (c_float_ptr*len(td_dat))(*[row.ctypes.data_as(c_float_ptr) for row in td_dat]),
-
- p0.ctypes.data_as(c_float_ptr),
- th0.ctypes.data_as(c_float_ptr),
- sh0.ctypes.data_as(c_float_ptr),
- ct.c_int(nx),
- ct.c_int(nx),
- ct.c_int(ny),
- ct.c_int(nz),
- ct.c_float(max_evap),
- ct.c_float(max_rh),
- dcape_dat.ctypes.data_as(c_float_ptr)]
-
- dcapeFunc(*dcapeFuncArgs)
-
- # resize the cape data to the appropriate grid size
- dcape_dat.resize((ny,nx))
-
- return dcape_dat
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/DerivParamPythonFunctionAdapter.java b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/DerivParamPythonFunctionAdapter.java
index e3c2e486fd..70b1ca3caf 100644
--- a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/DerivParamPythonFunctionAdapter.java
+++ b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/DerivParamPythonFunctionAdapter.java
@@ -22,20 +22,13 @@ package com.raytheon.uf.viz.derivparam.python;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Date;
import java.util.List;
-
-import jep.JepException;
+import java.util.concurrent.ExecutionException;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
-import com.raytheon.uf.common.localization.IPathManager;
-import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
-import com.raytheon.uf.common.localization.LocalizationFile;
-import com.raytheon.uf.common.localization.LocalizationUtil;
import com.raytheon.uf.common.localization.PathManagerFactory;
-import com.raytheon.uf.common.python.PyUtil;
+import com.raytheon.uf.common.python.concurrent.PythonJobCoordinator;
import com.raytheon.uf.common.status.IUFStatusHandler;
import com.raytheon.uf.common.status.UFStatus;
import com.raytheon.uf.common.status.UFStatus.Priority;
@@ -53,7 +46,9 @@ import com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Dec 16, 2010 mschenke Initial creation
+ * Dec 16, 2010 mschenke Initial creation
+ * Jun 04, 2013 2041 bsteffen Switch derived parameters to use
+ * concurrent python for threading.
*
*
*
@@ -68,18 +63,10 @@ public class DerivParamPythonFunctionAdapter implements
private static final String PYTHON = "python";
- private static final String INTERFACE_SCRIPT = DerivedParameterGenerator.DERIV_PARAM_DIR
- + File.separator
- + PYTHON
- + File.separator
- + "DerivParamImporter.py";
-
private static final String TEMPLATE_FILE = DerivedParameterGenerator.DERIV_PARAM_DIR
+ File.separator + PYTHON + File.separator + "functionTemplate.txt";
- private MasterDerivScript masterScript;
-
- private List results;
+ private PythonJobCoordinator coordinator;
/*
* (non-Javadoc)
@@ -134,58 +121,11 @@ public class DerivParamPythonFunctionAdapter implements
*/
@Override
public void init() {
- IPathManager pm = PathManagerFactory.getPathManager();
-
- File script = pm.getStaticFile(INTERFACE_SCRIPT);
-
- // Get list of all files for search hierarch of CAVE_STATIC
- LocalizationFile[] derivParamFiles = pm.listFiles(
- pm.getLocalSearchHierarchy(LocalizationType.CAVE_STATIC),
- DerivedParameterGenerator.DERIV_PARAM_DIR, null, false, false);
- List functionDirs = new ArrayList(
- derivParamFiles.length);
- functionDirs.add(script.getParent());
-
- Arrays.sort(derivParamFiles);
-
- for (LocalizationFile file : derivParamFiles) {
- if (file.isDirectory()
- && DerivedParameterGenerator.FUNCTIONS
- .equals(LocalizationUtil.extractName(file.getName()))) {
- // If it is a derived parameters functions directory, add to search list
- functionDirs.add(file.getFile().getAbsolutePath());
- }
- }
-
- // Create path from function dir list
- String PATH = PyUtil.buildJepIncludePath(functionDirs
- .toArray(new String[functionDirs.size()]));
-
- List preEvals = new ArrayList(2);
- preEvals.add("import DerivParamImporter");
- StringBuilder cmd = new StringBuilder(200);
- cmd.append("sys.meta_path.append(DerivParamImporter.DerivParamImporter(");
- // Pass in directories to search based on function directories
- int size = functionDirs.size() - 1;
- for (int i = size; i > 0; --i) {
- if (i < size) {
- cmd.append(", ");
- }
- cmd.append("'").append(functionDirs.get(i)).append("'");
- }
- cmd.append("))");
- preEvals.add(cmd.toString());
-
- try {
- if (masterScript != null) {
- masterScript.dispose();
- }
- masterScript = new MasterDerivScript(PATH,
- MasterDerivScript.class.getClassLoader(), preEvals);
- } catch (JepException e) {
- statusHandler.handle(Priority.PROBLEM,
- "Failed to load derived parameters", e);
+ if (coordinator != null) {
+ coordinator.shutdown();
}
+ coordinator = PythonJobCoordinator
+ .newInstance(new MasterDerivScriptFactory());
}
/*
@@ -195,41 +135,27 @@ public class DerivParamPythonFunctionAdapter implements
* com.raytheon.uf.viz.derivparam.IDerivParamFunctionAdapter#executeFunction
* (java.lang.String, java.util.List)
*/
- @SuppressWarnings("unchecked")
@Override
- public void executeFunction(String name, List arguments) {
+ public List executeFunction(String name, List arguments)
+ throws ExecutionException {
try {
- results = (List) masterScript.executeFunction(name,
- arguments);
- } catch (JepException e) {
- statusHandler.handle(Priority.PROBLEM,
- "Error executing derived parameter request", e);
- results = null;
+ return coordinator.submitSyncJob(new MasterDerivScriptExecutor(
+ name, arguments));
+ } catch (InterruptedException e) {
+ throw new ExecutionException(e);
}
}
/*
* (non-Javadoc)
*
- * @see
- * com.raytheon.uf.viz.derivparam.IDerivParamFunctionAdapter#getRequestResults
- * ()
+ * @see com.raytheon.uf.viz.derivparam.IDerivParamFunctionAdapter#shutdown()
*/
@Override
- public List getRequestResults() {
- return results;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.raytheon.uf.viz.derivparam.IDerivParamFunctionAdapter#
- * getRequestIdentifierResults()
- */
- @Override
- public Object getRequestIdentifierResults() {
- // TODO: Not supported yet
- return null;
+ public void shutdown() {
+ if (coordinator != null) {
+ coordinator.shutdown();
+ }
}
}
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/MasterDerivScriptExecutor.java b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/MasterDerivScriptExecutor.java
new file mode 100644
index 0000000000..06e4b174d4
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/MasterDerivScriptExecutor.java
@@ -0,0 +1,65 @@
+/**
+ * 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.uf.viz.derivparam.python;
+
+import java.util.List;
+
+import jep.JepException;
+
+import com.raytheon.uf.common.datastorage.records.IDataRecord;
+import com.raytheon.uf.common.python.concurrent.IPythonExecutor;
+
+/**
+ * Executor for calling executeFunction on a MasterDerivScript
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 04, 2013 2041 bsteffen Initial creation
+ *
+ *
+ *
+ * @author bsteffen
+ * @version 1.0
+ */
+
+public class MasterDerivScriptExecutor implements
+ IPythonExecutor> {
+
+ private final String name;
+
+ private final List arguments;
+
+ public MasterDerivScriptExecutor(String name, List arguments) {
+ this.name = name;
+ this.arguments = arguments;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List execute(MasterDerivScript script)
+ throws JepException {
+ return (List) script.executeFunction(name, arguments);
+ }
+
+}
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/MasterDerivScriptFactory.java b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/MasterDerivScriptFactory.java
new file mode 100644
index 0000000000..e03fbcf7a9
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/MasterDerivScriptFactory.java
@@ -0,0 +1,120 @@
+/**
+ * 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.uf.viz.derivparam.python;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import jep.JepException;
+
+import com.raytheon.uf.common.localization.IPathManager;
+import com.raytheon.uf.common.localization.LocalizationContext.LocalizationType;
+import com.raytheon.uf.common.localization.LocalizationFile;
+import com.raytheon.uf.common.localization.LocalizationUtil;
+import com.raytheon.uf.common.localization.PathManagerFactory;
+import com.raytheon.uf.common.python.PyUtil;
+import com.raytheon.uf.common.python.concurrent.AbstractPythonScriptFactory;
+import com.raytheon.uf.viz.derivparam.library.DerivedParameterGenerator;
+
+/**
+ * Factory for creating and initializing MasterDerivScript.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 04, 2013 2041 bsteffen Initial creation
+ *
+ *
+ *
+ * @author bsteffen
+ * @version 1.0
+ */
+
+public class MasterDerivScriptFactory extends
+ AbstractPythonScriptFactory {
+
+ private static final int MAX_THREADS = 2;
+
+ public static final String NAME = "DerivedParameterPython";
+
+ private static final String INTERFACE_SCRIPT = DerivedParameterGenerator.DERIV_PARAM_DIR
+ + File.separator
+ + "python"
+ + File.separator
+ + "DerivParamImporter.py";
+
+ public MasterDerivScriptFactory() {
+ super(NAME, MAX_THREADS);
+ }
+
+ @Override
+ public MasterDerivScript createPythonScript() throws JepException {
+ IPathManager pm = PathManagerFactory.getPathManager();
+
+ File script = pm.getStaticFile(INTERFACE_SCRIPT);
+
+ // Get list of all files for search hierarch of CAVE_STATIC
+ LocalizationFile[] derivParamFiles = pm.listFiles(
+ pm.getLocalSearchHierarchy(LocalizationType.CAVE_STATIC),
+ DerivedParameterGenerator.DERIV_PARAM_DIR, null, false, false);
+ List functionDirs = new ArrayList(
+ derivParamFiles.length);
+ functionDirs.add(script.getParent());
+
+ Arrays.sort(derivParamFiles);
+
+ for (LocalizationFile file : derivParamFiles) {
+ if (file.isDirectory()
+ && DerivedParameterGenerator.FUNCTIONS
+ .equals(LocalizationUtil.extractName(file.getName()))) {
+ // If it is a derived parameters functions directory, add to
+ // search list
+ functionDirs.add(file.getFile().getAbsolutePath());
+ }
+ }
+
+ // Create path from function dir list
+ String PATH = PyUtil.buildJepIncludePath(functionDirs
+ .toArray(new String[functionDirs.size()]));
+
+ List preEvals = new ArrayList(2);
+ preEvals.add("import DerivParamImporter");
+ StringBuilder cmd = new StringBuilder(200);
+ cmd.append("sys.meta_path.append(DerivParamImporter.DerivParamImporter(");
+ // Pass in directories to search based on function directories
+ int size = functionDirs.size() - 1;
+ for (int i = size; i > 0; --i) {
+ if (i < size) {
+ cmd.append(", ");
+ }
+ cmd.append("'").append(functionDirs.get(i)).append("'");
+ }
+ cmd.append("))");
+ preEvals.add(cmd.toString());
+ return new MasterDerivScript(PATH,
+ MasterDerivScript.class.getClassLoader(), preEvals);
+ }
+
+}
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/AdiabeticTemperature.java b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/AdiabeticTemperature.java
new file mode 100644
index 0000000000..6b715a07d7
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/AdiabeticTemperature.java
@@ -0,0 +1,54 @@
+/**
+ * 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.uf.viz.derivparam.python.function;
+
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c0;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c1;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c2;
+import static java.lang.Math.exp;
+
+/**
+ * This routine calculates the equivalent tempurature of a temperature and
+ * pressure using the adiabatic definition, assuming saturation put a fudge
+ * factor into L/cp to get agreement of moist adiabats with a published
+ * thermodynamic diagram *
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 3, 2013 2043 bsteffen Ported from meteolib C
+ *
+ *
+ *
+ * @author bsteffen
+ * @version 1.0
+ */
+
+public class AdiabeticTemperature {
+
+ public static double adiabatic_te(double temp, double press) {
+ double e = exp(c0 - c1 * temp - c2 / temp);
+ e = 0.622 * e / (press - e);
+ return temp * exp(2740.0 * e / temp);
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/CalcTw.java b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/CalcTw.java
new file mode 100644
index 0000000000..8d308f51dc
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/CalcTw.java
@@ -0,0 +1,136 @@
+/**
+ * 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.uf.viz.derivparam.python.function;
+
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c0;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c1;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c2;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c_1;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c_2;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.f;
+import static java.lang.Math.abs;
+import static java.lang.Math.exp;
+import static java.lang.Math.log;
+import static java.lang.Math.max;
+import static java.lang.Math.min;
+import static java.lang.Math.sqrt;
+
+/**
+ * Routine to calculate wetbulb from temperature, and relative humidity.
+ *
+ *
+ * Inputs/Outputs:
+ *
+ * Variable Var Type I/O Description
+ * ---------- ---------- ----- -------------
+ * p RA I Pressure (mb)
+ * t RA I Temperature (K)
+ * rh RA I Relative humidity [range: 0. - 100.]
+ * tw RA O wet-bulb temp (K)
+ *
+ *
+ * User Notes:
+ *
+ * 1. No quality control is performed in this routine.
+ *
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 06, 2013 2043 bsteffen Ported from meteolib fortran
+ *
+ *
+ *
+ * @author bsteffen
+ * @version 1.0
+ */
+
+public class CalcTw {
+
+ public static double calctw(double p, double t, double rh) {
+ double rhqc = min(100.0, max(1.0, rh));
+ double b = c1 * t + c2 / t - log(rhqc / 100.0);
+ double td = (b - sqrt(b * b - c_1)) / c_2;
+ return mytw(t, td, p);
+ }
+
+ /*
+ * This function takes temperature in degrees K, dewpoint in degrees K and
+ * pressure in millibars and returns the isobaric wet-bulb temperature in
+ * degrees K using an iterative technique. For a given guess for the wet
+ * bulb temp, one tries to do an energy balance, matching cp*(T-Tw) to
+ * (esat(Tw)-esat(Td))*eps*L/p*.
+ */
+ public static double mytw(double k, double kd, double p) {
+ // Special cases of Td >= T or a ridiculously low T.
+ if (kd >= k) {
+ return (k + kd) / 2;
+ } else if (k < 100) {
+ return k;
+ }
+
+ // Special case of a ridiculously high saturation vapor pressure.
+ double ew = c0 - c1 * k - c2 / k;
+ if (ew > 10.0) {
+ return (k + kd) / 2;
+ }
+ ew = exp(ew);
+
+ // Kw is our current guess for wet-bulb, ed the vapor pressure
+ // corresponding to the depoint. Deal with case of a ridiculously small
+ // dewpoint vapor pressure.
+ double kdx = kd;
+ double ed = c0 - c1 * kdx - c2 / kdx;
+ while (ed < -50.0) {
+ kdx = kdx + 10;
+ ed = c0 - c1 * kdx - c2 / kdx;
+ }
+ ed = exp(ed);
+ double fp = p * f;
+ double s = (ew - ed) / (k - kdx);
+ double kw = (k * fp + kdx * s) / (fp + s);
+
+ // At each step of the iteration, esat(Tw)-esat(Td) is compared to
+ // (T-Tw)*p/(eps*L). When that difference is less than one part in
+ // 10000 of esat(Tw), or ten iterations have been done, the iteration
+ // stops.
+ // This is basically trying to find the value of Kw where de is 0. The
+ // value s is the derivative of de with respect to Kw, a fairly standard
+ // numerical technique for finding the zero value of a function.
+ for (int l = 1; l <= 10; l += 1) {
+ ew = c0 - c1 * kw - c2 / kw;
+ if (ew < -50.0 || ew > 10.0) {
+ break;
+ }
+ ew = exp(ew);
+ double de = fp * (k - kw) + ed - ew;
+ if (abs(de / ew) < 1e-5) {
+ continue;
+ }
+ s = ew * (c1 - c2 / (kw * kw)) - fp;
+ kw = kw - de / s;
+ }
+ return kw;
+
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/CapeFunc.java b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/CapeFunc.java
new file mode 100644
index 0000000000..6d15e7af4b
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/CapeFunc.java
@@ -0,0 +1,620 @@
+/**
+ * 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.uf.viz.derivparam.python.function;
+
+import static com.raytheon.uf.viz.derivparam.python.function.AdiabeticTemperature.adiabatic_te;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c0;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c1;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c2;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c_1;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c_2;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.kapa;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.kapa_1;
+import static com.raytheon.uf.viz.derivparam.python.function.TempOfTe.temp_of_te;
+import static java.lang.Math.exp;
+import static java.lang.Math.log;
+import static java.lang.Math.pow;
+import static java.lang.Math.sqrt;
+import jep.INumpyable;
+
+/**
+ * We input theta and specific humidity for initial parcel because these are
+ * things that can be arithemitically averaged for a mixed layer. If usetv=1,
+ * buoyancy is done with virtual temp, if usetv=0 with temp. If usetv=0, must
+ * supply temps in tve_dat.
+ *
+ * There are a few small changes from the original C version. First all math is
+ * done using doubles instead of floats since that is what the java.lang.Math
+ * library uses and it gets more accurate results. Second all uses of 1e37 have
+ * been replaces with Double.NaN to be more consistant with the rest of derived
+ * parameters. Finally the loops have been reordered so that each grid cell is
+ * iterated in the outermost loop which allows all intermediary calculations to
+ * be stored as doubles instead of float[nx*ny] which dramatically reduces the
+ * memory footprint.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 3, 2013 2043 bsteffen Ported from meteolib C
+ *
+ *
+ *
+ * @author bsteffen
+ * @version 1.0
+ */
+
+public class CapeFunc {
+
+ public static CapeCinPair capeFunc(float usetv, float[] p_dat,
+ float[] tve_dat, float[] p0, float[] th0, float[] sh0, int nx,
+ int ny, int nz) {
+ int n2 = nx * ny;
+
+ float[] cin = new float[n2];
+ float[] cap = new float[n2];
+
+ // Calculate the parcel equivalent temp, virtual temp, and press at LCL.
+ // Make working copy of sfc press, use as press below current 3d
+ // pressure.
+ for (int i = 0; i < n2; i += 1) {
+ double tec = 0;
+ double tvc = 0;
+ double pc = 0;
+ double pp0 = p0[i];
+ double pp1 = pp0;
+ if (Double.isNaN(pp0) || Double.isNaN(th0[i])
+ || Double.isNaN(sh0[i])
+ || sh0[i] < 0.0005) {
+ tec = tvc = pc = Double.NaN;
+ } else {
+ double t0 = th0[i] * pow(pp0 / 1000, kapa);
+ double b = c0 - log(pp0 / (622.0 / sh0[i] + 0.378));
+ double td = (b - sqrt(b * b - c_1)) / c_2;
+ double tdc = td - (t0 - td)
+ * (-0.37329638 + 41.178204 / t0 + 0.0015945203 * td);
+ pc = pp0 * pow(tdc / t0, kapa_1);
+ tec = adiabatic_te(tdc, pc);
+ tvc = td * (1 + usetv * 0.000608 * sh0[i]);
+ }
+
+ // Initialize md and pmd, which will be pressure of and max Te
+ // delta.
+ double md = 0;
+ double pmd = 0;
+
+ // Now calculate the virtual temperature of the parcel at the
+ // pressures in the input data. Then difference it from the
+ // environmental temp, which has been tweaked to not be cooler than
+ // dry adiabatic from the parcel start. Record the level of max
+ // parcel difference.
+ double[] tvp = new double[nz];
+
+ for (int k = 0; k < nz; k += 1) {
+ float pp = p_dat[k * n2 + i];
+ float tve = tve_dat[k * n2 + i];
+ if (Double.isNaN(pc) || Double.isNaN(pp) || Double.isNaN(tve)) {
+ tvp[k] = Double.NaN;
+ } else {
+ double t0 = tvc * pow(pp / pc, kapa);
+ if (pp > pc) {
+ tvp[k] = t0;
+ } else {
+ double td = tec * pow(pp / pc, kapa);
+ tvp[k] = td = temp_of_te(td, pp);
+ if (usetv > 0) {
+ tvp[k] *= pp
+ / (pp - exp(25.687958917 - c1 * td - c2
+ / td));
+ }
+ }
+ if (tve < t0) {
+ tvp[k] -= t0;
+ } else {
+ tvp[k] -= tve;
+ }
+ if (pp > pc || tvp[k] < md) {
+ continue;
+ }
+ md = tvp[k];
+ pmd = pp;
+ }
+ }
+
+ // This loop performs the actual cape and cin calculation. Here we
+ // will reuse storage for virt temp, equiv temp, and max delta for
+ // prev parcel temp, neg and pos. neg and pos are pending negative
+ // and positive contributions we have not yet added into the cape
+ // and cin yet.
+ double neg = 0;
+ double pos = 0;
+ cin[i] = cap[i] = Float.NaN;
+
+ double tvp1 = tvp[0];
+ pp1 = p_dat[0];
+ for (int k = 1; k < nz; k += 1) {
+ float pp = p_dat[k * n2 + i];
+ if (Double.isNaN(pp0)) {
+ continue;
+ } else if (Double.isNaN(pp1) || Double.isNaN(tvp1)) {
+ ;
+ } else if (pp >= pp1 || Double.isNaN(tvp[k])) {
+ continue;
+ } else if (pp >= pp0) {
+ ;
+ } else {
+ // Now we finally have the data we need for calculating
+ // the cape/cin contribution for this layer.
+ if (Double.isNaN(cap[i])) {
+ cap[i] = cin[i] = 0;
+ }
+ if (pmd == 0) {
+ continue; // No parcel delta>0, we're done.
+ }
+
+ // First deal with possibility of bottom lvl being below the
+ // initial parcel.
+ double dlnp;
+ double dn;
+ if (pp1 > pp0) {
+ dlnp = log(pp0 / pp);
+ dn = 0;
+ } else {
+ dlnp = log(pp1 / pp);
+ dn = dlnp * 287 * tvp1;
+ }
+
+ // Now deal with the fact that not allowing superadiabatic
+ // layers means no cape below condensation pressure.
+ double up;
+ if (pp1 >= pc) {
+ if (dn > 0) {
+ dn = 0;
+ }
+ if (tvp[k] <= 0) {
+ up = dlnp * 287 * tvp[k];
+ } else if (pp >= pc) {
+ up = 0;
+ } else {
+ up = log(pc / pp) * 287 * tvp[k];
+ }
+ } else {
+ up = dlnp * 287 * tvp[k];
+ }
+
+ // Deal with where the break point is.
+ double b = up * dn >= 0 ? 0.5 : up / (up - dn);
+ up *= b;
+ dn *= (1 - b);
+
+ // Now consider this layer's contribution, taking into
+ // account transitions between positive and negative
+ // acceleration.
+ if (up == 0 && dn == 0) {
+ ;
+ // Continuing deceleration.
+ } else if (up <= 0
+ && (dn < 0 || dn == 0 && (pp < pmd || pos == 0))) {
+ neg -= up + dn;
+
+ // Continuing upward acceleration.
+ } else if (up >= 0
+ && (dn > 0 || dn == 0 && (pp < pmd || neg == 0))) {
+ pos += up + dn;
+ if (pp > pmd && cap[i] + pos <= cin[i] + neg) {
+ ; // no net cape and below max delta
+ } else if (pp > pmd || cap[i] == 0) {
+ // below max delta or cape uninitialized
+ cap[i] += pos;
+ cin[i] += neg;
+ neg = pos = 0;
+ } else if (pos >= neg) {
+ // cape initialized and net positive contribution
+ cap[i] += (pos - neg);
+ neg = pos = 0;
+ }
+ } else if (up > 0 && dn <= 0) {
+ // Transition to upward acceleration.
+ neg += -dn;
+ if (pp1 <= pmd) {
+ // above max delta, only use net pos contribution
+ pos += up;
+ if (pos >= neg) {
+ cap[i] += (pos - neg);
+ neg = pos = 0;
+ }
+ } else if (pp <= pmd) {
+ // straddle max delta, force cape initialization
+ if (cap[i] == 0) {
+ cin[i] += neg;
+ cap[i] += pos;
+ } else if (neg > pos) {
+ cin[i] += neg - pos;
+ } else {
+ cap[i] += pos - neg;
+ }
+ cap[i] += up;
+ neg = pos = 0;
+ } else if (cap[i] + pos + up <= cin[i] + neg) {
+ // no net cape to this point
+ if (cap[i] + pos > 0) {
+ // reinitialize if there was cape before
+ cin[i] -= cap[i] + pos;
+ pos = cap[i] = 0;
+ }
+ cin[i] += neg;
+ pos += up;
+ neg = 0;
+ } else if (cap[i] == 0) { // initialize cape
+ cap[i] += pos + up;
+ cin[i] += neg;
+ neg = pos = 0;
+ } else { // what remains, only use net pos contribution
+ pos += up;
+ if (pos >= neg) {
+ cap[i] += (pos - neg);
+ neg = pos = 0;
+ }
+ }
+ } else {
+ // Transition to decceleration.
+ pos += dn;
+ if (pp1 <= pmd) {
+ // above max delta, only use net pos contribution
+ if (pos >= neg) {
+ cap[i] += (pos - neg);
+ neg = pos = 0;
+ }
+ neg += -up;
+ } else if (cap[i] + pos <= cin[i] + neg - up) {
+ // no net cape to this point
+ if (cap[i] > 0) {
+ // reinitialize if there was cape before
+ cin[i] -= cap[i] + pos;
+ pos = cap[i] = 0;
+ }
+ cin[i] += neg - up;
+ pos = neg = 0;
+ } else if (cap[i] == 0) { // initialize cape
+ cap[i] += pos;
+ cin[i] += neg - up;
+ neg = pos = 0;
+ } else { // what remains, only use net pos contribution
+ if (pos >= neg) {
+ cap[i] += (pos - neg);
+ neg = pos = 0;
+ }
+ neg += -up;
+ }
+ }
+ }
+ // Make current layer top next layer bottom.
+ tvp1 = tvp[k];
+ pp1 = pp;
+ }
+ }
+ return new CapeCinPair(ny, nx, cap, cin);
+ }
+
+ // In this version we stop the computation at some arbitrary upper level,
+ // ptop.
+ public static CapeCinPair capeFuncTop(float usetv, float[] p_dat,
+ float[] tve_dat, float[] p0, float[] th0, float[] sh0,
+ float[] ptop, int nx, int ny, int nz) {
+ int n2 = nx * ny;
+
+ float[] cin = new float[n2];
+ float[] cap = new float[n2];
+
+ // Calculate the parcel equivalent temp, virtual temp, and press at LCL.
+ // Make working copy of sfc press, use as press below current 3d
+ // pressure.
+ for (int i = 0; i < n2; i += 1) {
+ double tec = 0;
+ double tvc = 0;
+ double pc = 0;
+ double pp0 = p0[i];
+ double pp1 = pp0;
+ double pfin = ptop[i];
+ if (Double.isNaN(pp0) || Double.isNaN(th0[i])
+ || Double.isNaN(sh0[i]) || sh0[i] < 0.0005
+ || pp0 < pfin) {
+ tec = tvc = pc = Double.NaN;
+ } else {
+ double t0 = th0[i] * pow(pp0 / 1000, kapa);
+ double b = c0 - log(pp0 / (622.0 / sh0[i] + 0.378));
+ double td = (b - sqrt(b * b - c_1)) / c_2;
+ double tdc = td - (t0 - td)
+ * (-0.37329638 + 41.178204 / t0 + 0.0015945203 * td);
+ pc = pp0 * pow(tdc / t0, kapa_1);
+ tec = adiabatic_te(tdc, pc);
+ tvc = td * (1 + usetv * 0.000608 * sh0[i]);
+ }
+
+ // Initialize md and pmd, which will be pressure of and max Te
+ // delta.
+ double md = 0;
+ double pmd = 0;
+
+ // Now calculate the virtual temperature of the parcel at the
+ // pressures in the input data. Then difference it from the
+ // environmental temp, which has been tweaked to not be cooler than
+ // dry adiabatic from the parcel start. Record the level of max
+ // parcel difference.
+ double[] tvp = new double[nz];
+
+ for (int k = 0; k < nz; k += 1) {
+ float pp = p_dat[k * n2 + i];
+ float tve = tve_dat[k * n2 + i];
+ if (Double.isNaN(pc) || Double.isNaN(pp) || Double.isNaN(tve)
+ || pp1 <= pfin) {
+ tvp[k] = Double.NaN;
+ } else {
+ pp1 = pp;
+ double t0 = tvc * pow(pp / pc, kapa);
+ if (pp > pc) {
+ tvp[k] = t0;
+ } else {
+ double td = tec * pow(pp / pc, kapa);
+ tvp[k] = td = temp_of_te(td, pp);
+ if (usetv > 0) {
+ tvp[k] *= pp
+ / (pp - exp(25.687958917 - c1 * td - c2
+ / td));
+ }
+ }
+ if (tve < t0) {
+ tvp[k] -= t0;
+ } else {
+ tvp[k] -= tve;
+ }
+ if (pp > pc || pp < pfin || tvp[k] < md) {
+ continue;
+ }
+ md = tvp[k];
+ pmd = pp;
+ }
+ }
+
+ // This loop performs the actual cape and cin calculation. Here we
+ // will reuse storage for virt temp, equiv temp, and max delta for
+ // prev parcel temp, neg and pos. neg and pos are pending negative
+ // and positive contributions we have not yet added into the cape
+ // and cin yet.
+ double neg = 0;
+ double pos = 0;
+ cin[i] = cap[i] = Float.NaN;
+
+ double tvp1 = tvp[0];
+ pp1 = p_dat[i];
+ for (int k = 1; k < nz; k += 1) {
+ float pp = p_dat[k * n2 + i];
+ if (Double.isNaN(pp0)) {
+ continue;
+ } else if (Double.isNaN(pp1) || Double.isNaN(tvp1)) {
+ ;
+ } else if (pp >= pp1 || Double.isNaN(tvp[k])) {
+ continue;
+ } else if (pp >= pp0) {
+ ;
+ } else {
+ // Now we finally have the data we need for calculating
+ // the cape/cin contribution for this layer.
+ if (Double.isNaN(cap[i])) {
+ cap[i] = cin[i] = 0;
+ }
+ if (pmd == 0) {
+ continue; // No parcel delta>0, we're done.
+ }
+
+ // First deal with possibility of bottom lvl being below the
+ // initial parcel and/or hitting the top of the computation.
+ double dlnp = 0;
+ double dn;
+ if (pp < pfin) {
+ double b = log(pp1 / pp);
+ dlnp = log(pp1 / pfin);
+ tvp[k] = tvp1 + (dlnp / b) * (tvp[k] - tvp1);
+ }
+ if (pp1 > pp0) {
+ if (pp < pfin) {
+ dlnp = log(pp0 / pfin);
+ } else {
+ dlnp = log(pp0 / pp);
+ }
+ dn = 0;
+ } else {
+ if (pp >= pfin) {
+ dlnp = log(pp1 / pp);
+ }
+ dn = dlnp * 287 * tvp1;
+ }
+
+ // Now deal with the fact that not allowing superadiabatic
+ // layers means no cape below condensation pressure.
+ double up;
+ if (pp1 >= pc) {
+ if (dn > 0) {
+ dn = 0;
+ }
+ if (tvp[k] <= 0) {
+ up = dlnp * 287 * tvp[k];
+ } else if (pp >= pc) {
+ up = 0;
+ } else if (pp < pfin) {
+ up = log(pc / pfin) * 287 * tvp[k];
+ } else {
+ up = log(pc / pp) * 287 * tvp[k];
+ }
+ } else {
+ up = dlnp * 287 * tvp[k];
+ }
+
+ // Deal with where the break point is.
+ double b = up * dn >= 0 ? 0.5 : up / (up - dn);
+ up *= b;
+ dn *= (1 - b);
+
+ // Now consider this layer's contribution, taking into
+ // account transitions between positive and negative
+ // acceleration.
+ if (up == 0 && dn == 0) {
+ ;
+ // Continuing deceleration.
+ } else if (up <= 0
+ && (dn < 0 || dn == 0 && (pp < pmd || pos == 0))) {
+ neg -= up + dn;
+
+ // Continuing upward acceleration.
+ } else if (up >= 0
+ && (dn > 0 || dn == 0 && (pp < pmd || neg == 0))) {
+ pos += up + dn;
+ if (pp > pmd && cap[i] + pos <= cin[i] + neg) {
+ ; // no net cape and below max delta
+ } else if (pp > pmd || cap[i] == 0) {
+ // below max delta or cape uninitialized
+ cap[i] += pos;
+ cin[i] += neg;
+ neg = pos = 0;
+ } else if (pos >= neg) {
+ // cape initialized and net positive contribution
+ cap[i] += (pos - neg);
+ neg = pos = 0;
+ }
+ } else if (up > 0 && dn <= 0) {
+ // Transition to upward acceleration.
+ neg += -dn;
+ if (pp1 <= pmd) {
+ // above max delta, only use net pos contribution
+ pos += up;
+ if (pos >= neg) {
+ cap[i] += (pos - neg);
+ neg = pos = 0;
+ }
+ } else if (pp <= pmd) {
+ // straddle max delta, force cape initialization
+ if (cap[i] == 0) {
+ cin[i] += neg;
+ cap[i] += pos;
+ } else if (neg > pos) {
+ cin[i] += neg - pos;
+ } else {
+ cap[i] += pos - neg;
+ }
+ cap[i] += up;
+ neg = pos = 0;
+ } else if (cap[i] + pos + up <= cin[i] + neg) {
+ // no net cape to this point
+ if (cap[i] + pos > 0) {
+ // reinitialize if there was cape before
+ cin[i] -= cap[i] + pos;
+ pos = cap[i] = 0;
+ }
+ cin[i] += neg;
+ pos += up;
+ neg = 0;
+ } else if (cap[i] == 0) { // initialize cape
+ cap[i] += pos + up;
+ cin[i] += neg;
+ neg = pos = 0;
+ } else { // what remains, only use net pos contribution
+ pos += up;
+ if (pos >= neg) {
+ cap[i] += (pos - neg);
+ neg = pos = 0;
+ }
+ }
+ } else {
+ // Transition to decceleration.
+ pos += dn;
+ if (pp1 <= pmd) {
+ // above max delta, only use net pos contribution
+ if (pos >= neg) {
+ cap[i] += (pos - neg);
+ neg = pos = 0;
+ }
+ neg += -up;
+ } else if (cap[i] + pos <= cin[i] + neg - up) {
+ // no net cape to this point
+ if (cap[i] > 0) {
+ // reinitialize if there was cape before
+ cin[i] -= cap[i] + pos;
+ pos = cap[i] = 0;
+ }
+ cin[i] += neg - up;
+ pos = neg = 0;
+ } else if (cap[i] == 0) { // initialize cape
+ cap[i] += pos;
+ cin[i] += neg - up;
+ neg = pos = 0;
+ } else { // what remains, only use net pos contribution
+ if (pos >= neg) {
+ cap[i] += (pos - neg);
+ neg = pos = 0;
+ }
+ neg += -up;
+ }
+ }
+ }
+ // Make current layer top next layer bottom.
+ tvp1 = tvp[k];
+ pp1 = pp;
+ }
+ }
+ return new CapeCinPair(ny, nx, cap, cin);
+ }
+
+ public static class CapeCinPair implements INumpyable {
+
+ private final int nx;
+
+ private final int ny;
+
+ private final float[] cape;
+
+ private final float[] cin;
+
+ public CapeCinPair(int nx, int ny, float[] cape, float[] cin) {
+ this.nx = nx;
+ this.ny = ny;
+ this.cape = cape;
+ this.cin = cin;
+ }
+
+ @Override
+ public Object[] getNumPy() {
+ return new Object[] { cape, cin };
+ }
+
+ @Override
+ public int getNumpyX() {
+ return nx;
+ }
+
+ @Override
+ public int getNumpyY() {
+ return ny;
+ }
+
+ }
+
+}
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/Constants.java b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/Constants.java
new file mode 100644
index 0000000000..3dbe94953d
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/Constants.java
@@ -0,0 +1,64 @@
+/**
+ * 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.uf.viz.derivparam.python.function;
+
+/**
+ * Consolidated constants from various meteolib functions.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 06, 2013 2043 bsteffen Ported from meteolib C
+ *
+ *
+ *
+ * @author bsteffen
+ * @version 1.0
+ */
+
+public class Constants {
+
+ // from meteoLib capeFunc.c
+ public static final double c0 = 26.66082;
+
+ // from meteoLib capeFunc.c
+ public static final double c1 = 0.0091379024;
+
+ // from meteoLib capeFunc.c
+ public static final double c2 = 6106.396;
+
+ // from meteoLib capeFunc.c
+ public static final double c_1 = 223.1986;
+
+ // from meteoLib capeFunc.c
+ public static final double c_2 = 0.0182758048;
+
+ // from meteoLib capeFunc.c
+ public static final double kapa = 0.286;
+
+ // from meteoLib capeFunc.c
+ public static final double kapa_1 = 3.498257;
+
+ // from meteoLib calctw.f
+ public static final double f = 0.0006355;
+}
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/DCapeFunc.java b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/DCapeFunc.java
new file mode 100644
index 0000000000..e562efbe2d
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/DCapeFunc.java
@@ -0,0 +1,334 @@
+/**
+ * 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.uf.viz.derivparam.python.function;
+
+import static com.raytheon.uf.viz.derivparam.python.function.AdiabeticTemperature.adiabatic_te;
+import static com.raytheon.uf.viz.derivparam.python.function.CalcTw.mytw;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c0;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c1;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c2;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c_1;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.c_2;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.kapa;
+import static com.raytheon.uf.viz.derivparam.python.function.Constants.kapa_1;
+import static com.raytheon.uf.viz.derivparam.python.function.TempOfTe.temp_of_te;
+import static java.lang.Math.exp;
+import static java.lang.Math.log;
+import static java.lang.Math.pow;
+import static java.lang.Math.sqrt;
+
+import com.raytheon.uf.common.python.PythonNumpyFloatArray;
+
+/**
+ * We input theta and specific humidity for surface conditions because these are
+ * things that can be arithemitically averaged for a mixed layer. In order for a
+ * dcape to be calculated, there must be positive bouyancy somewhere in the
+ * column based on the input surface conditions, neglecting any cap. Sinking
+ * parcel starts from the minimum thetaE level that is above the condensation
+ * pressure and below 400mb and the highest positive rising parcel bouyancy.
+ * max_evap is the limit to how much water can be evaporated into the parcel as
+ * it decends, in Kg/Kg. max_rh is the desired RH (%) as the parcel reaches the
+ * surface. Will initially evaporate up to one-third of max_evap into the
+ * sinking parcel at the start, afterward attempting to trend the RH toward
+ * max_rh at the ground. If usetv=1, buoyancy is done with virtual temp, if
+ * usetv=0 with temp.
+ *
+ * There are a few small changes from the original C version. First all math is
+ * done using doubles instead of floats since that is what the java.lang.Math
+ * library uses and it gets more accurate results. Second all uses of 1e37 have
+ * been replaces with Double.NaN to be more consistant with the rest of derived
+ * parameters. Finally the loops have been reordered so that each grid cell is
+ * iterated in the outermost loop which allows all intermediary calculations to
+ * be stored as doubles instead of float[nx*ny] which dramatically reduces the
+ * memory footprint.
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 05, 2013 2043 bsteffen Ported from meteolib C
+ *
+ *
+ *
+ * @author bsteffen
+ * @version 1.0
+ */
+
+public class DCapeFunc {
+
+ public static PythonNumpyFloatArray dcapeFunc(float usetv, float[] p_dat,
+ float[] t_dat, float[] td_dat, float[] p0, float[] th0,
+ float[] sh0, int nx, int ny, int nz, float max_evap, float max_rh) {
+ int n2 = nx * ny;
+ int nzm = nz - 1;
+
+ float[] dcape = new float[n2];
+
+ for (int i = 0; i < n2; i += 1) {
+
+ // Calculate the ascending parcel start equivalent temp, virtual
+ // temp, and press at LCL, and the initial virtual temperature.
+ // Initialize pm and wm, which now will be pressure at and min
+ // environmetal virtual theta E.
+ double tec = 0;
+ double tvc = 0;
+ double pc = 0;
+ double tv = 0;
+ double pp0 = p0[i];
+ if (Double.isNaN(pp0) || Double.isNaN(th0[i])
+ || Double.isNaN(sh0[i])) {
+ tec = tvc = pc = Double.NaN;
+ } else {
+ double t0 = th0[i] * pow(pp0 / 1000, kapa);
+ tv = t0 * (1 + usetv * 0.000608 * sh0[i]);
+ double b = c0 - log(pp0 / (622.0 / sh0[i] + 0.378));
+ double td = (b - sqrt(b * b - c_1)) / c_2;
+ td -= (t0 - td)
+ * (-0.37329638 + 41.178204 / t0 + 0.0015945203 * td);
+ pc = pp0 * pow(td / t0, kapa_1);
+ tec = adiabatic_te(td, pc);
+ tvc = td * (1 + usetv * 0.000608 * sh0[i]);
+ }
+
+ // Now calculate the virtual temperature of the accending parcel at
+ // the pressures in the input data.
+ double[] tvp = new double[nz];
+
+ for (int k = 0; k < nz; k++) {
+ float pp = p_dat[k * n2 + i];
+ if (Double.isNaN(pc) || Double.isNaN(tec) || Double.isNaN(tvc)
+ || Double.isNaN(pp)) {
+ tvp[k] = Double.NaN;
+ } else if (pp > pc) {
+ tvp[k] = tvc * pow(pp / pc, kapa);
+ } else {
+ double t0 = tec * pow(pp / pc, kapa);
+ t0 = temp_of_te(t0, pp);
+ tvp[k] = t0
+ * pp
+ / (pp - usetv
+ * exp(25.687958917 - c1 * t0 - c2 / t0));
+ }
+ }
+
+ // Calculate environment virtual temp, where we force the
+ // environment to be no cooler than dry adiabatic from the ascending
+ // parcel start. Find pressure of min environmetal virtual theta E
+ // above condensation pressure...record temperature and dewpoint
+ // there. Since we do not need the accending parcel temps to
+ // complete the dcape calc, we will put the environmental virtual
+ // temp into the that storage.
+ double wm = Double.NaN;
+ double pm = Double.NaN;
+ double tm = 0;
+ double tdm = 0;
+ for (int k = nzm; k >= 0; k -= 1) {
+ float pp = p_dat[k * n2 + i];
+ float tt = t_dat[k * n2 + i];
+ float td3 = td_dat[k * n2 + i];
+
+ if (Double.isNaN(tvc) || Double.isNaN(pc) || Double.isNaN(pp)
+ || Double.isNaN(tvp[k]) || Double.isNaN(tt)
+ || Double.isNaN(td3)) {
+ tvp[k] = Double.NaN;
+ continue;
+ }
+ double t0 = tt;
+ double eee = exp(26.186004814 - c1 * td3 - c2 / td3);
+ double qd = eee / (pp - 0.60771703 * eee);
+ eee = (1 + usetv * 0.608 * qd);
+ double thve = t0 * eee;
+ double pr = pow(pp / pc, kapa);
+ if (thve < tvc * pr) {
+ thve = tvc * pr;
+ t0 = thve / eee;
+ }
+ if (tvp[k] <= thve && Double.isNaN(wm) || pp > pc
+ && (pm >= 400 || Double.isNaN(pm))) {
+ if (Double.isNaN(pm) && pp < pc) {
+ pm = pc;
+ }
+ tvp[k] = thve;
+ continue;
+ }
+ tvp[k] = thve;
+ thve = (thve + 2529 * qd) * pow(1000 / (pp), kapa);
+ if (thve > wm && pm >= 400) {
+ continue;
+ }
+ wm = thve;
+ pm = pp;
+ tm = t0;
+ tdm = td3;
+ }
+
+ // Here we will reuse our condensation level storage for
+ // the level above current. This loop performs the actual dcape
+ // calculation.
+ double rhm = 0;
+ double qq = 0;
+ double tve1 = tvc;
+ double pp1 = pc;
+ double tvp1 = tec;
+ for (int k = nzm; k >= 0; k -= 1) {
+ double tve = tvp[k];
+ float pp = p_dat[k * n2 + i];
+
+ if (k == nzm) {
+ dcape[i] = Float.NaN;
+ pp1 = tvp1 = tve1 = Double.NaN;
+ }
+ if (k == nzm) {
+ dcape[i] = Float.NaN;
+ pp1 = tvp1 = tve1 = Double.NaN;
+ }
+ if (Double.isNaN(pm) || Double.isNaN(pp0) || Double.isNaN(tv)) {
+ continue;
+ } else if (Double.isNaN(pp0)) {
+ ;
+ } else if (pp1 >= pp0) {
+ continue;
+ } else if (Double.isNaN(tve1)) {
+ ;
+ } else if (Double.isNaN(pp) || Double.isNaN(tve)) {
+ continue;
+ } else if (pp <= pm) {
+ ;
+ } else if (Double.isNaN(wm)) {
+ dcape[i] = 0;
+ } else {
+
+ // Now we finally have the data we need for calculating
+ // the dcape contribution for this layer. If we have not
+ // made any dcape calculations to this point, initialize
+ // the decent parcel.
+ if (Double.isNaN(dcape[i])) {
+ dcape[i] = 0;
+ double eee = exp(26.186004814 - c1 * tdm - c2 / tdm);
+ double qd = eee / (pm - 0.60771703 * eee);
+ double qw = qd + max_evap / 3;
+ double t0 = tm - 2529 * max_evap / 3;
+ eee = exp(26.186004814 - c1 * t0 - c2 / t0);
+ double qs = eee / (pm - 0.60771703 * eee);
+ if (qs >= qw) {
+ wm = max_evap - max_evap / 3;
+ tm = t0;
+ rhm = qw / qs;
+ double b = c0 - log(qw * pm / (0.622 - 0.378 * qw));
+ tdm = (b - sqrt(b * b - c_1)) / c_2;
+ } else {
+ tm = tdm = mytw(tm, tdm, pm);
+ rhm = 1.0;
+ eee = exp(26.186004814 - c1 * tm - c2 / tm);
+ qw = eee / (pm - 0.60771703 * eee);
+ wm = max_evap - (qw - qd);
+ }
+ qq = qw;
+ tvp1 = tm * (1 + usetv * 0.608 * qw);
+ pp1 = pm;
+ }
+
+ // Deal with reaching the surface, add in top of layer part.
+ double pb, dlnp, thve;
+ if (pp > pp0) {
+ pb = pp0;
+ dlnp = log(pb / pp1);
+ thve = tv;
+ } else {
+ pb = pp;
+ dlnp = log(pb / pp1);
+ thve = tve;
+ }
+ double up = -dlnp * 287 * 0.5 * (tvp1 - tve1);
+ if (up < -dcape[i]) {
+ dcape[i] = 0;
+ } else {
+ dcape[i] += up;
+ }
+
+ // Deal with letting parcel fall to pb
+ double pr = pow(pb / pp1, kapa);
+ if (wm <= 0)
+ tvp1 *= pr;
+ else {
+ double rhmx = rhm + (pb - pp1) * (max_rh - rhm)
+ / (pp0 - pp1);
+ double t0 = tm * pr;
+ double eee = exp(26.186004814 - c1 * t0 - c2 / t0);
+ double qs = eee / (pb - 0.60771703 * eee);
+ if (qq / qs > rhmx) {
+ tm = t0;
+ double b = c0 - log(qq * pb / (0.622 - 0.378 * qq));
+ tdm = (b - sqrt(b * b - c_1)) / c_2;
+ tvp1 *= pr;
+ rhm = qq / qs;
+ } else {
+ double qd = (rhmx * qs - qq)
+ / sqrt(1000 * (rhmx * qs + qq));
+ if (qd > wm) {
+ qd = wm;
+ }
+ double qw = qq + qd;
+ double td = t0 - 2529 * wm;
+ eee = exp(26.186004814 - c1 * td - c2 / td);
+ qs = eee / (pb - 0.60771703 * eee);
+ if (qs >= qw) {
+ tm = td;
+ rhm = qw / qs;
+ double b = c0
+ - log(qw * pb / (0.622 - 0.378 * qw));
+ tdm = (b - sqrt(b * b - c_1)) / c_2;
+ } else {
+ double b = c0
+ - log(qq * pb / (0.622 - 0.378 * qq));
+ tdm = (b - sqrt(b * b - c_1)) / c_2;
+ tm = tdm = mytw(t0, tdm, pb);
+ rhm = 1.0;
+ eee = exp(26.186004814 - c1 * tm - c2 / tm);
+ qw = eee / (pb - 0.60771703 * eee);
+ qd = qw - qq;
+ }
+ wm -= qd;
+ qq = qw;
+ tvp1 = tm * (1 + usetv * 0.608 * qw);
+ }
+ }
+
+ // Add contribution of bottom of layer.
+ double dn = -dlnp * 287 * 0.5 * (tvp1 - thve);
+ if (dn < -dcape[i])
+ dcape[i] = 0;
+ else
+ dcape[i] += dn;
+
+ }
+
+ // Make current layer top next layer bottom.
+ tve1 = tve;
+ pp1 = pp;
+ }
+ }
+ return new PythonNumpyFloatArray(dcape, ny, nx);
+ }
+
+
+}
diff --git a/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/TempOfTe.java b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/TempOfTe.java
new file mode 100644
index 0000000000..1b59a72929
--- /dev/null
+++ b/cave/com.raytheon.uf.viz.derivparam.python/src/com/raytheon/uf/viz/derivparam/python/function/TempOfTe.java
@@ -0,0 +1,161 @@
+/**
+ * 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.uf.viz.derivparam.python.function;
+
+import static com.raytheon.uf.viz.derivparam.python.function.AdiabeticTemperature.adiabatic_te;
+import static java.lang.Math.sqrt;
+
+/**
+ * This routine calculates the saturation tempurature of an equivalent
+ * temperature at given pressure using the adiabatic definition
+ *
+ *
+ *
+ * SOFTWARE HISTORY
+ *
+ * Date Ticket# Engineer Description
+ * ------------ ---------- ----------- --------------------------
+ * Jun 3, 2013 2043 bsteffen Ported from meteolib C
+ *
+ *
+ *
+ * @author bsteffen
+ * @version 1.0
+ */
+
+public class TempOfTe {
+
+ private static final int tmin = 193;
+
+ private static final int tmax = 333;
+
+ private static final int nval = 1 + tmax - tmin;
+
+ private static final double[] Te1000 = new double[nval];
+
+ private static final double[] Te850 = new double[nval];
+
+ private static final double[] Te700 = new double[nval];
+
+ private static final double[] Te600 = new double[nval];
+
+ private static final double[] Te500 = new double[nval];
+
+ private static final double[] Te350 = new double[nval];
+
+ private static final double[] Te200 = new double[nval];
+ static {
+ int i = 0;
+ for (int t = tmin; t <= tmax; t += 1) {
+ Te1000[i] = adiabatic_te(t, 1000);
+ Te850[i] = adiabatic_te(t, 850);
+ Te700[i] = adiabatic_te(t, 700);
+ Te600[i] = adiabatic_te(t, 600);
+ Te500[i] = adiabatic_te(t, 500);
+ Te350[i] = adiabatic_te(t, 350);
+ Te200[i] = adiabatic_te(t, 200);
+ i += 1;
+ }
+ }
+
+ public static double temp_of_te(double te, double press) {
+ double[] TeLookup = null;
+ double base;
+ /* find correct table, check for beyond bounds of table */
+ if (press <= 250) {
+ TeLookup = Te200;
+ base = 200;
+ } else if (press <= 400) {
+ TeLookup = Te350;
+ base = 350;
+ } else if (press <= 550) {
+ TeLookup = Te500;
+ base = 500;
+ } else if (press <= 650) {
+ TeLookup = Te600;
+ base = 600;
+ } else if (press <= 750) {
+ TeLookup = Te700;
+ base = 700;
+ } else if (press <= 900) {
+ TeLookup = Te850;
+ base = 850;
+ } else {
+ TeLookup = Te1000;
+ base = 1000;
+ }
+ if (te < TeLookup[1]) {
+ return te;
+ }
+ if (te >= TeLookup[nval - 1]) {
+ return Double.NaN;
+ }
+ /* use table to get first guesses for value of temp */
+ double t1 = tmin;
+ double t2 = (int) te;
+ if (t2 > tmax) {
+ t2 = tmax;
+ }
+ double t;
+ while (t2 - t1 >= 3) {
+ t = (int) ((t1 + t2) / 2);
+ if (TeLookup[(int) t - tmin] > te) {
+ t2 = t;
+ } else if (TeLookup[(int) t - tmin] < te) {
+ t1 = t;
+ } else {
+ if (t1 < t - 1) {
+ t1 = t - 1;
+ }
+ if (t2 > t + 1) {
+ t2 = t + 1;
+ }
+ break;
+ }
+ }
+
+ double w = sqrt(base / press);
+ t1 = (1 - w) * TeLookup[(int) t1 - tmin] + w * t1;
+ t2 = (1 - w) * TeLookup[(int) t2 - tmin] + w * t2;
+
+ /* Iterate to find the exact solution */
+ double d1 = te - adiabatic_te(t1, press);
+ double d2 = adiabatic_te(t2, press) - te;
+ w = d2 / (d1 + d2);
+ t = w * t1 + (1 - w) * t2;
+ double d = adiabatic_te(t, press) - te;
+ int i = 0;
+ while (i++ < 10) {
+ if (d > 0.01) {
+ d2 = d;
+ t2 = t;
+ } else if (d < -0.01) {
+ d1 = -d;
+ t1 = t;
+ } else {
+ break;
+ }
+ w = d2 / (d1 + d2);
+ t = w * t1 + (1 - w) * t2;
+ d = adiabatic_te(t, press) - te;
+ }
+ return t;
+ }
+}
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/IDerivParamFunctionAdapter.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/IDerivParamFunctionAdapter.java
index 5eec10a448..6c835bd384 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/IDerivParamFunctionAdapter.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/IDerivParamFunctionAdapter.java
@@ -20,6 +20,7 @@
package com.raytheon.uf.viz.derivparam;
import java.util.List;
+import java.util.concurrent.ExecutionException;
import com.raytheon.uf.common.datastorage.records.IDataRecord;
import com.raytheon.uf.viz.derivparam.DerivParamFunctionType.FunctionArgument;
@@ -33,7 +34,9 @@ import com.raytheon.uf.viz.derivparam.DerivParamFunctionType.FunctionArgument;
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Dec 16, 2010 mschenke Initial creation
+ * Dec 16, 2010 mschenke Initial creation
+ * Jun 04, 2013 2041 bsteffen Switch derived parameters to use
+ * concurrent python for threading.
*
*
*
@@ -76,24 +79,11 @@ public interface IDerivParamFunctionAdapter {
* @param arguments
* arguments to pass into function
*/
- public void executeFunction(String name, List arguments);
+ public List executeFunction(String name, List arguments)
+ throws ExecutionException;
/**
- * Implementing Adapters need to be able to return the last executed
- * function as data records copied into java from whatever mechanism was
- * used to execute the function
- *
- * @return The last executed function results as data records
+ * Stop the adapter and any child threads.
*/
- public List getRequestResults();
-
- /**
- * Implementing Adapters need to be able to return the last executed
- * function as an object that the adapter can reuse in another function
- * execution. This is to avoid copying data in and out of java constantly
- *
- * @return The last executed function results as an object the adapter can
- * reuse
- */
- public Object getRequestIdentifierResults();
+ public void shutdown();
}
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/DerivedRequestableData.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/DerivedRequestableData.java
index 2c7dfeb806..c51b058f9c 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/DerivedRequestableData.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/data/DerivedRequestableData.java
@@ -25,6 +25,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ExecutionException;
import com.raytheon.uf.common.dataplugin.level.Level;
import com.raytheon.uf.common.datastorage.records.FloatDataRecord;
@@ -42,7 +43,9 @@ import com.raytheon.uf.viz.derivparam.tree.CubeLevel;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Mar 17, 2010 bsteffen Initial creation
+ * Mar 17, 2010 bsteffen Initial creation
+ * Jun 04, 2013 2041 bsteffen Switch derived parameters to use
+ * concurrent python for threading.
*
*
*
@@ -73,21 +76,22 @@ public class DerivedRequestableData extends AbstractRequestableData {
@Override
public Object getDataValue(Object arg) throws VizException {
DerivedParameterRequest request = createDerparRequest(arg);
- DerivedParameterGenerator.addTask(request);
- List> finalResult = request.getQueue();
- if (finalResult != null && finalResult.size() > 0) {
- if (finalResult.size() == 1) {
- return new IDataRecord[] { ((IDataRecord) finalResult.get(0)) };
- } else if (finalResult.size() == 4) {
- return new IDataRecord[] {
- ((FloatDataRecord) finalResult.get(0)),
- ((FloatDataRecord) finalResult.get(1)),
- ((FloatDataRecord) finalResult.get(2)),
- ((FloatDataRecord) finalResult.get(3)) };
- } else {
- throw new VizException(
- "Error processing derived parameter, expecting scalar or vector data. Vector data must return speed, dir, u, and v components.");
+ try {
+ List finalResult = DerivedParameterGenerator
+ .calculate(request);
+ if (finalResult != null && !finalResult.isEmpty()) {
+ if (finalResult.size() == 4 || finalResult.size() == 1) {
+ for (IDataRecord rec : finalResult) {
+ rec.setName(request.getParameterAbbreviation());
+ }
+ return finalResult.toArray(new IDataRecord[0]);
+ } else {
+ throw new VizException(
+ "Error processing derived parameter, expecting scalar or vector data. Vector data must return speed, dir, u, and v components.");
+ }
}
+ } catch (ExecutionException e) {
+ throw new VizException("Error executing Derived Parameter.", e);
}
return null;
}
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivedParameterGenerator.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivedParameterGenerator.java
index 0695094eca..166520afe3 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivedParameterGenerator.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivedParameterGenerator.java
@@ -20,14 +20,15 @@
package com.raytheon.uf.viz.derivparam.library;
import java.io.File;
+import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ExecutionException;
import javax.measure.unit.Unit;
import javax.xml.bind.JAXBException;
@@ -77,10 +78,13 @@ import com.raytheon.uf.viz.derivparam.library.DerivParamMethod.MethodType;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * Jul 3, 2008 brockwoo Initial creation
- * Nov 16, 2009 #3120 rjpeter Removed use of LevelNameMappingFile.
- * Nov 20, 2009 #3387 jelkins Use derived script's variableId instead of filename
- * Nov 21, 2009 #3576 rjpeter Refactored DerivParamDesc.
+ * Jul 03, 2008 brockwoo Initial creation
+ * Nov 16, 2009 3120 rjpeter Removed use of LevelNameMappingFile.
+ * Nov 20, 2009 3387 jelkins Use derived script's variableId instead
+ * of filename
+ * Nov 21, 2009 3576 rjpeter Refactored DerivParamDesc.
+ * Jun 04, 2013 2041 bsteffen Switch derived parameters to use
+ * concurrent python for threading.
*
*
* @author brockwoo
@@ -113,9 +117,41 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
// TODO: Handle multiple function types (python mixed with
// gsl/cuda/anything)
- private static DerivParamFunctionType functionType;
+ private IDerivParamFunctionAdapter adapter;
- static {
+ private Set listeners = new HashSet();
+
+ private Map derParLibrary;
+
+ private boolean needsLibInit = true;
+
+ private String extension = null;
+
+ private Job notifyJob = new Job("Notify Derived Parameter Listeners") {
+
+ @Override
+ protected IStatus run(IProgressMonitor arg0) {
+ Collection l = null;
+ synchronized (listeners) {
+ l = new ArrayList(listeners);
+ }
+ for (DerivParamUpdateListener listener : l) {
+ listener.updateDerParLibrary(derParLibrary);
+ }
+ return Status.OK_STATUS;
+ }
+
+ };
+
+ public static synchronized DerivedParameterGenerator getInstance() {
+ if (instance == null) {
+ instance = new DerivedParameterGenerator();
+ }
+ return instance;
+ }
+
+ public static DerivParamFunctionType[] getFunctionTypes() {
+ List functionTypes = new ArrayList();
IExtensionRegistry registry = Platform.getExtensionRegistry();
if (registry != null) {
IExtensionPoint point = registry.getExtensionPoint(EXTENSION);
@@ -134,54 +170,15 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
functionType
.setAdapter((IDerivParamFunctionAdapter) cfg
.createExecutableExtension("adapter"));
- DerivedParameterGenerator.functionType = functionType;
- break;
+ functionTypes.add(functionType);
} catch (Throwable t) {
+ statusHandler.handle(Priority.DEBUG,
+ t.getLocalizedMessage(), t);
}
}
- if (functionType != null) {
- break;
- }
- }
-
- if (functionType == null) {
- statusHandler.handle(Priority.PROBLEM,
- "Error creating derived parameter function type,"
- + " derived paramters will not be available");
}
}
- }
-
- private Set listeners = new HashSet();
-
- private Map derParLibrary;
-
- private BlockingQueue toDoList;
-
- private static int numJobs = 2;
-
- private DerivedParameterJob[] jobs = new DerivedParameterJob[numJobs];
-
- private boolean needsLibInit = true;
-
- private boolean runtime = true;
-
- private String extension = null;
-
- public static synchronized DerivedParameterGenerator getInstance() {
- if (instance == null) {
- instance = new DerivedParameterGenerator();
- }
- return instance;
- }
-
- public static DerivParamFunctionType[] getFunctionTypes() {
- DerivedParameterGenerator gen = getInstance();
- if (gen != null && gen.jobs.length > 0) {
- return new DerivParamFunctionType[] { instance.jobs[0].functionType };
- }
-
- return new DerivParamFunctionType[0];
+ return functionTypes.toArray(new DerivParamFunctionType[0]);
}
public static synchronized Map getDerParLibrary() {
@@ -189,52 +186,23 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
}
public static void registerUpdateListener(DerivParamUpdateListener listener) {
- getInstance().listeners.add(listener);
+ DerivedParameterGenerator instance = getInstance();
+ synchronized (instance.listeners) {
+ instance.listeners.add(listener);
+ }
}
private DerivedParameterGenerator() {
- for (int i = 0; i < jobs.length; i++) {
- jobs[i] = new DerivedParameterJob("DerivParam Engine " + (i + 1));
+ DerivParamFunctionType[] functionTypes = getFunctionTypes();
+
+ if (functionTypes == null || functionTypes.length == 0) {
+ statusHandler.handle(Priority.PROBLEM,
+ "Error creating derived parameter function type,"
+ + " derived paramters will not be available");
}
-
- // load the extensions
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- if (registry != null) {
- IExtensionPoint point = registry.getExtensionPoint(EXTENSION);
-
- IExtension[] extensions = point.getExtensions();
-
- for (IExtension ext : extensions) {
- IConfigurationElement[] config = ext.getConfigurationElements();
-
- for (DerivedParameterJob job : jobs) {
- for (IConfigurationElement cfg : config) {
- try {
- DerivParamFunctionType functionType = new DerivParamFunctionType();
- functionType.setName(cfg.getAttribute("name"));
- functionType.setExtension(cfg
- .getAttribute("extension"));
- this.extension = functionType.getExtension();
- functionType
- .setAdapter((IDerivParamFunctionAdapter) cfg
- .createExecutableExtension("adapter"));
- job.functionType = functionType;
- break;
- } catch (Throwable t) {
- }
- }
- if (job.functionType == null) {
- statusHandler
- .handle(Priority.PROBLEM,
- "Error creating derived parameter function type,"
- + " derived paramters will not be available");
- break;
- }
- }
- }
- }
-
- toDoList = new LinkedBlockingQueue();
+ this.adapter = functionTypes[0].getAdapter();
+ this.extension = functionTypes[0].getExtension();
+ notifyJob.setSystem(true);
LocalizationFile dir = PathManagerFactory.getPathManager()
.getStaticLocalizationFile(DERIV_PARAM_DIR);
if (dir != null) {
@@ -242,9 +210,6 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
}
initLibrary();
- for (int i = 0; i < jobs.length; i++) {
- jobs[i].schedule();
- }
}
/**
@@ -254,11 +219,13 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
* A derived parameter request
* @return boolean indicating if the request was put into queue
*/
- public static boolean addTask(DerivedParameterRequest task) {
- return getInstance().toDoList.add(task);
+ public static List calculate(DerivedParameterRequest task)
+ throws ExecutionException {
+ return getInstance().adapter.executeFunction(task.getMethod(),
+ Arrays.asList(task.getArgumentRecords()));
}
- private void initLibrary() {
+ private synchronized void initLibrary() {
if (needsLibInit) {
long start = System.currentTimeMillis();
Set derivParamFiles = new HashSet();
@@ -334,11 +301,11 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
}
}
this.derParLibrary = derParLibrary;
- for (DerivParamUpdateListener listener : listeners) {
- listener.updateDerParLibrary(derParLibrary);
- }
+ adapter.init();
- System.out.println("time to init derived parameter thread: "
+ notifyJob.schedule();
+
+ System.out.println("time to init derived parameters: "
+ (System.currentTimeMillis() - start) + "ms");
needsLibInit = false;
}
@@ -359,86 +326,11 @@ public class DerivedParameterGenerator implements ILocalizationFileObserver {
@Override
public void fileUpdated(FileUpdatedMessage message) {
needsLibInit = true;
- for (DerivedParameterJob job : jobs) {
- job.needsInit = true;
- }
+ initLibrary();
}
public static void shutdown() {
- if (instance != null) {
- instance.runtime = false;
- }
+ getInstance().adapter.shutdown();
}
- private class DerivedParameterJob extends Job {
- // TODO: Handle multiple function types (python mixed with
- // gsl/cuda/anything)
- private DerivParamFunctionType functionType;
-
- private boolean needsInit = true;
-
- /**
- * @param name
- */
- public DerivedParameterJob(String name) {
- super(name);
- this.setSystem(true);
- }
-
- private void init() {
- if (needsInit) {
- functionType.getAdapter().init();
- DerivedParameterGenerator.this.initLibrary();
- needsInit = false;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @seeorg.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.
- * IProgressMonitor)
- */
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- while (runtime) {
- if (derParLibrary == null) {
- this.init();
- }
-
- DerivedParameterRequest request = null;
- try {
- request = toDoList.take();
- } catch (InterruptedException e) {
- }
- if (needsInit) {
- init();
- }
- if (request != null) {
- // long t0 = System.currentTimeMillis();
- try {
- functionType.getAdapter().executeFunction(
- request.getMethod(),
- Arrays.asList(request.getArgumentRecords()));
- List result = functionType.getAdapter()
- .getRequestResults();
- for (IDataRecord rec : result) {
- rec.setName(request.getParameterAbbreviation());
- }
- request.setQueue(result);
- } catch (Throwable e) {
- statusHandler
- .handle(Priority.PROBLEM,
- "Derived Parameter Engine failed to generate parameter",
- e);
- }
- // System.out.println(getName() + " calc took: "
- // + (System.currentTimeMillis() - t0));
-
- }
- }
- return Status.OK_STATUS;
- }
-
- }
}
diff --git a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivedParameterRequest.java b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivedParameterRequest.java
index ec8424c824..11ee8eb79d 100644
--- a/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivedParameterRequest.java
+++ b/cave/com.raytheon.uf.viz.derivparam/src/com/raytheon/uf/viz/derivparam/library/DerivedParameterRequest.java
@@ -21,11 +21,8 @@ package com.raytheon.uf.viz.derivparam.library;
import java.util.ArrayList;
import java.util.List;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.TimeUnit;
import com.raytheon.uf.common.time.DataTime;
-import com.raytheon.uf.viz.core.exception.VizException;
/**
* The DerivedParameteRequest is the way for a class to communicate a request
@@ -36,8 +33,10 @@ import com.raytheon.uf.viz.core.exception.VizException;
*
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
- * ------------ ---------- ----------- --------------------------
- * Jul 9, 2008 brockwoo Initial creation
+ * ------------ ---------- ----------- --------------------------
+ * Jul 09, 2008 brockwoo Initial creation
+ * Jun 04, 2013 2041 bsteffen Switch derived parameters to use
+ * concurrent python for threading.
*
*
*
@@ -56,10 +55,7 @@ public class DerivedParameterRequest {
private DataTime baseTime;
- private SynchronousQueue> queue;
-
public DerivedParameterRequest() {
- this.queue = new SynchronousQueue>();
this.baseParam = new ArrayList();
}
@@ -164,41 +160,4 @@ public class DerivedParameterRequest {
this.argumentRecords = argumentRecords;
}
- /**
- * This method will return the data calculated by the derived parameter
- * script. It is important to call this method right after the request has
- * been submitted to the derived parameter thread as it will block for 30
- * seconds waiting for the response.
- *
- * @return the raw data calculated by the script
- */
- public List> getQueue() throws VizException {
- try {
- List> result = queue.poll(30, TimeUnit.SECONDS);
- if (result == null) {
- throw new VizException("Derived Parameter Timed Out");
- }
- return result;
- } catch (InterruptedException e) {
- throw new VizException(e);
- }
- }
-
- /**
- * Used by the derived parameter generator to return the calculated data to
- * the thread requesting it. This will block until getQueue
is
- * called.
- *
- * @param queue
- * the data being returned to the thread making the request
- * @throws VizException
- */
- public void setQueue(List> queue) {
- try {
- this.queue.offer(queue, 15, TimeUnit.SECONDS);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-
}
diff --git a/cave/com.raytheon.uf.viz.event/src/com/raytheon/uf/viz/event/CaveEventBusHandler.java b/cave/com.raytheon.uf.viz.event/src/com/raytheon/uf/viz/event/CaveEventBusHandler.java
index 6d3f4a3866..87152f439b 100644
--- a/cave/com.raytheon.uf.viz.event/src/com/raytheon/uf/viz/event/CaveEventBusHandler.java
+++ b/cave/com.raytheon.uf.viz.event/src/com/raytheon/uf/viz/event/CaveEventBusHandler.java
@@ -38,6 +38,7 @@ import com.raytheon.uf.common.serialization.comm.RequestRouter;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Feb 5, 2013 1580 mpduff Initial creation.
+ * May 28, 2013 1650 djohnson Return subscriber on register method for Spring.
*
*
*
@@ -71,6 +72,10 @@ public class CaveEventBusHandler implements IEventBusHandler {
*/
@Override
public void publish(final Event event) {
+ if (event == null) {
+ throw new IllegalArgumentException("Cannot publish a null event");
+ }
+
executor.execute(new Runnable() {
@Override
public void run() {
@@ -89,7 +94,7 @@ public class CaveEventBusHandler implements IEventBusHandler {
* UnsupportedOperationException.
*/
@Override
- public void register(Object subscriber) {
+ public Object register(Object subscriber) {
throw new UnsupportedOperationException();
}
diff --git a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/dialogs/FFMPTable.java b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/dialogs/FFMPTable.java
index 9baf612067..1b39e65504 100644
--- a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/dialogs/FFMPTable.java
+++ b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/dialogs/FFMPTable.java
@@ -69,6 +69,10 @@ import com.raytheon.uf.viz.monitor.ffmp.xml.FFMPTableColumnXML;
* Mar 15,2012 DR 14406 gzhang Fixing QPF Column Title Missing
* Mar 20,2012 DR 14250 gzhang Eliminating column Missing values
* Aug 01, 2012 14168 mpduff Only allow filtering if ColorCell is true
+ * Jun 04, 2013 #1984 lvenable Save images instead of disposing them when setting
+ * the table column images. This is to fix the Windows
+ * issue on the images being blank and throwing errors.
+ * Also cleaned up some code.
* Jun 11, 2013 2075 njensen Optimized createTableItems()
*
*
@@ -154,6 +158,11 @@ public abstract class FFMPTable extends Composite {
private Point extent = new Point(0, 0);
+ /**
+ * Array of images displayed in the table columns.
+ */
+ protected List columnImgs = new ArrayList();
+
/**
* Constructor.
*
@@ -211,6 +220,7 @@ public abstract class FFMPTable extends Composite {
lineColor.dispose();
columnFont.dispose();
sortColor.dispose();
+ disposeColumnImages();
}
});
}
@@ -678,10 +688,7 @@ public abstract class FFMPTable extends Composite {
}
}
- imageWidth = maxTextLength * textWidth + EXTRA_COLUMN_WIDTH;// DR14406:
- // old value
- // 6 too
- // small
+ imageWidth = maxTextLength * textWidth + EXTRA_COLUMN_WIDTH;
imageHeight = textHeight * 2;
gc.dispose();
@@ -700,6 +707,8 @@ public abstract class FFMPTable extends Composite {
TableColumn tc;
+ disposeColumnImages();
+
// Loop over the column name keys
for (int i = 0; i < colNameKeys.length; i++) {
String colName = ffmpTableCfgData
@@ -717,7 +726,6 @@ public abstract class FFMPTable extends Composite {
// Set the background color to the sort color if that column is
// sorted.
- // if (table.indexOf(tc) == ffmpConfig.getStartSortIndex()) {
if (tc == sortedTableColumn) {
gc.setBackground(sortColor);
}
@@ -732,47 +740,45 @@ public abstract class FFMPTable extends Composite {
int xCoord = 0;
int yCoord = 0;
if (colName.indexOf("\n") > 0) {
- // int maxTextLen = 0;
String[] tmpArray = colName.split("\n");
for (int j = 0; j < tmpArray.length; j++) {
- // if (tmpArray[j].length() > maxTextLen) {
- // maxTextLen = tmpArray[j].length();
- // }
- // }
+ /*
+ * Fixes for DR14406
+ */
xCoord = Math.round((imageWidth / 2)
- - (tmpArray[j].length() /*
- * DR14406: old value:
- * maxTextLen
- */* textWidth / 2));
- yCoord = j * (textHeight + 1);// DR14406: old value 0 is
- // only for the 1st line
- gc.drawText(tmpArray[j], xCoord, yCoord, true);// DR14406:
- // draw each
- // line
- // separately
+ - (tmpArray[j].length() * textWidth / 2));
+ yCoord = j * (textHeight + 1);
+ gc.drawText(tmpArray[j], xCoord, yCoord, true);
}
} else {
xCoord = Math.round((imageWidth / 2)
- (colName.length() * textWidth / 2));
yCoord = imageHeight / 2 - textHeight / 2 - 1;
- gc.drawText(colName, xCoord, yCoord, true);// DR14406: draw text
- // with a single line
+ gc.drawText(colName, xCoord, yCoord, true);
}
- // System.out.println("Column name = " + colName);
- // DR14406: move the below text drawing code into the if-else blocks
- // gc.drawText(colName, xCoord, yCoord, true);
-
gc.dispose();
tc.setImage(img);
- // Dispose of the image
- img.dispose();
+ columnImgs.add(img);
}
}
+ /**
+ * Dispose of all the table column images and clear the array of images.
+ */
+ protected void disposeColumnImages() {
+ for (Image img : columnImgs) {
+ if (img != null) {
+ img.dispose();
+ }
+ }
+
+ columnImgs.clear();
+ }
+
/**
* Get the list of visible table columns.
*
@@ -819,8 +825,7 @@ public abstract class FFMPTable extends Composite {
tCols[i].setWidth(defaultColWidth);
}
- setQPFColName(tCols[i], col);// DR14406: set QPF title with
- // quicker response
+ setQPFColName(tCols[i], col);
} else {
tCols[i].setWidth(0);
}
diff --git a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/dialogs/FfmpBasinTableDlg.java b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/dialogs/FfmpBasinTableDlg.java
index ff4b418949..961b6990ab 100644
--- a/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/dialogs/FfmpBasinTableDlg.java
+++ b/cave/com.raytheon.uf.viz.monitor.ffmp/src/com/raytheon/uf/viz/monitor/ffmp/ui/dialogs/FfmpBasinTableDlg.java
@@ -118,7 +118,9 @@ import com.raytheon.viz.ui.dialogs.ICloseCallback;
* Mar 29, 2013 1790 rferrel Bug fix for non-blocking dialogs.
* Apr 15, 2013 1904 mpduff Remove calls to reset FFMPConfig.
* Apr 25, 2013 1902 mpduff Fixed Thresholds dialog on multiple opens, needed an isDisposed check.
+ * Jun 04, 2013 1984 lvenable removed unnecessary code.
* Jun 06, 2013 2075 njensen Removed loading labels
+ * Jun 20, 2013 14907 gzhang Thresholds menu ColorCell check fix.
*
*
* @author lvenable
@@ -1085,8 +1087,7 @@ public class FfmpBasinTableDlg extends CaveSWTDialog implements
// Loop over enum from config singleton to create menu items
for (ThreshColNames colName : ThreshColNames.values()) {
- if (ffmpConfig.isColorCell(colName)
- && (colName != ThreshColNames.GUID)) {// DR 14907
+ if (ffmpConfig.isColorCell(colName)) {// DR 14907
// only add a menu item if colorCell is true
MenuItem mi = new MenuItem(popupMenu, SWT.NONE);
mi.setText(colName.name());
diff --git a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/AbstractTableDlg.java b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/AbstractTableDlg.java
index fb8761ba29..043f84077d 100644
--- a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/AbstractTableDlg.java
+++ b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/AbstractTableDlg.java
@@ -76,7 +76,8 @@ import com.raytheon.uf.viz.monitor.scan.commondialogs.LoadSaveConfigDlg.DialogTy
* ------------ ---------- ----------- --------------------------
* Nov 21, 2009 #3039 lvenable Initial creation
* Apr 26, 2013 #1945 lvenable Some code cleanup.
- *
+ * 06 Jun 2013 #2065 lvenable Added convenience method to alert the user to use the clear
+ * button if they want to close the dialog.
*
*
* @author lvenable
@@ -768,6 +769,21 @@ public abstract class AbstractTableDlg extends Dialog implements IMonitor,
.getLinkToFrame(ScanTables.valueOf(type));
}
+ /**
+ * This pops up a dialog letting the operator know that you must use the
+ * Clear button to close the SCAN dialog.
+ *
+ * @param dialogBeingClosed
+ * Name of the dialog trying to be closed.
+ */
+ protected void displayCloseInstructions(String dialogBeingClosed) {
+ MessageBox mb = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK);
+ mb.setText("Close Information");
+ mb.setMessage("To close the " + dialogBeingClosed
+ + ",\nyou must clear the D2D display.");
+ mb.open();
+ }
+
/*
* Abstract methods to be implemented by classes extending this class.
*/
diff --git a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANCellTableComp.java b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANCellTableComp.java
index 4f8443d2b1..56160ef236 100644
--- a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANCellTableComp.java
+++ b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANCellTableComp.java
@@ -45,7 +45,9 @@ import com.raytheon.uf.viz.monitor.scan.commondialogs.IRequestTrendGraphData;
* ------------ ---------- ----------- --------------------------
* Dec 3, 2009 #3039 lvenable Initial creation
* Apr 29, 2013 #1945 lvenable Code cleanup for SCAN performance.
- *
+ * Jun 04, 2013 #1984 lvenable Save images instead of disposing them when setting
+ * the table column images. This is to fix the Windows
+ * issue on the images being blank and throwing errors.
*
*
* @author lvenable
@@ -227,6 +229,8 @@ public class SCANCellTableComp extends SCANTableTrendGraphLayer {
TableColumn[] tCols = table.getColumns();
+ disposeColumnImages();
+
for (int i = 0; i < tCols.length; i++) {
String colName = (String) tCols[i].getData();
Image img = new Image(this.getDisplay(), imageWidth, imageHeight);
@@ -287,7 +291,7 @@ public class SCANCellTableComp extends SCANTableTrendGraphLayer {
gc.dispose();
tCols[i].setImage(img);
- img.dispose();
+ columnImgs.add(img);
}
}
}
diff --git a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANCellTableDlg.java b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANCellTableDlg.java
index 2701c085a2..2ea4536bd9 100644
--- a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANCellTableDlg.java
+++ b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANCellTableDlg.java
@@ -90,6 +90,8 @@ import com.raytheon.viz.ui.EditorUtil;
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
* Apr 26, 2013 #1945 lvenable Improved SCAN performance, reworked
* some bad code, and some code cleanup.
+ * 06 Jun 2013 #2065 lvenable Added code to alert the user to use the clear
+ * button if they want to close the dialog.
*
*
*
@@ -993,7 +995,10 @@ public class SCANCellTableDlg extends AbstractTableDlg implements
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
- e.doit = killDialog;
+ if (killDialog == false) {
+ e.doit = false;
+ displayCloseInstructions("SCAN Cell Table dialog");
+ }
}
});
}
diff --git a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANDmdTableComp.java b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANDmdTableComp.java
index 1afdb641e1..d9ebf92150 100644
--- a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANDmdTableComp.java
+++ b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANDmdTableComp.java
@@ -56,7 +56,9 @@ import com.raytheon.uf.viz.monitor.scan.commondialogs.TimeHeightDlg;
* Dec 3, 2009 #3039 lvenable Initial creation
* Apr 26, 2013 #1945 lvenable Improved SCAN performance, reworked
* some bad code, and some code cleanup.
- *
+ * Jun 04, 2013 #1984 lvenable Save images instead of disposing them when setting
+ * the table column images. This is to fix the Windows
+ * issue on the images being blank and throwing errors.
*
*
* @author lvenable
@@ -95,6 +97,8 @@ public class SCANDmdTableComp extends SCANTableTrendGraphLayer implements
TableColumn[] tCols = table.getColumns();
+ disposeColumnImages();
+
for (int i = 0; i < tCols.length; i++) {
String colName = (String) tCols[i].getData();
Image img = new Image(this.getDisplay(), imageWidth, imageHeight);
@@ -141,7 +145,7 @@ public class SCANDmdTableComp extends SCANTableTrendGraphLayer implements
gc.dispose();
tCols[i].setImage(img);
- img.dispose();
+ columnImgs.add(img);
}
}
diff --git a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANDmdTableDlg.java b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANDmdTableDlg.java
index 4f1867796b..48d0f2cbba 100644
--- a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANDmdTableDlg.java
+++ b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANDmdTableDlg.java
@@ -91,6 +91,8 @@ import com.raytheon.viz.ui.EditorUtil;
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
* Apr 29, 2013 #1945 lvenable Improved SCAN performance, reworked
* some bad code, and some code cleanup.
+ * 06 Jun 2013 #2065 lvenable Added code to alert the user to use the clear
+ * button if they want to close the dialog.
*
*
*
@@ -894,8 +896,10 @@ public class SCANDmdTableDlg extends AbstractTableDlg implements
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
- e.doit = killDialog;
- // closeDialog();
+ if (killDialog == false) {
+ e.doit = false;
+ displayCloseInstructions("SCAN DMD Table dialog");
+ }
}
});
}
diff --git a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANTable.java b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANTable.java
index 88a5372425..695cfc69d9 100644
--- a/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANTable.java
+++ b/cave/com.raytheon.uf.viz.monitor.scan/src/com/raytheon/uf/viz/monitor/scan/tables/SCANTable.java
@@ -22,6 +22,7 @@ package com.raytheon.uf.viz.monitor.scan.tables;
import java.awt.Toolkit;
import java.util.ArrayList;
import java.util.Date;
+import java.util.List;
import java.util.Set;
import java.util.Timer;
import java.util.TimerTask;
@@ -76,6 +77,10 @@ import com.raytheon.uf.viz.monitor.scan.tables.SCANAlarmAlertManager.AlertedAlar
* 03/15/2012 13939 Mike Duff For a SCAN Alarms issue
* Apr 29, 2013 #1945 lvenable Improved SCAN performance, reworked
* some bad code, and some code cleanup.
+ * Jun 04, 2013 #1984 lvenable Save images instead of disposing them when setting
+ * the table column images. This is to fix the Windows
+ * issue on the images being blank and throwing errors.
+ * Also cleaned up some code.
*
*
*
@@ -151,6 +156,11 @@ public abstract class SCANTable extends Composite {
protected Point prevMousePt = new Point(-9999, -9999);
+ /**
+ * Array of images used for the table columns.
+ */
+ protected List columnImgs = new ArrayList();
+
/**
* Last sorted column index. This is set to -2 because sortedColumnIndex is
* set to -1 and they should not have the same initial value at start up.
@@ -221,6 +231,7 @@ public abstract class SCANTable extends Composite {
tiFont.dispose();
columnFont.dispose();
lineColor.dispose();
+ disposeColumnImages();
}
});
}
@@ -237,15 +248,6 @@ public abstract class SCANTable extends Composite {
gd.heightHint = 175;
gd.widthHint = scanCfg.getDefaultTableWidth(scanTable);
- boolean[] visCols = scanCfg.getVisibleColumns(scanTable);
- int tableWidth = 0;
-
- for (boolean b : visCols) {
- if (b) {
- tableWidth += defaultColWidth;
- }
- }
-
table = new Table(this, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
table.setLayoutData(gd);
table.setHeaderVisible(true);
@@ -317,7 +319,6 @@ public abstract class SCANTable extends Composite {
public void mouseDown(MouseEvent event) {
tableMouseDownAction(event);
}
-
});
table.addMouseMoveListener(new MouseMoveListener() {
@@ -770,8 +771,6 @@ public abstract class SCANTable extends Composite {
int maxColNameExtent = 0;
- // TODO - use font extents
-
textWidth = gc.getFontMetrics().getAverageCharWidth();
textHeight = gc.getFontMetrics().getHeight();
@@ -1060,6 +1059,8 @@ public abstract class SCANTable extends Composite {
TableColumn[] tCols = table.getColumns();
+ disposeColumnImages();
+
for (int i = 0; i < tCols.length; i++) {
String colName = (String) tCols[i].getData();
Image img = new Image(this.getDisplay(), imageWidth, imageHeight);
@@ -1097,10 +1098,23 @@ public abstract class SCANTable extends Composite {
gc.dispose();
tCols[i].setImage(img);
- img.dispose();
+ columnImgs.add(img);
}
}
+ /**
+ * Dispose of all the table column images and clear the array of images.
+ */
+ protected void disposeColumnImages() {
+ for (Image img : columnImgs) {
+ if (img != null) {
+ img.dispose();
+ }
+ }
+
+ columnImgs.clear();
+ }
+
/**
* When the mouse enters the cell on the table this method is call to
* determine how to handle the action.
@@ -1177,7 +1191,6 @@ public abstract class SCANTable extends Composite {
}
Rectangle rect;
- // rect = item.getBounds(table.getColumnCount() - 1);
rect = item.getBounds(scanCfg.getCountyColumnIndex(scanTable));
if ((scanCfg.showTips(scanTable) == false)
diff --git a/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OATiltGridTransformer.java b/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OATiltGridTransformer.java
index 832e39a6e2..e9daeccdbe 100644
--- a/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OATiltGridTransformer.java
+++ b/cave/com.raytheon.uf.viz.objectiveanalysis/src/com/raytheon/uf/viz/objectiveanalysis/rsc/OATiltGridTransformer.java
@@ -22,6 +22,7 @@ package com.raytheon.uf.viz.objectiveanalysis.rsc;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ExecutionException;
import org.geotools.coverage.grid.GeneralGridGeometry;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
@@ -53,7 +54,9 @@ import com.raytheon.viz.grid.util.TiltUtils;
* SOFTWARE HISTORY
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
- * May 20, 2010 bsteffen Initial creation
+ * May 20, 2010 bsteffen Initial creation
+ * Jun 04, 2013 2041 bsteffen Switch derived parameters to use
+ * concurrent python for threading.
*
*
*
@@ -210,9 +213,12 @@ public class OATiltGridTransformer extends OAGridTransformer {
DerivedParameterRequest sliceRequest = new DerivedParameterRequest();
sliceRequest.setMethod("Slice");
sliceRequest.setArgumentRecords(new Object[] { cube, presRequest, -1 });
- DerivedParameterGenerator.addTask(sliceRequest);
- return ((FloatDataRecord) sliceRequest.getQueue().get(0))
- .getFloatData();
+ try {
+ return ((FloatDataRecord) DerivedParameterGenerator.calculate(
+ sliceRequest).get(0)).getFloatData();
+ } catch (ExecutionException e) {
+ throw new VizException(e);
+ }
}
diff --git a/cave/com.raytheon.uf.viz.plugin.nwsauth/src/com/raytheon/uf/viz/plugin/nwsauth/NwsUserManager.java b/cave/com.raytheon.uf.viz.plugin.nwsauth/src/com/raytheon/uf/viz/plugin/nwsauth/NwsUserManager.java
index d68f4fb81f..b98daf81df 100644
--- a/cave/com.raytheon.uf.viz.plugin.nwsauth/src/com/raytheon/uf/viz/plugin/nwsauth/NwsUserManager.java
+++ b/cave/com.raytheon.uf.viz.plugin.nwsauth/src/com/raytheon/uf/viz/plugin/nwsauth/NwsUserManager.java
@@ -38,6 +38,7 @@ import com.raytheon.uf.viz.core.requests.INotAuthHandler;
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* May 27, 2010 rgeorge Initial creation
+ * Jun 07, 2013 1981 mpduff Add an IUser field.
*
*
*
@@ -49,6 +50,9 @@ public class NwsUserManager implements IUserManager {
private final NwsNotAuthHandler notAuthHandler = new NwsNotAuthHandler();
+ /** Saved User Name */
+ private IUser user;
+
/*
* (non-Javadoc)
*
@@ -66,8 +70,13 @@ public class NwsUserManager implements IUserManager {
*/
@Override
public IUser getUserObject() {
- String userId = System.getProperty("user.name");
- return new User(userId);
+ if (this.user == null) {
+ String userId = System.getProperty("user.name");
+ this.user = new User(userId);
+ return this.user;
+ } else {
+ return user;
+ }
}
/*
@@ -80,6 +89,7 @@ public class NwsUserManager implements IUserManager {
*/
@Override
public void updateUserObject(IUser user, IAuthenticationData authData) {
+ this.user = user;
}
/**
@@ -99,4 +109,12 @@ public class NwsUserManager implements IUserManager {
// TODO: Should this pass through to EDEX to get this stuff?
return NwsRoleDataManager.getInstance().getRoles(application);
}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public void updateUserObject(String userId, IAuthenticationData authData) {
+ user = new User(userId);
+ }
}
diff --git a/cave/com.raytheon.uf.viz.product.alertviz/alertviz.product b/cave/com.raytheon.uf.viz.product.alertviz/alertviz.product
index f27bbd425f..b41ebb9baa 100644
--- a/cave/com.raytheon.uf.viz.product.alertviz/alertviz.product
+++ b/cave/com.raytheon.uf.viz.product.alertviz/alertviz.product
@@ -31,7 +31,8 @@ Developed on the Raytheon Visualization Environment (viz)
-Dqpid.dest_syntax=BURL
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
--Dlog4j.configuration=log4j-alertviz.xml
+-Dlog4j.configuration=log4j-alertviz.xml
+-Dthrift.stream.maxsize=200
diff --git a/cave/com.raytheon.uf.viz.ui.menus/plugin.xml b/cave/com.raytheon.uf.viz.ui.menus/plugin.xml
index 21f28a2f0d..a9cb64e917 100644
--- a/cave/com.raytheon.uf.viz.ui.menus/plugin.xml
+++ b/cave/com.raytheon.uf.viz.ui.menus/plugin.xml
@@ -1,6 +1,7 @@
+
+
+
+
+
+
+
+
+ [Enter description of this extension point.]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [Enter the first release in which this extension point appears.]
+
+
+
+
+
+
+
+
+ [Enter extension point usage example here.]
+
+
+
+
+
+
+
+
+ [Enter API information here.]
+
+
+
+
+
+
+
+
+ [Enter information about supplied implementation of this extension point.]
+
+
+
+
+
diff --git a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/widgets/tearoff/TearOffMenuListener.java b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/widgets/tearoff/TearOffMenuListener.java
index f486955279..45b0814f5c 100644
--- a/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/widgets/tearoff/TearOffMenuListener.java
+++ b/cave/com.raytheon.uf.viz.ui.menus/src/com/raytheon/uf/viz/ui/menus/widgets/tearoff/TearOffMenuListener.java
@@ -23,6 +23,11 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.ContributionItem;
@@ -43,6 +48,7 @@ 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.viz.ui.VizWorkbenchManager;
+import com.raytheon.viz.ui.perspectives.VizPerspectiveListener;
/**
* Menu listener that adds item to menu which will open dialog which is the menu
@@ -72,14 +78,35 @@ public class TearOffMenuListener implements IMenuListener2 {
public static final String TEAROFF_PREFERENCE_ID = "tearoffmenus";
+ private static final String TEAROFF_DISABLED_PERSPECTIVES = "com.raytheon.uf.viz.ui.menus.tearoffperspective";
+
private static final IUFStatusHandler statusHandler = UFStatus
- .getHandler(TearOffMenuListener.class);
+ .getHandler(TearOffMenuListener.class);
private static boolean enabled;
+
+ private static List enabledPerspectives;
static {
final IPreferenceStore store = com.raytheon.uf.viz.core.Activator
.getDefault().getPreferenceStore();
enabled = store.getBoolean(TEAROFF_PREFERENCE_ID);
+ enabledPerspectives = new ArrayList();
+
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint point = registry
+ .getExtensionPoint(TEAROFF_DISABLED_PERSPECTIVES);
+ if (point != null) {
+ IExtension[] extensions = point.getExtensions();
+ for (IExtension extension : extensions) {
+ for (IConfigurationElement element : extension
+ .getConfigurationElements()) {
+ if (Boolean.valueOf(element.getAttribute("enabled"))) {
+ enabledPerspectives.add(element
+ .getAttribute("perspectiveId"));
+ }
+ }
+ }
+ }
store.addPropertyChangeListener(new IPropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent event) {
@@ -149,9 +176,12 @@ public class TearOffMenuListener implements IMenuListener2 {
private Object getPerspectiveKey(IMenuManager manager) {
String perspectiveId = "";
try {
- perspectiveId = VizWorkbenchManager.getInstance().getCurrentWindow().getActivePage().getPerspective().getId();
+ perspectiveId = VizWorkbenchManager.getInstance()
+ .getCurrentWindow().getActivePage().getPerspective()
+ .getId();
} catch (Exception e) {
- statusHandler.handle(Priority.EVENTA, "Failed to get current perspective ID", e);
+ statusHandler.handle(Priority.EVENTA,
+ "Failed to get current perspective ID", e);
}
return perspectiveId + "::" + getKey(manager);
}
@@ -210,7 +240,13 @@ public class TearOffMenuListener implements IMenuListener2 {
*/
@Override
public boolean isVisible() {
- return super.isVisible() && enabled;
+ String currPerspective = VizPerspectiveListener
+ .getCurrentPerspectiveManager().getPerspectiveId();
+ boolean currPerspectiveEnabled = false;
+ if (enabledPerspectives.contains(currPerspective)) {
+ currPerspectiveEnabled = true;
+ }
+ return super.isVisible() && enabled && currPerspectiveEnabled;
}
}
diff --git a/cave/com.raytheon.viz.aviation/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.aviation/META-INF/MANIFEST.MF
index 002f22ab67..da05b17e42 100644
--- a/cave/com.raytheon.viz.aviation/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.viz.aviation/META-INF/MANIFEST.MF
@@ -25,7 +25,8 @@ Require-Bundle: org.eclipse.ui,
com.raytheon.viz.ui.personalities.awips;bundle-version="1.12.1174",
com.raytheon.uf.viz.application;bundle-version="1.0.0",
com.raytheon.uf.common.tafqueue;bundle-version="1.0.0",
- org.apache.commons.lang;bundle-version="2.3.0"
+ org.apache.commons.lang;bundle-version="2.3.0",
+ com.raytheon.uf.common.auth;bundle-version="1.12.1174"
Bundle-ActivationPolicy: lazy
Eclipse-RegisterBuddy: com.raytheon.uf.common.serialization
Export-Package: com.raytheon.viz.aviation,
diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/SendDialog.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/SendDialog.java
index 1345a71b6b..25aab8fa6e 100644
--- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/SendDialog.java
+++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/observer/SendDialog.java
@@ -46,6 +46,7 @@ import com.raytheon.uf.common.tafqueue.ServerResponse;
import com.raytheon.uf.common.tafqueue.TafQueueRecord;
import com.raytheon.uf.common.tafqueue.TafQueueRequest;
import com.raytheon.uf.common.tafqueue.TafQueueRequest.Type;
+import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.aviation.AviationDialog;
@@ -70,6 +71,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* 12/08/2011 11745 rferrel Updated header time to transmission time.
* 08AUG2012 15613 zhao Determine proper BBB for transmission
* 09OCT2012 1229 rferrel Make dialog non-blocking.
+ * 0yJUN2013 1981 mpduff Set user on the request.
*
*
*
@@ -116,12 +118,12 @@ public class SendDialog extends CaveSWTDialog {
/**
* Tab composite containing the TAF Viewer and the TAF Editor.
*/
- private EditorTafTabComp tabComp;
+ private final EditorTafTabComp tabComp;
/**
* Message status composite.
*/
- private IStatusSettable msgStatComp;
+ private final IStatusSettable msgStatComp;
/**
* Main composite.
@@ -136,7 +138,7 @@ public class SendDialog extends CaveSWTDialog {
/**
* Send the TAFs individually or as a collective.
*/
- private boolean sendCollective;
+ private final boolean sendCollective;
/**
* Constructor.
@@ -346,6 +348,7 @@ public class SendDialog extends CaveSWTDialog {
private void sendAction() {
TafQueueRequest request = new TafQueueRequest();
request.setType(Type.CREATE);
+ request.setUser(UserController.getUserObject());
// Forecaster ID
int forecasterId = forecasterArray.get(personList.getSelectionIndex())
@@ -473,11 +476,12 @@ public class SendDialog extends CaveSWTDialog {
try {
TafQueueRequest request = new TafQueueRequest();
request.setType(Type.GET_LIST);
+ request.setUser(UserController.getUserObject());
request.setState(TafQueueRecord.TafQueueState.SENT);
ServerResponse> response = (ServerResponse>) ThriftClient
.sendRequest(request);
java.util.List payload = response.getPayload();
- String[] records = (String[]) payload.toArray(new String[0]);
+ String[] records = payload.toArray(new String[0]);
int numRecords = records.length;
for (int i = numRecords - 1; i >= 0; i--) {
if (records[i].contains(siteId)) {
diff --git a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TransmissionQueueDlg.java b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TransmissionQueueDlg.java
index 35cd7743dc..0e9e10129a 100644
--- a/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TransmissionQueueDlg.java
+++ b/cave/com.raytheon.viz.aviation/src/com/raytheon/viz/aviation/utility/TransmissionQueueDlg.java
@@ -42,6 +42,7 @@ import com.raytheon.uf.common.tafqueue.ServerResponse;
import com.raytheon.uf.common.tafqueue.TafQueueRecord.TafQueueState;
import com.raytheon.uf.common.tafqueue.TafQueueRequest;
import com.raytheon.uf.common.tafqueue.TafQueueRequest.Type;
+import com.raytheon.uf.viz.core.auth.UserController;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.uf.viz.core.requests.ThriftClient;
import com.raytheon.viz.aviation.resource.ResourceConfigMgr;
@@ -62,6 +63,7 @@ import com.raytheon.viz.ui.widgets.ToggleSelectList;
* 14 MAY 2012 14715 rferrel Use EDEX to perform requests.
* 10 OCT 2012 1229 rferrel Make dialog non-blocking.
* 10 OCT 2012 1229 rferrel Changes for non-blocking HelpUsageDlg.
+ * 07 JUN 2013 1981 mpduff Set user on the request.
*
*
*
@@ -113,8 +115,8 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
*
* @author lvenable
*/
- private String[] dayOfWeek = new String[] { "Sunday", "Monday", "Tuesday",
- "Wednesday", "Thursday", "Friday", "Saturday" };
+ private final String[] dayOfWeek = new String[] { "Sunday", "Monday",
+ "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" };
/**
* The Selected day of the week Calendar day of the week value.
@@ -306,8 +308,7 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
+ " moved back to 'pending'. The transmission time (the last\n"
+ " part of the file name) is updated to the current time.\n"
+ " Help: displays this window";
- usageDlg = new HelpUsageDlg(shell, description,
- helpText);
+ usageDlg = new HelpUsageDlg(shell, description, helpText);
usageDlg.open();
} else {
usageDlg.bringToTop();
@@ -333,6 +334,7 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
request.setType(Type.RETRANSMIT);
request.setState(getDisplayState());
request.setArgument(idList);
+ request.setUser(UserController.getUserObject());
try {
ServerResponse> response = (ServerResponse>) ThriftClient
@@ -384,6 +386,8 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
TafQueueRequest request = new TafQueueRequest();
request.setType(Type.GET_TAFS);
request.setArgument(idList);
+ request.setUser(UserController.getUserObject());
+
ServerResponse response = null;
try {
response = (ServerResponse) ThriftClient
@@ -426,6 +430,7 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
request.setType(Type.REMOVE_SELECTED);
request.setState(getDisplayState());
request.setArgument(idList);
+ request.setUser(UserController.getUserObject());
try {
ServerResponse> response = (ServerResponse>) ThriftClient
@@ -634,6 +639,7 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
selectedDayEnd.add(Calendar.DAY_OF_MONTH, 1);
dateList.add(selectedDayEnd.getTime());
request.setArgument(dateList);
+ request.setUser(UserController.getUserObject());
try {
ServerResponse response = (ServerResponse) ThriftClient
@@ -660,6 +666,7 @@ public class TransmissionQueueDlg extends CaveSWTDialog {
request.setType(Type.GET_LIST);
request.setState(getDisplayState());
+ request.setUser(UserController.getUserObject());
ServerResponse> response = (ServerResponse>) ThriftClient
.sendRequest(request);
diff --git a/cave/com.raytheon.viz.core.gl/META-INF/MANIFEST.MF b/cave/com.raytheon.viz.core.gl/META-INF/MANIFEST.MF
index 5c2a9aace6..8a5771db4e 100644
--- a/cave/com.raytheon.viz.core.gl/META-INF/MANIFEST.MF
+++ b/cave/com.raytheon.viz.core.gl/META-INF/MANIFEST.MF
@@ -21,6 +21,7 @@ Bundle-ActivationPolicy: lazy
Export-Package: com.raytheon.viz.core.gl,
com.raytheon.viz.core.gl.dataformat,
com.raytheon.viz.core.gl.ext,
+ com.raytheon.viz.core.gl.ext.imaging,
com.raytheon.viz.core.gl.glsl,
com.raytheon.viz.core.gl.images
Import-Package: com.raytheon.uf.common.status,
diff --git a/cave/com.raytheon.viz.core.gl/plugin.xml b/cave/com.raytheon.viz.core.gl/plugin.xml
index 41ff5356f2..3c1006b9e1 100644
--- a/cave/com.raytheon.viz.core.gl/plugin.xml
+++ b/cave/com.raytheon.viz.core.gl/plugin.xml
@@ -36,22 +36,22 @@