fixed "Get list of Concessioni" table
This commit is contained in:
parent
b5ccba5551
commit
bd49bd6f4e
|
@ -5,17 +5,19 @@ import org.gcube.portlets.widgets.mpformbuilder.client.ConstantsMPFormBuilder;
|
|||
public class ConstantsGeoPortalDataEntryApp {
|
||||
|
||||
public static final String DATE_FORMAT = ConstantsMPFormBuilder.DATE_FORMAT;
|
||||
|
||||
|
||||
public static final String TIME_FORMAT = ConstantsMPFormBuilder.TIME_FORMAT;
|
||||
|
||||
|
||||
public static final String HOURS_MINUTES_SEPARATOR = ConstantsMPFormBuilder.HOURS_MINUTES_SEPARATOR;
|
||||
|
||||
|
||||
public static final String ERROR_ON_INIZIALITAION_STAGE_PLEASE_CONTACT_THE_SUPPORT = "Error on inizialization stage, please contact the support!";
|
||||
|
||||
|
||||
|
||||
public enum RECORD_TYPE {
|
||||
CONCESSIONE
|
||||
}
|
||||
|
||||
|
||||
public enum ACTION_ON_ITEM {
|
||||
SHOW_ON_MAP, SHOW_METADATA, REMOVE
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -132,6 +132,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
|
||||
private void buildNewCards(Collection<GeoNaFormCardModel> orderedCards) {
|
||||
projectSavedWithSuccess = false; //resetting state of saving
|
||||
mainPanel.setFormPanelVisible(true);
|
||||
mainPanel.setLoaderVisible("Loading...", true);
|
||||
resetUI();
|
||||
//ordered values
|
||||
|
@ -361,13 +362,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
|
|||
@Override
|
||||
public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) {
|
||||
|
||||
|
||||
Modal modal = new Modal(true);
|
||||
modal.setCloseVisible(true);
|
||||
GeonaRecordsPaginatedView grpw = new GeonaRecordsPaginatedView(appManagerBus,RECORD_TYPE.CONCESSIONE,null, DISPLAY_FIELD.NAME);
|
||||
modal.add(grpw.getCellPanel());
|
||||
modal.add(grpw.getPagerPanel());
|
||||
modal.show();
|
||||
mainPanel.showListOfConcessioniView(grpw);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -2,27 +2,31 @@ package org.gcube.portlets.user.geoportaldataentry.client.events;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
||||
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
|
||||
/**
|
||||
* The Class ShowItemEvent.
|
||||
* The Class ActionOnItemEvent.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jun 22, 2021
|
||||
* Aug 5, 2021
|
||||
* @param <T> the generic type
|
||||
*/
|
||||
public class ShowItemEvent<T> extends GwtEvent<ShowItemEventHandler> {
|
||||
public static Type<ShowItemEventHandler> TYPE = new Type<ShowItemEventHandler>();
|
||||
public class ActionOnItemEvent<T> extends GwtEvent<ActionOnItemEventHandler> {
|
||||
public static Type<ActionOnItemEventHandler> TYPE = new Type<ActionOnItemEventHandler>();
|
||||
private List<T> selectItems;
|
||||
private ACTION_ON_ITEM action;
|
||||
|
||||
/**
|
||||
* Instantiates a new click item event.
|
||||
*
|
||||
* @param selectItems the select items
|
||||
*/
|
||||
public ShowItemEvent(List<T> selectItems) {
|
||||
public ActionOnItemEvent(List<T> selectItems, ACTION_ON_ITEM doAction) {
|
||||
this.selectItems = selectItems;
|
||||
this.action = doAction;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,7 +40,7 @@ public class ShowItemEvent<T> extends GwtEvent<ShowItemEventHandler> {
|
|||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||
*/
|
||||
@Override
|
||||
public Type<ShowItemEventHandler> getAssociatedType() {
|
||||
public Type<ActionOnItemEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
|
@ -53,8 +57,8 @@ public class ShowItemEvent<T> extends GwtEvent<ShowItemEventHandler> {
|
|||
* EventHandler)
|
||||
*/
|
||||
@Override
|
||||
protected void dispatch(ShowItemEventHandler handler) {
|
||||
handler.onShowItemClicked(this);
|
||||
protected void dispatch(ActionOnItemEventHandler handler) {
|
||||
handler.onDoActionFired(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -65,4 +69,8 @@ public class ShowItemEvent<T> extends GwtEvent<ShowItemEventHandler> {
|
|||
public List<T> getSelectItems() {
|
||||
return selectItems;
|
||||
}
|
||||
|
||||
public ACTION_ON_ITEM getAction() {
|
||||
return action;
|
||||
}
|
||||
}
|
|
@ -2,22 +2,20 @@ package org.gcube.portlets.user.geoportaldataentry.client.events;
|
|||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
|
||||
|
||||
// TODO: Auto-generated Javadoc
|
||||
/**
|
||||
* The Interface ShowItemEventHandler.
|
||||
* The Interface ActionOnItemEventHandler.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||
*
|
||||
* Jun 22, 2021
|
||||
* Aug 5, 2021
|
||||
*/
|
||||
public interface ShowItemEventHandler extends EventHandler {
|
||||
public interface ActionOnItemEventHandler extends EventHandler {
|
||||
|
||||
/**
|
||||
* On show item clicked.
|
||||
* On do action fired.
|
||||
*
|
||||
* @param <T> the generic type
|
||||
* @param <T> the generic type
|
||||
* @param showItemEvent the show item event
|
||||
*/
|
||||
<T> void onShowItemClicked(ShowItemEvent<T> showItemEvent);
|
||||
<T> void onDoActionFired(ActionOnItemEvent<T> showItemEvent);
|
||||
}
|
|
@ -9,6 +9,7 @@ import com.google.gwt.uibinder.client.UiBinder;
|
|||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
|
@ -16,19 +17,22 @@ import com.google.gwt.user.client.ui.Widget;
|
|||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Oct 13, 2020
|
||||
* Oct 13, 2020
|
||||
*/
|
||||
public class GeonaMainPanel extends Composite {
|
||||
|
||||
|
||||
/** The geona main form panel. */
|
||||
@UiField
|
||||
HTMLPanel geonaMainFormPanel;
|
||||
|
||||
|
||||
@UiField
|
||||
HTMLPanel geonaListOfConcessioniPanel;
|
||||
|
||||
/** The loader. */
|
||||
@UiField
|
||||
LoaderIcon loader;
|
||||
|
||||
@UiField
|
||||
|
||||
@UiField
|
||||
GeonaNavigationBar geonaNavigationBar;
|
||||
|
||||
private HandlerManager appManagerBus;
|
||||
|
@ -41,40 +45,57 @@ public class GeonaMainPanel extends Composite {
|
|||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Oct 13, 2020
|
||||
* Oct 13, 2020
|
||||
*/
|
||||
interface GeonaMainPanelUiBinder extends UiBinder<Widget, GeonaMainPanel> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new geona main panel.
|
||||
* @param appManagerBus
|
||||
*
|
||||
* @param appManagerBus
|
||||
*/
|
||||
public GeonaMainPanel(HandlerManager appManagerBus) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.appManagerBus = appManagerBus;
|
||||
geonaNavigationBar.setAppManagerBus(appManagerBus);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds the form panel.
|
||||
*
|
||||
* @param formPanel the form panel
|
||||
*/
|
||||
public void addFormPanel(GeonaDataEntryMainForm formPanel) {
|
||||
geonaListOfConcessioniPanel.setVisible(false);
|
||||
geonaMainFormPanel.add(formPanel);
|
||||
geonaMainFormPanel.setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void showListOfConcessioniView(GeonaRecordsPaginatedView grpw) {
|
||||
setFormPanelVisible(false);
|
||||
geonaListOfConcessioniPanel.clear();
|
||||
VerticalPanel htmllPanel = new VerticalPanel();
|
||||
htmllPanel.add(grpw.getCellPanel());
|
||||
htmllPanel.add(grpw.getPagerPanel());
|
||||
geonaListOfConcessioniPanel.add(htmllPanel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the loader visible.
|
||||
*
|
||||
* @param txtHTML the txt HTML
|
||||
* @param visible the visible
|
||||
*/
|
||||
public void setLoaderVisible(String txtHTML, boolean visible){
|
||||
public void setLoaderVisible(String txtHTML, boolean visible) {
|
||||
loader.setText(txtHTML);
|
||||
loader.setVisible(visible);
|
||||
}
|
||||
|
||||
public void setFormPanelVisible(boolean bool) {
|
||||
geonaMainFormPanel.setVisible(bool);
|
||||
geonaListOfConcessioniPanel.setVisible(!bool);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,5 +23,6 @@
|
|||
<m:GeonaNavigationBar ui:field="geonaNavigationBar"></m:GeonaNavigationBar>
|
||||
<r:LoaderIcon ui:field="loader"></r:LoaderIcon>
|
||||
<g:HTMLPanel ui:field="geonaMainFormPanel"></g:HTMLPanel>
|
||||
<g:HTMLPanel ui:field="geonaListOfConcessioniPanel" visible="false"></g:HTMLPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -71,11 +71,16 @@ public abstract class AbstractItemsCellTable<T> {
|
|||
this.fireEventOnClick = fireOnClick;
|
||||
this.theSelectionModel = selectionModel;
|
||||
sortedCellTable = new SortedCellTable<T>(pageSize, dataProvider);
|
||||
// sortedCellTable.addStyleName("table-cms-widget");
|
||||
// sortedCellTable.addStyleName("table-cms-widget-vertical-middle");
|
||||
sortedCellTable.addStyleName("table-glor");
|
||||
sortedCellTable.addStyleName("table-glor-vertical-middle");
|
||||
sortedCellTable.setStriped(true);
|
||||
sortedCellTable.setCondensed(true);
|
||||
sortedCellTable.setWidth("100%", true);
|
||||
//sortedCellTable.setBordered(true);
|
||||
|
||||
sortedCellTable.setAutoHeaderRefreshDisabled(true);
|
||||
sortedCellTable.setAutoFooterRefreshDisabled(true);
|
||||
|
||||
// dataProvider.addDataDisplay(sortedCellTable);
|
||||
// initTable(cellTable, null, null);
|
||||
//sortedCellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
|
||||
|
|
|
@ -12,7 +12,8 @@ import java.util.Set;
|
|||
|
||||
import org.gcube.application.geoportalcommon.ConvertToDataViewModel;
|
||||
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ShowItemEvent;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
|
||||
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Pagination;
|
||||
import com.google.gwt.cell.client.ButtonCell;
|
||||
|
@ -63,7 +64,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Feb 1, 2016
|
||||
*/
|
||||
public static enum DISPLAY_FIELD {
|
||||
NAME, INTRO, AUTHOR, PROJECT_START_DATE, PROJECT_END_DATE
|
||||
NAME, INTRO, AUTHOR, PROJECT_START_DATE, PROJECT_END_DATE, INSERTED_BY
|
||||
};
|
||||
|
||||
private List<DISPLAY_FIELD> displayFields;
|
||||
|
@ -71,6 +72,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
private Column<T, Date> endProjectDateColumn;
|
||||
private DISPLAY_FIELD startSortByColumn;
|
||||
private boolean isAsyncronusTable;
|
||||
private TextColumn<T> insertedBy;
|
||||
|
||||
/**
|
||||
* Instantiates a new items table.
|
||||
|
@ -130,23 +132,6 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
// sortedCellTable.addColumn(checkColumn, "", false);
|
||||
// sortedCellTable.setColumnWidth(checkColumn, 40, Unit.PX);
|
||||
|
||||
ButtonCell previewButton = new ButtonCell();
|
||||
Column<T, String> showdItemColumn = new Column<T, String>(previewButton) {
|
||||
public String getValue(T object) {
|
||||
return "Show";
|
||||
}
|
||||
};
|
||||
|
||||
showdItemColumn.setFieldUpdater(new FieldUpdater<T, String>() {
|
||||
@Override
|
||||
public void update(int index, T object, String value) {
|
||||
GWT.log("clicked show");
|
||||
eventBus.fireEvent(new ShowItemEvent<T>(Arrays.asList(object)));
|
||||
}
|
||||
});
|
||||
sortedCellTable.addColumn(showdItemColumn);
|
||||
sortedCellTable.setColumnWidth(showdItemColumn, 80, Unit.PX);
|
||||
|
||||
if (this.displayFields.contains(DISPLAY_FIELD.NAME)) {
|
||||
|
||||
// NAME
|
||||
|
@ -197,7 +182,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
}
|
||||
};
|
||||
|
||||
sortedCellTable.addColumn(introduction, "Intro", true);
|
||||
sortedCellTable.addColumn(introduction, "Introduction", true);
|
||||
|
||||
if (!isAsyncronusTable) {
|
||||
Comparator<T> c = new Comparator<T>() {
|
||||
|
@ -209,6 +194,8 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
sortedCellTable.setComparator(introduction, c);
|
||||
}
|
||||
|
||||
// sortedCellTable.setColumnWidth(introduction, 100, Unit.PCT);
|
||||
|
||||
}
|
||||
|
||||
if (this.displayFields.contains(DISPLAY_FIELD.AUTHOR)) {
|
||||
|
@ -238,6 +225,8 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
sortedCellTable.setComparator(author, c);
|
||||
}
|
||||
|
||||
sortedCellTable.setColumnWidth(author, 220, Unit.PX);
|
||||
|
||||
}
|
||||
|
||||
if (this.displayFields.contains(DISPLAY_FIELD.PROJECT_START_DATE)) {
|
||||
|
@ -280,6 +269,8 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
sortedCellTable.setComparator(startProjectDateColumn, c);
|
||||
}
|
||||
|
||||
sortedCellTable.setColumnWidth(startProjectDateColumn, 150, Unit.PX);
|
||||
|
||||
}
|
||||
|
||||
if (this.displayFields.contains(DISPLAY_FIELD.PROJECT_END_DATE)) {
|
||||
|
@ -322,8 +313,71 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
|
|||
sortedCellTable.setComparator(endProjectDateColumn, c);
|
||||
}
|
||||
|
||||
sortedCellTable.setColumnWidth(endProjectDateColumn, 150, Unit.PX);
|
||||
|
||||
}
|
||||
|
||||
if (this.displayFields.contains(DISPLAY_FIELD.INSERTED_BY)) {
|
||||
|
||||
// NAME
|
||||
insertedBy = new TextColumn<T>() {
|
||||
@Override
|
||||
public String getValue(T object) {
|
||||
if (object == null)
|
||||
return "";
|
||||
return ((ConcessioneDV) object).getCreationUser();
|
||||
}
|
||||
};
|
||||
|
||||
sortedCellTable.addColumn(insertedBy, "Inserted by", true);
|
||||
|
||||
if (!isAsyncronusTable) {
|
||||
Comparator<T> c = new Comparator<T>() {
|
||||
@Override
|
||||
public int compare(T o1, T o2) {
|
||||
return ((ConcessioneDV) o1).getCreationUser().compareTo(((ConcessioneDV) o2).getCreationUser());
|
||||
}
|
||||
};
|
||||
|
||||
sortedCellTable.setComparator(insertedBy, c);
|
||||
}
|
||||
sortedCellTable.setColumnWidth(insertedBy, 220, Unit.PX);
|
||||
}
|
||||
|
||||
ButtonCell showOnMapButton = new ButtonCell();
|
||||
Column<T, String> showOnMapColumn = new Column<T, String>(showOnMapButton) {
|
||||
public String getValue(T object) {
|
||||
return "Show on Map";
|
||||
}
|
||||
};
|
||||
|
||||
showOnMapColumn.setFieldUpdater(new FieldUpdater<T, String>() {
|
||||
@Override
|
||||
public void update(int index, T object, String value) {
|
||||
GWT.log("clicked show");
|
||||
eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.SHOW_ON_MAP));
|
||||
}
|
||||
});
|
||||
sortedCellTable.addColumn(showOnMapColumn);
|
||||
sortedCellTable.setColumnWidth(showOnMapColumn, 120, Unit.PX);
|
||||
|
||||
ButtonCell deleteRecordButton = new ButtonCell();
|
||||
Column<T, String> deleteRecordColumn = new Column<T, String>(deleteRecordButton) {
|
||||
public String getValue(T object) {
|
||||
return "Delete";
|
||||
}
|
||||
};
|
||||
|
||||
deleteRecordColumn.setFieldUpdater(new FieldUpdater<T, String>() {
|
||||
@Override
|
||||
public void update(int index, T object, String value) {
|
||||
|
||||
eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.REMOVE));
|
||||
}
|
||||
});
|
||||
sortedCellTable.addColumn(deleteRecordColumn);
|
||||
sortedCellTable.setColumnWidth(deleteRecordColumn, 80, Unit.PX);
|
||||
|
||||
GWT.log("startSortByColumn: " + startSortByColumn);
|
||||
|
||||
if (startSortByColumn != null)
|
||||
|
|
|
@ -122,8 +122,9 @@ public class SortedCellTable<T> extends CellTable<T> {
|
|||
addColumnSortHandler(listSortHandler);
|
||||
columnSortHandler = listSortHandler;
|
||||
} else if (this.dataProvider instanceof AsyncDataProvider) {
|
||||
//AsyncDataProvider asyncDataProvider = ((AsyncDataProvider) this.dataProvider);
|
||||
//asyncDataProvider.get
|
||||
// AsyncDataProvider asyncDataProvider = ((AsyncDataProvider)
|
||||
// this.dataProvider);
|
||||
// asyncDataProvider.get
|
||||
AsyncHandler asyncSortHandler = new AsyncHandler(this) {
|
||||
@Override
|
||||
public void onColumnSort(ColumnSortEvent event) {
|
||||
|
@ -162,7 +163,7 @@ public class SortedCellTable<T> extends CellTable<T> {
|
|||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// addColumnSortHandler(asyncSortHandler);
|
||||
// columnSortHandler = asyncSortHandler;
|
||||
}
|
||||
|
@ -229,16 +230,16 @@ public class SortedCellTable<T> extends CellTable<T> {
|
|||
|
||||
initialSortColumn = column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the comparator used to sort the specified column in ascending order.
|
||||
*
|
||||
* @param column the {@link Column}
|
||||
* @param comparator the {@link Comparator} to use for the {@link Column}
|
||||
*/
|
||||
public void setComparator(Column<T, ?> column, Comparator<T> comparator) {
|
||||
comparators.put(column, comparator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the comparator used to sort the specified column in ascending order.
|
||||
*
|
||||
* @param column the {@link Column}
|
||||
* @param comparator the {@link Comparator} to use for the {@link Column}
|
||||
*/
|
||||
public void setComparator(Column<T, ?> column, Comparator<T> comparator) {
|
||||
comparators.put(column, comparator);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the sort order to use when this column is clicked and it was not
|
||||
|
@ -283,7 +284,8 @@ public class SortedCellTable<T> extends CellTable<T> {
|
|||
});
|
||||
// Might as well get the little arrow on the header to make it
|
||||
// official
|
||||
getColumnSortList().push(new ColumnSortInfo(initialSortColumn, defaultSortOrderMap.get(initialSortColumn)));
|
||||
getColumnSortList()
|
||||
.push(new ColumnSortInfo(initialSortColumn, defaultSortOrderMap.get(initialSortColumn)));
|
||||
|
||||
currentlySortedColumn = initialSortColumn;
|
||||
}
|
||||
|
|
|
@ -52,4 +52,23 @@ h1 {
|
|||
|
||||
.my-html-table td:first-child {
|
||||
color: gray;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*** TABLE GET LIST OF RECORDS***/
|
||||
.table-glor {
|
||||
word-wrap: break-word;
|
||||
}
|
||||
|
||||
.table-glor td, th {
|
||||
overflow: hidden !important;
|
||||
}
|
||||
|
||||
.table-glor th {
|
||||
/*text-align: center !important;*/
|
||||
}
|
||||
|
||||
.table-glor-vertical-middle td, th {
|
||||
height: 50%;
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue