Issue #1346 - added addtional information to the data browser dataset details dialog
Former-commit-id:38aae63ee3
[formerly674ddfedb2
] [formerly02bfe05a27
] [formerly38aae63ee3
[formerly674ddfedb2
] [formerly02bfe05a27
] [formerlyb72c2e4b04
[formerly02bfe05a27
[formerly 682e4831f76b3a220aeedb9fc292886f24582e72]]]] Former-commit-id:b72c2e4b04
Former-commit-id:f167689caf
[formerly8b23902cea
] [formerly 6d7445bf13f8b180941b8fd9b135ad41b909c4c8 [formerlyb42395d6ea
]] Former-commit-id: 11f7b7af0ee7038d96e8e0f49078e0d30550ea51 [formerly910401bd23
] Former-commit-id:7b76dbba46
This commit is contained in:
parent
bb444602ec
commit
bb5d45c06b
1 changed files with 96 additions and 20 deletions
|
@ -23,6 +23,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
@ -40,6 +41,8 @@ import org.eclipse.swt.widgets.TableItem;
|
||||||
|
|
||||||
import com.raytheon.edex.util.Util;
|
import com.raytheon.edex.util.Util;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
import com.raytheon.uf.common.datadelivery.registry.DataSet;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.GriddedDataSet;
|
||||||
|
import com.raytheon.uf.common.datadelivery.registry.Parameter;
|
||||||
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
import com.raytheon.uf.common.datadelivery.registry.handlers.DataDeliveryHandlers;
|
||||||
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
import com.raytheon.uf.common.registry.handler.RegistryHandlerException;
|
||||||
import com.raytheon.uf.common.status.IUFStatusHandler;
|
import com.raytheon.uf.common.status.IUFStatusHandler;
|
||||||
|
@ -77,6 +80,7 @@ import com.raytheon.uf.viz.datadelivery.utils.DataDeliveryUtils.TABLE_TYPE;
|
||||||
* Aug 20, 2012 0743 djohnson Finish making registry type-safe.
|
* Aug 20, 2012 0743 djohnson Finish making registry type-safe.
|
||||||
* Aug 30, 2012 1120 jpiatt Added clickSort flag.
|
* Aug 30, 2012 1120 jpiatt Added clickSort flag.
|
||||||
* Oct 05, 2012 1241 djohnson Replace RegistryManager calls with registry handler calls.
|
* Oct 05, 2012 1241 djohnson Replace RegistryManager calls with registry handler calls.
|
||||||
|
* Jan 10, 2013 1346 mpduff Add additional information to the dataset details output.
|
||||||
*
|
*
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -121,7 +125,7 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
|
||||||
/** TableItem object. */
|
/** TableItem object. */
|
||||||
private final Composite parentComp;
|
private final Composite parentComp;
|
||||||
|
|
||||||
/** Array of dataset metadata */
|
/** Array of DataSet objects */
|
||||||
private List<DataSet> dataList = null;
|
private List<DataSet> dataList = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -134,7 +138,8 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
|
||||||
* @param updateCallback
|
* @param updateCallback
|
||||||
* Callback for the table updates.
|
* Callback for the table updates.
|
||||||
*/
|
*/
|
||||||
public BrowserTableComp(Composite parent, TableCompConfig tableConfig, IDataTableUpdate updateCallback) {
|
public BrowserTableComp(Composite parent, TableCompConfig tableConfig,
|
||||||
|
IDataTableUpdate updateCallback) {
|
||||||
super(parent, tableConfig, false);
|
super(parent, tableConfig, false);
|
||||||
|
|
||||||
this.updateCallback = updateCallback;
|
this.updateCallback = updateCallback;
|
||||||
|
@ -235,8 +240,7 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
|
||||||
|
|
||||||
if (subscriptionDlgMap.containsKey(id) == true) {
|
if (subscriptionDlgMap.containsKey(id) == true) {
|
||||||
subscriptionDlgMap.get(id).bringToTop();
|
subscriptionDlgMap.get(id).bringToTop();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
SubscriptionViewer viewer = new SubscriptionViewer(this.getShell(),
|
SubscriptionViewer viewer = new SubscriptionViewer(this.getShell(),
|
||||||
providerName, this, dataSetName);
|
providerName, this, dataSetName);
|
||||||
viewer.open();
|
viewer.open();
|
||||||
|
@ -266,13 +270,13 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
|
||||||
|
|
||||||
if (detailsDlgMap.containsKey(id) == true) {
|
if (detailsDlgMap.containsKey(id) == true) {
|
||||||
detailsDlgMap.get(id).bringToTop();
|
detailsDlgMap.get(id).bringToTop();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
|
|
||||||
String formattedData = formatDatasetData(dsmd);
|
String formattedData = formatDatasetData(dsmd);
|
||||||
|
|
||||||
String title = "More Information - (" + dsmd.getDataSetName() + ")";
|
String title = "More Information - (" + dsmd.getDataSetName() + ")";
|
||||||
ViewDetailsDlg mid = new ViewDetailsDlg(parentComp.getShell(), formattedData, title, this, id);
|
ViewDetailsDlg mid = new ViewDetailsDlg(parentComp.getShell(),
|
||||||
|
formattedData, title, this, id);
|
||||||
mid.open();
|
mid.open();
|
||||||
detailsDlgMap.put(id, mid);
|
detailsDlgMap.put(id, mid);
|
||||||
}
|
}
|
||||||
|
@ -287,7 +291,6 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
|
||||||
*/
|
*/
|
||||||
private String formatDatasetData(DataSet dataSet) {
|
private String formatDatasetData(DataSet dataSet) {
|
||||||
StringBuilder sb = new StringBuilder(150);
|
StringBuilder sb = new StringBuilder(150);
|
||||||
|
|
||||||
sb.append("Dataset Name: ")
|
sb.append("Dataset Name: ")
|
||||||
.append(validateString(dataSet.getDataSetName()))
|
.append(validateString(dataSet.getDataSetName()))
|
||||||
.append(Util.EOL);
|
.append(Util.EOL);
|
||||||
|
@ -311,7 +314,80 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
|
||||||
sb.append("--- LowerRight (Lat): ")
|
sb.append("--- LowerRight (Lat): ")
|
||||||
.append(dataSet.getCoverage().getLowerRight().y)
|
.append(dataSet.getCoverage().getLowerRight().y)
|
||||||
.append(Util.EOL);
|
.append(Util.EOL);
|
||||||
|
sb.append("\n");
|
||||||
|
|
||||||
|
if (dataSet instanceof GriddedDataSet) {
|
||||||
|
GriddedDataSet gds = (GriddedDataSet) dataSet;
|
||||||
|
List<Integer> cycleList = new ArrayList<Integer>(gds.getCycles());
|
||||||
|
if (!cycleList.isEmpty()) {
|
||||||
|
sb.append("Dataset Cycles: ");
|
||||||
|
Collections.sort(cycleList);
|
||||||
|
for (int i : cycleList) {
|
||||||
|
sb.append(i).append(" ");
|
||||||
|
}
|
||||||
|
sb.append(Util.EOL);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Integer> fcstHrs = new ArrayList<Integer>(
|
||||||
|
gds.getForecastHours());
|
||||||
|
if (!fcstHrs.isEmpty()) {
|
||||||
|
sb.append("Forecast Hours: ");
|
||||||
|
|
||||||
|
Collections.sort(fcstHrs);
|
||||||
|
|
||||||
|
StringBuilder hrBuffer = new StringBuilder();
|
||||||
|
for (int i : fcstHrs) {
|
||||||
|
hrBuffer.append(i).append(" ");
|
||||||
|
// wrap at 50 characters
|
||||||
|
if (hrBuffer.length() > 50) {
|
||||||
|
sb.append(hrBuffer).append(Util.EOL);
|
||||||
|
sb.append(" ");
|
||||||
|
hrBuffer.setLength(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append(Util.EOL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, Parameter> paramMap = dataSet.getParameters();
|
||||||
|
if (!paramMap.isEmpty()) {
|
||||||
|
sb.append("Parameters:").append(Util.EOL);
|
||||||
|
List<String> paramList = new ArrayList<String>(paramMap.keySet());
|
||||||
|
Collections.sort(paramList, String.CASE_INSENSITIVE_ORDER);
|
||||||
|
|
||||||
|
// Get the largest parameter name for alignment
|
||||||
|
int max = 0;
|
||||||
|
for (String param : paramList) {
|
||||||
|
if (max < param.length()) {
|
||||||
|
max = param.length();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String param : paramList) {
|
||||||
|
sb.append("--- ").append(param);
|
||||||
|
sb.append(getSpacing(max + 1, param));
|
||||||
|
sb.append(paramMap.get(param).getDefinition()).append(Util.EOL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the spacing of the parameter definitions.
|
||||||
|
*
|
||||||
|
* @param start
|
||||||
|
* the point at which the string should start
|
||||||
|
* @param the
|
||||||
|
* parameter name
|
||||||
|
*/
|
||||||
|
private String getSpacing(int start, String param) {
|
||||||
|
int numSpaces = start - param.length();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (int i = 0; i < numSpaces; i++) {
|
||||||
|
sb.append(" ");
|
||||||
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,7 +495,7 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TableColumn tc = (TableColumn)event.getSource();
|
TableColumn tc = (TableColumn) event.getSource();
|
||||||
|
|
||||||
updateSortDirection(tc, tableData, true);
|
updateSortDirection(tc, tableData, true);
|
||||||
|
|
||||||
|
@ -441,8 +517,10 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
|
||||||
for (BrowserTableRowData btrd : btrdArray) {
|
for (BrowserTableRowData btrd : btrdArray) {
|
||||||
TableItem ti = new TableItem(this.table, SWT.NONE);
|
TableItem ti = new TableItem(this.table, SWT.NONE);
|
||||||
ti.setText(BrowserColumnNames.NAME.ordinal(), btrd.getDataSetName());
|
ti.setText(BrowserColumnNames.NAME.ordinal(), btrd.getDataSetName());
|
||||||
ti.setText(BrowserColumnNames.SUBSCRIPTION.ordinal(), btrd.getSubscriptionName());
|
ti.setText(BrowserColumnNames.SUBSCRIPTION.ordinal(),
|
||||||
ti.setText(BrowserColumnNames.PROVIDER.ordinal(), btrd.getProviderName());
|
btrd.getSubscriptionName());
|
||||||
|
ti.setText(BrowserColumnNames.PROVIDER.ordinal(),
|
||||||
|
btrd.getProviderName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,13 +614,14 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
|
||||||
tableData = null;
|
tableData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
tableData = new TableDataManager<BrowserTableRowData>(TABLE_TYPE.BROWSER);
|
tableData = new TableDataManager<BrowserTableRowData>(
|
||||||
|
TABLE_TYPE.BROWSER);
|
||||||
closeAllViewerDialogs();
|
closeAllViewerDialogs();
|
||||||
|
|
||||||
Set<String> datasetNames = Collections.emptySet();
|
Set<String> datasetNames = Collections.emptySet();
|
||||||
try {
|
try {
|
||||||
datasetNames = DataDeliveryHandlers
|
datasetNames = DataDeliveryHandlers.getSubscriptionHandler()
|
||||||
.getSubscriptionHandler().getSubscribedToDataSetNames();
|
.getSubscribedToDataSetNames();
|
||||||
} catch (RegistryHandlerException e) {
|
} catch (RegistryHandlerException e) {
|
||||||
statusHandler.handle(Priority.PROBLEM,
|
statusHandler.handle(Priority.PROBLEM,
|
||||||
"Unable to retrieve subscription dataset names!", e);
|
"Unable to retrieve subscription dataset names!", e);
|
||||||
|
@ -560,8 +639,7 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
|
||||||
|
|
||||||
if (datasetNames.contains(data.getDataSetName())) {
|
if (datasetNames.contains(data.getDataSetName())) {
|
||||||
btrd.setSubscriptionName("Y");
|
btrd.setSubscriptionName("Y");
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
btrd.setSubscriptionName("N");
|
btrd.setSubscriptionName("N");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -571,8 +649,7 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
|
||||||
if (this.sortedColumn == null) {
|
if (this.sortedColumn == null) {
|
||||||
sortedColumn = table.getColumn(BrowserColumnNames.NAME.ordinal());
|
sortedColumn = table.getColumn(BrowserColumnNames.NAME.ordinal());
|
||||||
tableData.setSortColumn(BrowserColumnNames.NAME.getColumnName());
|
tableData.setSortColumn(BrowserColumnNames.NAME.getColumnName());
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
tableData.setSortColumn(sortedColumn.getText());
|
tableData.setSortColumn(sortedColumn.getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -615,8 +692,7 @@ public class BrowserTableComp extends TableComp implements IDialogClosed {
|
||||||
protected void handleTableSelection(SelectionEvent e) {
|
protected void handleTableSelection(SelectionEvent e) {
|
||||||
if (table.getSelectionCount() > 0) {
|
if (table.getSelectionCount() > 0) {
|
||||||
updateCallback.tableSelectionChanged(true);
|
updateCallback.tableSelectionChanged(true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
updateCallback.tableSelectionChanged(false);
|
updateCallback.tableSelectionChanged(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue