|
|
|
@ -8,6 +8,7 @@ import java.util.Set;
|
|
|
|
|
import org.gcube.portlets.widgets.netcdfbasicwidgets.client.event.NetCDFDataEvent;
|
|
|
|
|
import org.gcube.portlets.widgets.netcdfbasicwidgets.client.event.NetCDFDataEvent.NetCDFDataEventHandler;
|
|
|
|
|
import org.gcube.portlets.widgets.netcdfbasicwidgets.client.model.NetCDFDataModel;
|
|
|
|
|
import org.gcube.portlets.widgets.netcdfbasicwidgets.client.resource.NetCDFBasicResources;
|
|
|
|
|
import org.gcube.portlets.widgets.netcdfbasicwidgets.shared.netcdf.AttributeData;
|
|
|
|
|
import org.gcube.portlets.widgets.netcdfbasicwidgets.shared.netcdf.RangeData;
|
|
|
|
|
import org.gcube.portlets.widgets.netcdfbasicwidgets.shared.netcdf.VariableData;
|
|
|
|
@ -47,8 +48,6 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
private static final String RANGE_DATA_GRID_HEIGHT = "105px";
|
|
|
|
|
private static final String RANGE_DATA_GRID_WIDTH = "608px";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final NetCDFPreviewMessages messages = GWT.create(NetCDFPreviewMessages.class);
|
|
|
|
|
|
|
|
|
|
private ListBox variablesBox;
|
|
|
|
@ -64,7 +63,6 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
private DataGrid<RangeData> rangesOfVariableGrid;
|
|
|
|
|
private SimplePager rangesOfVariablePager;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public DetailPanel(NetCDFDataModel netCDFDataModel) {
|
|
|
|
|
this.netCDFDataModel = netCDFDataModel;
|
|
|
|
|
init();
|
|
|
|
@ -84,8 +82,7 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
// Form
|
|
|
|
|
FlexTable detailFlexTable = new FlexTable();
|
|
|
|
|
detailFlexTable.setCellSpacing(2);
|
|
|
|
|
//detailFlexTable.setBorderWidth(1);
|
|
|
|
|
|
|
|
|
|
// detailFlexTable.setBorderWidth(1);
|
|
|
|
|
|
|
|
|
|
// Add a drop box with the list types
|
|
|
|
|
variablesBox = new ListBox();
|
|
|
|
@ -105,39 +102,36 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
detailFlexTable.setHTML(0, 0, "Variable:");
|
|
|
|
|
detailFlexTable.setWidget(0, 1, variablesBox);
|
|
|
|
|
|
|
|
|
|
//Attributes
|
|
|
|
|
detailFlexTable.getFlexCellFormatter().setVerticalAlignment(1, 0,HasVerticalAlignment.ALIGN_TOP);
|
|
|
|
|
// Attributes
|
|
|
|
|
detailFlexTable.getFlexCellFormatter().setVerticalAlignment(1, 0, HasVerticalAlignment.ALIGN_TOP);
|
|
|
|
|
detailFlexTable.setHTML(1, 0, "Attributes:");
|
|
|
|
|
|
|
|
|
|
attributesOfVariablePager.getElement().getStyle().setProperty("margin", "auto");
|
|
|
|
|
|
|
|
|
|
VerticalPanel vpAttributes=new VerticalPanel();
|
|
|
|
|
VerticalPanel vpAttributes = new VerticalPanel();
|
|
|
|
|
vpAttributes.getElement().getStyle().setBackgroundColor("#f8f8fb");
|
|
|
|
|
vpAttributes.add(attributesOfVariableGrid);
|
|
|
|
|
vpAttributes.add(attributesOfVariablePager);
|
|
|
|
|
|
|
|
|
|
detailFlexTable.setWidget(1, 1, vpAttributes);
|
|
|
|
|
|
|
|
|
|
//Ranges
|
|
|
|
|
detailFlexTable.getFlexCellFormatter().setVerticalAlignment(2, 0,HasVerticalAlignment.ALIGN_TOP);
|
|
|
|
|
// Ranges
|
|
|
|
|
detailFlexTable.getFlexCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP);
|
|
|
|
|
detailFlexTable.setHTML(2, 0, "Ranges:");
|
|
|
|
|
|
|
|
|
|
//detailFlexTable.getFlexCellFormatter().setColSpan(1, 0, 2);
|
|
|
|
|
// detailFlexTable.getFlexCellFormatter().setColSpan(1, 0, 2);
|
|
|
|
|
rangesOfVariablePager.getElement().getStyle().setProperty("margin", "auto");
|
|
|
|
|
//detailFlexTable.setWidget(2, 1, attributesOfVariablePager);
|
|
|
|
|
// detailFlexTable.setWidget(2, 1, attributesOfVariablePager);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VerticalPanel vpRanges=new VerticalPanel();
|
|
|
|
|
VerticalPanel vpRanges = new VerticalPanel();
|
|
|
|
|
vpRanges.getElement().getStyle().setBackgroundColor("#f8f8fb");
|
|
|
|
|
vpRanges.add(rangesOfVariableGrid);
|
|
|
|
|
vpRanges.add(rangesOfVariablePager);
|
|
|
|
|
|
|
|
|
|
detailFlexTable.setWidget(2, 1, vpRanges);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setWidget(detailFlexTable);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void refresh() {
|
|
|
|
@ -157,7 +151,7 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (variableRequested != null) {
|
|
|
|
|
GWT.log("Variable retrieved: "+variableRequested);
|
|
|
|
|
GWT.log("Variable retrieved: " + variableRequested);
|
|
|
|
|
List<AttributeData> attributesOfVariable = attributesOfVariableProvider.getList();
|
|
|
|
|
attributesOfVariable.clear();
|
|
|
|
|
attributesOfVariable.addAll(variableRequested.getAttributes());
|
|
|
|
@ -170,10 +164,8 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
rangesOfVariableProvider.refresh();
|
|
|
|
|
refreshRanges();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
GWT.log("Variable not retrieved: "+selectedValue);
|
|
|
|
|
GWT.log("Variable not retrieved: " + selectedValue);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -195,7 +187,6 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
rangesOfVariableProvider.addDataDisplay(rangesOfVariableGrid);
|
|
|
|
|
rangesOfVariableProvider.refresh();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void createAttributesOfVariableGrid() {
|
|
|
|
@ -209,6 +200,7 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
attributesOfVariableGrid = new DataGrid<AttributeData>(8, AttributeData.KEY_PROVIDER);
|
|
|
|
|
attributesOfVariableGrid.setWidth(ATTRIBUTE_DATA_GRID_WIDTH);
|
|
|
|
|
attributesOfVariableGrid.setHeight(ATTRIBUTE_DATA_GRID_HEIGHT);
|
|
|
|
|
attributesOfVariableGrid.addStyleName(NetCDFBasicResources.INSTANCE.netCDFBasicCSS().getCellWordWrap());
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Do not refresh the headers every time the data is updated. The footer
|
|
|
|
@ -242,7 +234,6 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
// Initialize the columns.
|
|
|
|
|
initAttributesTableColumns(selectionModel, sortHandler);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void refreshAttributes() {
|
|
|
|
@ -333,7 +324,6 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void createRangesOfVariableGrid() {
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
@ -345,6 +335,7 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
rangesOfVariableGrid = new DataGrid<RangeData>(8, RangeData.KEY_PROVIDER);
|
|
|
|
|
rangesOfVariableGrid.setWidth(RANGE_DATA_GRID_WIDTH);
|
|
|
|
|
rangesOfVariableGrid.setHeight(RANGE_DATA_GRID_HEIGHT);
|
|
|
|
|
rangesOfVariableGrid.addStyleName(NetCDFBasicResources.INSTANCE.netCDFBasicCSS().getCellWordWrap());
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Do not refresh the headers every time the data is updated. The footer
|
|
|
|
@ -378,18 +369,15 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
// Initialize the columns.
|
|
|
|
|
initRangesTableColumns(selectionModel, sortHandler);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void refreshRanges() {
|
|
|
|
|
rangesOfVariableGrid.redraw();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void initRangesTableColumns(SelectionModel<RangeData> selectionModel,
|
|
|
|
|
ListHandler<RangeData> sortHandler) {
|
|
|
|
|
private void initRangesTableColumns(SelectionModel<RangeData> selectionModel, ListHandler<RangeData> sortHandler) {
|
|
|
|
|
|
|
|
|
|
//Name
|
|
|
|
|
// Name
|
|
|
|
|
Column<RangeData, String> nameColum = new Column<RangeData, String>(new TextCell()) {
|
|
|
|
|
@Override
|
|
|
|
|
public String getValue(RangeData object) {
|
|
|
|
@ -425,7 +413,6 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
rangesOfVariableGrid.addColumn(nColumn, messages.columnN());
|
|
|
|
|
rangesOfVariableGrid.setColumnWidth(nColumn, 80, Unit.PX);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// First
|
|
|
|
|
Column<RangeData, String> firstColumn = new Column<RangeData, String>(new TextCell()) {
|
|
|
|
|
@Override
|
|
|
|
@ -443,7 +430,6 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
rangesOfVariableGrid.addColumn(firstColumn, messages.columnFirst());
|
|
|
|
|
rangesOfVariableGrid.setColumnWidth(firstColumn, 80, Unit.PX);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Stride
|
|
|
|
|
Column<RangeData, String> strideColumn = new Column<RangeData, String>(new TextCell()) {
|
|
|
|
|
@Override
|
|
|
|
@ -463,18 +449,14 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
|
|
|
|
|
rangesOfVariableGrid.addColumn(strideColumn, messages.columnStride());
|
|
|
|
|
// dataGrid.setColumnWidth(valuesColumn, 40, Unit.PX);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Set<RangeData> selecetedRanges() {
|
|
|
|
|
@SuppressWarnings("unchecked")
|
|
|
|
|
Set<RangeData> selected = ((MultiSelectionModel<RangeData>) rangesOfVariableGrid
|
|
|
|
|
.getSelectionModel()).getSelectedSet();
|
|
|
|
|
Set<RangeData> selected = ((MultiSelectionModel<RangeData>) rangesOfVariableGrid.getSelectionModel())
|
|
|
|
|
.getSelectedSet();
|
|
|
|
|
return selected;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|