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

@ -43,4 +43,6 @@ public interface NetCDFBasicCSS extends CssResource {
@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;
@ -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();
@ -86,7 +84,6 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
detailFlexTable.setCellSpacing(2);
// detailFlexTable.setBorderWidth(1);
// Add a drop box with the list types
variablesBox = new ListBox();
variablesBox.setEnabled(false);
@ -126,7 +123,6 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
rangesOfVariablePager.getElement().getStyle().setProperty("margin", "auto");
// detailFlexTable.setWidget(2, 1, attributesOfVariablePager);
VerticalPanel vpRanges = new VerticalPanel();
vpRanges.getElement().getStyle().setBackgroundColor("#f8f8fb");
vpRanges.add(rangesOfVariableGrid);
@ -134,10 +130,8 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
detailFlexTable.setWidget(2, 1, vpRanges);
setWidget(detailFlexTable);
}
public void refresh() {
@ -170,8 +164,6 @@ public class DetailPanel extends SimplePanel implements NetCDFDataEventHandler {
rangesOfVariableProvider.refresh();
refreshRanges();
} else {
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,16 +369,13 @@ 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
Column<RangeData, String> nameColum = new Column<RangeData, String>(new TextCell()) {
@ -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;
}
}

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;
@ -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

@ -92,6 +92,7 @@ public class VariablesPanel extends SimplePanel implements NetCDFDataEventHandle
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() {
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;
}