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();
@ -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;
}
}

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(){
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;
}