|
|
|
@ -15,6 +15,7 @@ import com.google.gwt.core.client.GWT;
|
|
|
|
|
import com.google.gwt.event.shared.HandlerManager;
|
|
|
|
|
import com.google.gwt.user.cellview.client.SimplePager;
|
|
|
|
|
import com.google.gwt.user.cellview.client.SimplePager.TextLocation;
|
|
|
|
|
import com.google.gwt.user.client.Window;
|
|
|
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
|
|
|
import com.google.gwt.user.client.ui.FlowPanel;
|
|
|
|
|
import com.google.gwt.user.client.ui.Label;
|
|
|
|
@ -27,13 +28,12 @@ import com.google.gwt.view.client.Range;
|
|
|
|
|
import com.google.gwt.view.client.SelectionModel;
|
|
|
|
|
import com.google.gwt.view.client.SingleSelectionModel;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The Class GeonaRecordsPaginatedView.
|
|
|
|
|
*
|
|
|
|
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
|
|
|
|
*
|
|
|
|
|
* Aug 4, 2021
|
|
|
|
|
* Aug 4, 2021
|
|
|
|
|
*/
|
|
|
|
|
public class GeonaRecordsPaginatedView {
|
|
|
|
|
|
|
|
|
@ -50,14 +50,13 @@ public class GeonaRecordsPaginatedView {
|
|
|
|
|
private HandlerManager eventBus;
|
|
|
|
|
private RECORD_TYPE recordType;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Instantiates a new geona records paginated view.
|
|
|
|
|
*
|
|
|
|
|
* @param eventbus the eventbus
|
|
|
|
|
* @param recordType the record type
|
|
|
|
|
* @param eventbus the eventbus
|
|
|
|
|
* @param recordType the record type
|
|
|
|
|
* @param displayFields the display fields
|
|
|
|
|
* @param sortByField the sort by field
|
|
|
|
|
* @param sortByField the sort by field
|
|
|
|
|
*/
|
|
|
|
|
public GeonaRecordsPaginatedView(HandlerManager eventbus, RECORD_TYPE recordType, DISPLAY_FIELD[] displayFields,
|
|
|
|
|
DISPLAY_FIELD sortByField) {
|
|
|
|
@ -74,11 +73,11 @@ public class GeonaRecordsPaginatedView {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the asycn data provider.
|
|
|
|
|
* Gets the table data provider.
|
|
|
|
|
*
|
|
|
|
|
* @return the asycn data provider
|
|
|
|
|
* @return the table data provider
|
|
|
|
|
*/
|
|
|
|
|
public AsyncDataProvider<ConcessioneDV> getAsycnDataProvider() {
|
|
|
|
|
public AsyncDataProvider<ConcessioneDV> getTableDataProvider() {
|
|
|
|
|
return (AsyncDataProvider<ConcessioneDV>) getCellTable().getDataProvider();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -109,33 +108,6 @@ public class GeonaRecordsPaginatedView {
|
|
|
|
|
pagerPanel.add(pager);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the pager panel.
|
|
|
|
|
*
|
|
|
|
|
* @return the pager panel
|
|
|
|
|
*/
|
|
|
|
|
public VerticalPanel getCellPanel() {
|
|
|
|
|
return vPanel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the panel in loading mode.
|
|
|
|
|
*
|
|
|
|
|
* @param show the show
|
|
|
|
|
*/
|
|
|
|
|
protected void showLoading(boolean show) {
|
|
|
|
|
loadingPanel.setVisible(show);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the pager panel.
|
|
|
|
|
*
|
|
|
|
|
* @return the pager panel
|
|
|
|
|
*/
|
|
|
|
|
public FlowPanel getPagerPanel() {
|
|
|
|
|
return pagerPanel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Load new page.
|
|
|
|
|
*
|
|
|
|
@ -156,11 +128,10 @@ public class GeonaRecordsPaginatedView {
|
|
|
|
|
newStartIndex = 0;
|
|
|
|
|
serverStartIndex = 0;
|
|
|
|
|
GWT.log("Store reset performed start index is: " + newStartIndex);
|
|
|
|
|
getAsycnDataProvider().updateRowCount(ITEMS_PER_PAGE, false);
|
|
|
|
|
getTableDataProvider().updateRowCount(ITEMS_PER_PAGE, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loadItemsForStatus(newStartIndex, limit, serverStartIndex);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -192,8 +163,8 @@ public class GeonaRecordsPaginatedView {
|
|
|
|
|
msm.clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getAsycnDataProvider().updateRowCount((int) result.getTotalItems(), true);
|
|
|
|
|
getAsycnDataProvider().updateRowData(result.getClientStartIndex(), result.getData());
|
|
|
|
|
getTableDataProvider().updateRowCount((int) result.getTotalItems(), true);
|
|
|
|
|
getTableDataProvider().updateRowData(result.getClientStartIndex(), result.getData());
|
|
|
|
|
|
|
|
|
|
if (result.getData().size() == 0) {
|
|
|
|
|
getCellTable().setLoadingIndicator(new Label("No data"));
|
|
|
|
@ -207,7 +178,7 @@ public class GeonaRecordsPaginatedView {
|
|
|
|
|
|
|
|
|
|
if (result.isServerSearchFinished()) {
|
|
|
|
|
GWT.log("Search finished!!!");
|
|
|
|
|
getAsycnDataProvider().updateRowCount(getCellTable().getRowCount(), true);
|
|
|
|
|
getTableDataProvider().updateRowCount(getCellTable().getRowCount(), true);
|
|
|
|
|
}
|
|
|
|
|
// initFirstRangeChanged = false;
|
|
|
|
|
|
|
|
|
@ -216,32 +187,34 @@ public class GeonaRecordsPaginatedView {
|
|
|
|
|
/**
|
|
|
|
|
* Load items for status.
|
|
|
|
|
*
|
|
|
|
|
* @param <T> the generic type
|
|
|
|
|
* @param offset the offset
|
|
|
|
|
* @param limit the limit
|
|
|
|
|
* @param serverIndex the server index
|
|
|
|
|
* @param <T> the generic type
|
|
|
|
|
* @param newStartIndex the new start index
|
|
|
|
|
* @param limit the limit
|
|
|
|
|
* @param serverIndex the server index
|
|
|
|
|
*/
|
|
|
|
|
private <T> void loadItemsForStatus(int newStartIndex, int limit, int serverIndex) {
|
|
|
|
|
showLoading(true);
|
|
|
|
|
|
|
|
|
|
GWT.log("calling getDataForStatus with parameters [startIndex: " + newStartIndex + ", limit: " + limit
|
|
|
|
|
GWT.log("calling loadItemsForStatus with parameters [startIndex: " + newStartIndex + ", limit: " + limit
|
|
|
|
|
+ ", serverIndex:" + serverIndex + "]");
|
|
|
|
|
|
|
|
|
|
GeoPortalDataEntryApp.greetingService.getListConcessioni(newStartIndex, limit, new AsyncCallback<SearchedData>() {
|
|
|
|
|
GeoPortalDataEntryApp.greetingService.getListConcessioni(newStartIndex, limit,
|
|
|
|
|
new AsyncCallback<SearchedData>() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
showLoading(false);
|
|
|
|
|
@Override
|
|
|
|
|
public void onFailure(Throwable caught) {
|
|
|
|
|
showLoading(false);
|
|
|
|
|
Window.alert(caught.getMessage());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(SearchedData result) {
|
|
|
|
|
showLoading(false);
|
|
|
|
|
setNewPageResult(result);
|
|
|
|
|
@Override
|
|
|
|
|
public void onSuccess(SearchedData result) {
|
|
|
|
|
showLoading(false);
|
|
|
|
|
setNewPageResult(result);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -269,6 +242,9 @@ public class GeonaRecordsPaginatedView {
|
|
|
|
|
public List<ConcessioneDV> getSelectItems() {
|
|
|
|
|
return itemsTable.getSelectedItems();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// int latestRangeStart = -1;
|
|
|
|
|
// int latestRangeLenght = -1;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A custom {@link AsyncDataProvider}.
|
|
|
|
@ -293,6 +269,15 @@ public class GeonaRecordsPaginatedView {
|
|
|
|
|
|
|
|
|
|
int start = range.getStart();
|
|
|
|
|
int length = range.getLength();
|
|
|
|
|
|
|
|
|
|
// if(latestRangeStart!=start || latestRangeLenght!=length) {
|
|
|
|
|
// GWT.log("ranges really changed");
|
|
|
|
|
// latestRangeStart = start;
|
|
|
|
|
// latestRangeLenght = length;
|
|
|
|
|
// }else {
|
|
|
|
|
// GWT.log("ranges DO NOT changed");
|
|
|
|
|
// return;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (initClassFirstRangeChanged) {
|
|
|
|
|
GWT.log("initClassFirstRangeChanged is true.. returning");
|
|
|
|
@ -301,10 +286,37 @@ public class GeonaRecordsPaginatedView {
|
|
|
|
|
}
|
|
|
|
|
GWT.log("Range changed: " + start + " " + length + " visible count: " + display.getVisibleItemCount());
|
|
|
|
|
loadNewPage(start, length, false);
|
|
|
|
|
//eventBus.fireEvent(new TableRangeViewChangedEvent<T>(start, length));
|
|
|
|
|
// eventBus.fireEvent(new TableRangeViewChangedEvent<T>(start, length));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the pager panel.
|
|
|
|
|
*
|
|
|
|
|
* @return the pager panel
|
|
|
|
|
*/
|
|
|
|
|
public VerticalPanel getCellPanel() {
|
|
|
|
|
return vPanel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Set the panel in loading mode.
|
|
|
|
|
*
|
|
|
|
|
* @param show the show
|
|
|
|
|
*/
|
|
|
|
|
protected void showLoading(boolean show) {
|
|
|
|
|
loadingPanel.setVisible(show);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Gets the pager panel.
|
|
|
|
|
*
|
|
|
|
|
* @return the pager panel
|
|
|
|
|
*/
|
|
|
|
|
public FlowPanel getPagerPanel() {
|
|
|
|
|
return pagerPanel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|