Initial import.

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/widgets/netcdf-basic-widgets@157580 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-10-25 17:49:38 +00:00
parent bc7291c931
commit 3f008a55a7
6 changed files with 66 additions and 75 deletions

View File

@ -70,6 +70,9 @@
height: 318px;
width: 616px !important;
resize: none;
}
.cell-word-wrap {
/* width:100%; */
word-wrap: break-word;
}

View File

@ -39,8 +39,10 @@ public interface NetCDFBasicCSS extends CssResource {
@ClassName("combo-geometry-type")
public String getComboGeometryType();
@ClassName("sample-data-text-area")
public String getSampleDataTextArea();
@ClassName("cell-word-wrap")
public String getCellWordWrap();
}

View File

@ -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;
@ -35,7 +36,7 @@ import com.google.gwt.view.client.SelectionModel;
/**
*
* @author Giancarlo Panichi
* @author Giancarlo Panichi
*
*
*/
@ -47,23 +48,20 @@ 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;
private ArrayList<VariableData> variables;
private NetCDFDataModel netCDFDataModel;
private ListDataProvider<AttributeData> attributesOfVariableProvider;
private DataGrid<AttributeData> attributesOfVariableGrid;
private SimplePager attributesOfVariablePager;
private ListDataProvider<RangeData> rangesOfVariableProvider;
private DataGrid<RangeData> rangesOfVariableGrid;
private SimplePager rangesOfVariablePager;
public DetailPanel(NetCDFDataModel netCDFDataModel) {
this.netCDFDataModel = netCDFDataModel;
@ -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,41 +102,38 @@ 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);
detailFlexTable.setHTML(2, 0, "Ranges:");
//detailFlexTable.getFlexCellFormatter().setColSpan(1, 0, 2);
rangesOfVariablePager.getElement().getStyle().setProperty("margin", "auto");
//detailFlexTable.setWidget(2, 1, attributesOfVariablePager);
VerticalPanel vpRanges=new VerticalPanel();
detailFlexTable.setWidget(1, 1, vpAttributes);
// Ranges
detailFlexTable.getFlexCellFormatter().setVerticalAlignment(2, 0, HasVerticalAlignment.ALIGN_TOP);
detailFlexTable.setHTML(2, 0, "Ranges:");
// detailFlexTable.getFlexCellFormatter().setColSpan(1, 0, 2);
rangesOfVariablePager.getElement().getStyle().setProperty("margin", "auto");
// detailFlexTable.setWidget(2, 1, attributesOfVariablePager);
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() {
refreshAttributes();
refreshRanges();
@ -157,23 +151,21 @@ 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());
attributesOfVariableProvider.refresh();
refreshAttributes();
List<RangeData> rangesOfVariable = rangesOfVariableProvider.getList();
rangesOfVariable.clear();
rangesOfVariable.addAll(variableRequested.getRanges());
rangesOfVariableProvider.refresh();
refreshRanges();
} else {
GWT.log("Variable not retrieved: "+selectedValue);
GWT.log("Variable not retrieved: " + selectedValue);
}
}
}
@ -187,15 +179,14 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
variablesBox.addItem(varData.getFullName(), String.valueOf(varData.getId()));
}
variablesBox.setEnabled(true);
//
//
attributesOfVariableProvider.addDataDisplay(attributesOfVariableGrid);
attributesOfVariableProvider.refresh();
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
@ -241,8 +233,7 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
// Initialize the columns.
initAttributesTableColumns(selectionModel, sortHandler);
}
public void refreshAttributes() {
@ -324,7 +315,7 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
// dataGrid.setColumnWidth(valuesColumn, 40, Unit.PX);
}
public Set<AttributeData> selecetedAttributes() {
@SuppressWarnings("unchecked")
Set<AttributeData> selected = ((MultiSelectionModel<AttributeData>) attributesOfVariableGrid
@ -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
@ -377,19 +368,16 @@ 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) {
//Name
private void initRangesTableColumns(SelectionModel<RangeData> selectionModel, ListHandler<RangeData> sortHandler) {
// 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
@ -456,25 +442,21 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
@Override
public int compare(RangeData o1, RangeData o2) {
return (o1.getStride() < o2.getStride()) ? -1 : ((o1.getStride() == o2.getStride()) ? 0 : 1);
}
});
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;
}
}

View File

@ -6,6 +6,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.NetCDFDetailData;
@ -29,7 +30,7 @@ import com.google.gwt.view.client.SelectionModel;
/**
*
* @author Giancarlo Panichi
* @author Giancarlo Panichi
*
*
*/
@ -140,6 +141,7 @@ public class InfoPanel extends SimplePanel implements NetCDFDataEventHandler {
globalAttributesDataGrid = new DataGrid<AttributeData>(7, AttributeData.KEY_PROVIDER);
globalAttributesDataGrid.setWidth(DATA_GRID_WIDTH);
globalAttributesDataGrid.setHeight(DATA_GRID_HEIGHT);
globalAttributesDataGrid.addStyleName(NetCDFBasicResources.INSTANCE.netCDFBasicCSS().getCellWordWrap());
/*
* Do not refresh the headers every time the data is updated. The footer

View File

@ -72,12 +72,12 @@ public class VariablesPanel extends SimplePanel implements NetCDFDataEventHandle
setWidget(netCDFPreviewFlexTable);
}
@Override
public void onNetCDFDataReady(NetCDFDataEvent event) {
// Add the CellList to the adapter in the database.
netCDFDataModel.addVariableDataDisplay(variablesDataGrid);
netCDFDataModel.addVariableDataDisplay(variablesDataGrid);
netCDFDataModel.refreshVariableDisplays();
}
@ -88,10 +88,11 @@ public class VariablesPanel extends SimplePanel implements NetCDFDataEventHandle
* key is used to identify contacts when fields (such as the name and
* address) change.
*/
variablesDataGrid = new DataGrid<VariableData>(10, VariableData.KEY_PROVIDER);
variablesDataGrid.setWidth(DATA_GRID_WIDTH);
variablesDataGrid.setHeight(DATA_GRID_HEIGHT);
variablesDataGrid.addStyleName(NetCDFBasicResources.INSTANCE.netCDFBasicCSS().getCellWordWrap());
/*
* Do not refresh the headers every time the data is updated. The footer
@ -117,20 +118,18 @@ public class VariablesPanel extends SimplePanel implements NetCDFDataEventHandle
// Add a selection model so we can select cells.
final MultiSelectionModel<VariableData> selectionModel = new MultiSelectionModel<VariableData>(
VariableData.KEY_PROVIDER);
variablesDataGrid.setSelectionModel(selectionModel, DefaultSelectionEventManager.<VariableData>createCheckboxManager());
variablesDataGrid.setSelectionModel(selectionModel,
DefaultSelectionEventManager.<VariableData>createCheckboxManager());
// Initialize the columns.
initTableColumns(selectionModel, sortHandler);
}
public void refresh(){
public void refresh() {
variablesDataGrid.redraw();
}
}
private void initTableColumns(SelectionModel<VariableData> selectionModel, ListHandler<VariableData> sortHandler) {
// Checkbox column. This table will uses a checkbox column for
// selection.

View File

@ -70,6 +70,9 @@
height: 318px;
width: 616px !important;
resize: none;
}
.cell-word-wrap {
/* width:100%; */
word-wrap: break-word;
}