From bd49bd6f4e90466ab19ea7f28df7fa905a5e4585 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Thu, 5 Aug 2021 11:21:39 +0200 Subject: [PATCH] fixed "Get list of Concessioni" table --- .../ConstantsGeoPortalDataEntryApp.java | 14 +- .../client/GeoPortalDataEntryApp.java | 8 +- ...wItemEvent.java => ActionOnItemEvent.java} | 24 ++-- ...ler.java => ActionOnItemEventHandler.java} | 14 +- .../client/ui/GeonaMainPanel.java | 43 ++++-- .../client/ui/GeonaMainPanel.ui.xml | 1 + .../client/ui/GeonaRecordsPaginatedView.java | 128 ++++++++++-------- .../ui/table/AbstractItemsCellTable.java | 9 +- .../client/ui/table/ItemsTable.java | 94 ++++++++++--- .../client/ui/table/SortedCellTable.java | 30 ++-- src/main/webapp/GeoPortalDataEntryApp.css | 21 ++- 11 files changed, 252 insertions(+), 134 deletions(-) rename src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/{ShowItemEvent.java => ActionOnItemEvent.java} (59%) rename src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/{ShowItemEventHandler.java => ActionOnItemEventHandler.java} (50%) diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java index 7076afb..be14eb4 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ConstantsGeoPortalDataEntryApp.java @@ -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 + } + } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java index 815d042..7bac626 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/GeoPortalDataEntryApp.java @@ -132,6 +132,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { private void buildNewCards(Collection 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); } }); } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ShowItemEvent.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEvent.java similarity index 59% rename from src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ShowItemEvent.java rename to src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEvent.java index fe6afc3..adad262 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ShowItemEvent.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEvent.java @@ -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 the generic type */ -public class ShowItemEvent extends GwtEvent { - public static Type TYPE = new Type(); +public class ActionOnItemEvent extends GwtEvent { + public static Type TYPE = new Type(); private List selectItems; + private ACTION_ON_ITEM action; /** * Instantiates a new click item event. * * @param selectItems the select items */ - public ShowItemEvent(List selectItems) { + public ActionOnItemEvent(List selectItems, ACTION_ON_ITEM doAction) { this.selectItems = selectItems; + this.action = doAction; } /** @@ -36,7 +40,7 @@ public class ShowItemEvent extends GwtEvent { * @see com.google.gwt.event.shared.GwtEvent#getAssociatedType() */ @Override - public Type getAssociatedType() { + public Type getAssociatedType() { return TYPE; } @@ -53,8 +57,8 @@ public class ShowItemEvent extends GwtEvent { * 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 extends GwtEvent { public List getSelectItems() { return selectItems; } + + public ACTION_ON_ITEM getAction() { + return action; + } } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ShowItemEventHandler.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEventHandler.java similarity index 50% rename from src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ShowItemEventHandler.java rename to src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEventHandler.java index 7713908..1aca514 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ShowItemEventHandler.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEventHandler.java @@ -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 the generic type + * @param the generic type * @param showItemEvent the show item event */ - void onShowItemClicked(ShowItemEvent showItemEvent); + void onDoActionFired(ActionOnItemEvent showItemEvent); } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.java index c3b1db6..652b6bb 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.java @@ -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 { } /** * 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); + + } + } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.ui.xml index b8af370..bec763b 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainPanel.ui.xml @@ -23,5 +23,6 @@ + \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaRecordsPaginatedView.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaRecordsPaginatedView.java index 010307d..8739d92 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaRecordsPaginatedView.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaRecordsPaginatedView.java @@ -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 getAsycnDataProvider() { + public AsyncDataProvider getTableDataProvider() { return (AsyncDataProvider) 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 the generic type - * @param offset the offset - * @param limit the limit - * @param serverIndex the server index + * @param the generic type + * @param newStartIndex the new start index + * @param limit the limit + * @param serverIndex the server index */ private 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() { + GeoPortalDataEntryApp.greetingService.getListConcessioni(newStartIndex, limit, + new AsyncCallback() { - @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 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(start, length)); + // eventBus.fireEvent(new TableRangeViewChangedEvent(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; + } + } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/AbstractItemsCellTable.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/AbstractItemsCellTable.java index 37d50b5..47b11e8 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/AbstractItemsCellTable.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/AbstractItemsCellTable.java @@ -71,11 +71,16 @@ public abstract class AbstractItemsCellTable { this.fireEventOnClick = fireOnClick; this.theSelectionModel = selectionModel; sortedCellTable = new SortedCellTable(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); diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java index 4b8f96c..c226a1b 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/ItemsTable.java @@ -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 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 displayFields; @@ -71,6 +72,7 @@ public class ItemsTable extends AbstractItemsCellTable< private Column endProjectDateColumn; private DISPLAY_FIELD startSortByColumn; private boolean isAsyncronusTable; + private TextColumn insertedBy; /** * Instantiates a new items table. @@ -130,23 +132,6 @@ public class ItemsTable extends AbstractItemsCellTable< // sortedCellTable.addColumn(checkColumn, "", false); // sortedCellTable.setColumnWidth(checkColumn, 40, Unit.PX); - ButtonCell previewButton = new ButtonCell(); - Column showdItemColumn = new Column(previewButton) { - public String getValue(T object) { - return "Show"; - } - }; - - showdItemColumn.setFieldUpdater(new FieldUpdater() { - @Override - public void update(int index, T object, String value) { - GWT.log("clicked show"); - eventBus.fireEvent(new ShowItemEvent(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 extends AbstractItemsCellTable< } }; - sortedCellTable.addColumn(introduction, "Intro", true); + sortedCellTable.addColumn(introduction, "Introduction", true); if (!isAsyncronusTable) { Comparator c = new Comparator() { @@ -209,6 +194,8 @@ public class ItemsTable 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 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 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 extends AbstractItemsCellTable< sortedCellTable.setComparator(endProjectDateColumn, c); } + sortedCellTable.setColumnWidth(endProjectDateColumn, 150, Unit.PX); + } + if (this.displayFields.contains(DISPLAY_FIELD.INSERTED_BY)) { + + // NAME + insertedBy = new TextColumn() { + @Override + public String getValue(T object) { + if (object == null) + return ""; + return ((ConcessioneDV) object).getCreationUser(); + } + }; + + sortedCellTable.addColumn(insertedBy, "Inserted by", true); + + if (!isAsyncronusTable) { + Comparator c = new Comparator() { + @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 showOnMapColumn = new Column(showOnMapButton) { + public String getValue(T object) { + return "Show on Map"; + } + }; + + showOnMapColumn.setFieldUpdater(new FieldUpdater() { + @Override + public void update(int index, T object, String value) { + GWT.log("clicked show"); + eventBus.fireEvent(new ActionOnItemEvent(Arrays.asList(object), ACTION_ON_ITEM.SHOW_ON_MAP)); + } + }); + sortedCellTable.addColumn(showOnMapColumn); + sortedCellTable.setColumnWidth(showOnMapColumn, 120, Unit.PX); + + ButtonCell deleteRecordButton = new ButtonCell(); + Column deleteRecordColumn = new Column(deleteRecordButton) { + public String getValue(T object) { + return "Delete"; + } + }; + + deleteRecordColumn.setFieldUpdater(new FieldUpdater() { + @Override + public void update(int index, T object, String value) { + + eventBus.fireEvent(new ActionOnItemEvent(Arrays.asList(object), ACTION_ON_ITEM.REMOVE)); + } + }); + sortedCellTable.addColumn(deleteRecordColumn); + sortedCellTable.setColumnWidth(deleteRecordColumn, 80, Unit.PX); + GWT.log("startSortByColumn: " + startSortByColumn); if (startSortByColumn != null) diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/SortedCellTable.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/SortedCellTable.java index 66f82d1..ffefe5d 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/SortedCellTable.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/table/SortedCellTable.java @@ -122,8 +122,9 @@ public class SortedCellTable extends CellTable { 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 extends CellTable { } } }; - + // addColumnSortHandler(asyncSortHandler); // columnSortHandler = asyncSortHandler; } @@ -229,16 +230,16 @@ public class SortedCellTable extends CellTable { 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 column, Comparator 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 column, Comparator 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 extends CellTable { }); // 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; } diff --git a/src/main/webapp/GeoPortalDataEntryApp.css b/src/main/webapp/GeoPortalDataEntryApp.css index 9a6b935..f73fa16 100644 --- a/src/main/webapp/GeoPortalDataEntryApp.css +++ b/src/main/webapp/GeoPortalDataEntryApp.css @@ -52,4 +52,23 @@ h1 { .my-html-table td:first-child { color: gray; -} \ No newline at end of file +} + + +/*** 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; +}