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 8eb2bf2..538c8f9 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 @@ -38,7 +38,7 @@ public class ConstantsGeoPortalDataEntryApp { * Aug 6, 2021 */ public enum ACTION_ON_ITEM { - SHOW_ON_MAP, SHOW_METADATA, SHOW_REPORT, REMOVE + SHOW_ON_MAP, SHOW_METADATA, SHOW_REPORT, DELETE_RECORD, EDIT_RECORD } /** @@ -50,7 +50,7 @@ public class ConstantsGeoPortalDataEntryApp { */ public static enum RECORD_FIELD { NAME("name", "Name"), INTRODUCTION("introduction", "Introduction"), AUTHOR("author", "Author/s"), - PROJECT_START_END_DATE("", "Project Start/End Date"), PUBLISHING_STATUS("publishingStatus", "Publishing Status"), CREATED("created", "Created"), + PROJECT_START_END_DATE("", "Project Start/End Date"), RECORD_STATUS("recordStatus", "Published with"), CREATED("created", "Created"), CREATED_BY("createdBy", "Created by"); String jsonFieldName; 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 89b9cce..2452bd9 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 @@ -9,6 +9,7 @@ import java.util.TreeMap; import org.gcube.application.geoportalcommon.shared.GeoNaItemRef; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; +import org.gcube.application.geoportalcommon.shared.products.model.RecordDV; import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD; @@ -48,6 +49,8 @@ import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; +import com.google.gwt.event.logical.shared.ResizeEvent; +import com.google.gwt.event.logical.shared.ResizeHandler; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; @@ -89,13 +92,15 @@ public class GeoPortalDataEntryApp implements EntryPoint { private boolean projectSavedWithSuccess; + private GeonaRecordsPaginatedView grpw = null; + /** * This is the entry point method. */ public void onModuleLoad() { RECORD_FIELD[] sortByOptions = new RECORD_FIELD[] { RECORD_FIELD.NAME, RECORD_FIELD.PROJECT_START_END_DATE, - RECORD_FIELD.CREATED, RECORD_FIELD.CREATED_BY, RECORD_FIELD.PUBLISHING_STATUS }; + RECORD_FIELD.CREATED, RECORD_FIELD.CREATED_BY, RECORD_FIELD.RECORD_STATUS }; SortFilter initialSortFilter = new SortFilter(RECORD_FIELD.NAME, ORDER.ASC); @@ -126,6 +131,35 @@ public class GeoPortalDataEntryApp implements EntryPoint { bindEvents(); mainTabPanel.addFormPanel(geoNaMainForm); RootPanel.get(DIV_PORTLET_ID).add(mainTabPanel); + + Window.addResizeHandler(new ResizeHandler() { + @Override + public void onResize(ResizeEvent event) { + GWT.log("onWindowResized width: " + event.getWidth() + " height: " + event.getHeight()); + updateSize(); + } + }); + + updateSize(); + } + + /** + * Update window size + */ + public void updateSize() { + + RootPanel workspace = RootPanel.get(DIV_PORTLET_ID); + int topBorder = workspace.getAbsoluteTop(); + int footer = 85; // footer is bottombar + sponsor + int headerSize = 90; + int rootHeight = Window.getClientHeight() - topBorder - headerSize - footer;// - ((footer == + // null)?0:(footer.getOffsetHeight()-15)); + + GWT.log("New workspace dimension Height: " + rootHeight); + mainTabPanel.setInternalHeight(rootHeight); + // appController.getMainPanel().setHeight(rootHeight); + // appController.getMainPanel().setWidth(rootWidth); + } private void callGetMetadataProfiles(String scope, String secondaryType) { @@ -394,8 +428,8 @@ public class GeoPortalDataEntryApp implements EntryPoint { @Override public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) { - GeonaRecordsPaginatedView grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, - null, getListOfRecordsEvent.getSortFilter()); + grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, null, + getListOfRecordsEvent.getSortFilter()); mainTabPanel.showListOfConcessioniView(grpw); } }); @@ -403,15 +437,25 @@ public class GeoPortalDataEntryApp implements EntryPoint { appManagerBus.addHandler(ActionOnItemEvent.TYPE, new ActionOnItemEventHandler() { @Override - public void onDoActionFired(ActionOnItemEvent showItemEvent) { + public void onDoActionFired(ActionOnItemEvent showItemEvent) { + + GWT.log("Fired event: " + showItemEvent); if (showItemEvent != null) { ACTION_ON_ITEM action = showItemEvent.getAction(); List items = showItemEvent.getSelectItems(); - if (items == null) + if (items == null) { + if (grpw != null) { + items = (List) grpw.getSelectItems(); + } + } + + if (items == null || items.size() == 0) { + Window.alert("You must select a record in the table"); return; + } T item = items.get(0); @@ -461,6 +505,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { case SHOW_REPORT: final Modal modal2 = new Modal(true, true); + modal2.setTitle(concessione.getNome()); modal2.setWidth(800); modal2.setCloseVisible(true); if (concessione.getValidationReport() == null) { @@ -473,7 +518,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { modal2.show(); break; - case REMOVE: + case DELETE_RECORD: String htmlMsg = "Going to delete the project with:"; htmlMsg += "
    "; @@ -539,6 +584,7 @@ public class GeoPortalDataEntryApp implements EntryPoint { } } + }); } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEvent.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEvent.java index adad262..b1d3594 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEvent.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEvent.java @@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataentry.client.events; import java.util.List; +import org.gcube.application.geoportalcommon.shared.products.model.RecordDV; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM; import com.google.gwt.event.shared.GwtEvent; @@ -11,10 +12,10 @@ import com.google.gwt.event.shared.GwtEvent; * * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it * - * Aug 5, 2021 + * Sep 15, 2021 * @param the generic type */ -public class ActionOnItemEvent extends GwtEvent { +public class ActionOnItemEvent extends GwtEvent { public static Type TYPE = new Type(); private List selectItems; private ACTION_ON_ITEM action; @@ -23,6 +24,7 @@ public class ActionOnItemEvent extends GwtEvent { * Instantiates a new click item event. * * @param selectItems the select items + * @param doAction the do action */ public ActionOnItemEvent(List selectItems, ACTION_ON_ITEM doAction) { this.selectItems = selectItems; @@ -70,7 +72,24 @@ public class ActionOnItemEvent extends GwtEvent { return selectItems; } + /** + * Gets the action. + * + * @return the action + */ public ACTION_ON_ITEM getAction() { return action; } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("ActionOnItemEvent [selectItems="); + builder.append(selectItems); + builder.append(", action="); + builder.append(action); + builder.append("]"); + return builder.toString(); + } + } diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEventHandler.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEventHandler.java index 1aca514..b333e0b 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEventHandler.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/events/ActionOnItemEventHandler.java @@ -1,5 +1,7 @@ package org.gcube.portlets.user.geoportaldataentry.client.events; +import org.gcube.application.geoportalcommon.shared.products.model.RecordDV; + import com.google.gwt.event.shared.EventHandler; /** @@ -17,5 +19,5 @@ public interface ActionOnItemEventHandler extends EventHandler { * @param the generic type * @param showItemEvent the show item event */ - void onDoActionFired(ActionOnItemEvent showItemEvent); + void onDoActionFired(ActionOnItemEvent showItemEvent); } \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java index e2a33b7..dc5d99d 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.java @@ -1,7 +1,12 @@ package org.gcube.portlets.user.geoportaldataentry.client.ui; +import java.util.List; + +import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; +import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE; +import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent; import org.gcube.portlets.user.geoportaldataentry.client.events.CreateNewProjectEvent; import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent; import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm; @@ -33,6 +38,8 @@ import com.google.gwt.user.client.ui.Widget; */ public class GeonaMainTabPanel extends Composite { + private static final String YOU_MUST_TO_SELECT_A_PROJECT_IN_THE_TABLE = "You must to select a Project in the table"; + private static final String LABEL_FILTER_SEPARATOR = " - "; private static GeonaMainTabPanelUiBinder uiBinder = GWT.create(GeonaMainTabPanelUiBinder.class); @@ -54,6 +61,13 @@ public class GeonaMainTabPanel extends Composite { @UiField HTMLPanel geonaListOfConcessioniPanel; + /** The geona main form panel. */ + @UiField + HTMLPanel contTabNewProject; + + @UiField + HTMLPanel contTabGetListOfProjects; + /** The loader. */ @UiField LoaderIcon loader; @@ -76,12 +90,26 @@ public class GeonaMainTabPanel extends Composite { @UiField TextBox textBoxSortBy; + @UiField + NavLink navShowOnMap; + + @UiField + NavLink navShowReport; + + @UiField + NavLink navEditMode; + + @UiField + NavLink navDelete; + private HandlerManager appManagerBus; private RECORD_FIELD[] sortByFields; private SortFilter currentSortFilter; + private GeonaRecordsPaginatedView grpw = null; + /** * Instantiates a new geona main tab panel. * @@ -98,6 +126,11 @@ public class GeonaMainTabPanel extends Composite { } + public void setInternalHeight(int height) { + contTabNewProject.asWidget().setHeight(height + "px"); + contTabGetListOfProjects.asWidget().setHeight(height + "px"); + } + /** * Bind events. */ @@ -126,8 +159,7 @@ public class GeonaMainTabPanel extends Composite { @Override public void onClick(ClickEvent event) { - GeonaRecordsPaginatedView grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, - null, currentSortFilter); + grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, null, currentSortFilter); showListOfConcessioniView(grpw); } @@ -168,6 +200,60 @@ public class GeonaMainTabPanel extends Composite { }); } + navShowOnMap.addClickHandler(new ClickHandler() { + + @Override + public void onClick(ClickEvent event) { + List listConcessioni = null; + if (grpw != null && grpw.getSelectItems() != null) { + listConcessioni = grpw.getSelectItems(); + } + appManagerBus + .fireEvent(new ActionOnItemEvent(listConcessioni, ACTION_ON_ITEM.SHOW_ON_MAP)); + + } + }); + + navShowReport.addClickHandler(new ClickHandler() { + + @Override + public void onClick(ClickEvent event) { + List listConcessioni = null; + if (grpw != null && grpw.getSelectItems() != null) { + listConcessioni = grpw.getSelectItems(); + } + appManagerBus + .fireEvent(new ActionOnItemEvent(listConcessioni, ACTION_ON_ITEM.SHOW_REPORT)); + } + }); + + navEditMode.addClickHandler(new ClickHandler() { + + @Override + public void onClick(ClickEvent event) { + + List listConcessioni = null; + if (grpw != null && grpw.getSelectItems() != null) { + listConcessioni = grpw.getSelectItems(); + } + appManagerBus + .fireEvent(new ActionOnItemEvent(listConcessioni, ACTION_ON_ITEM.EDIT_RECORD)); + } + }); + + navDelete.addClickHandler(new ClickHandler() { + + @Override + public void onClick(ClickEvent event) { + List listConcessioni = null; + if (grpw != null && grpw.getSelectItems() != null) { + listConcessioni = grpw.getSelectItems(); + } + appManagerBus + .fireEvent(new ActionOnItemEvent(listConcessioni, ACTION_ON_ITEM.DELETE_RECORD)); + } + }); + } /** @@ -185,6 +271,7 @@ public class GeonaMainTabPanel extends Composite { * @param grpw the grpw */ public void showListOfConcessioniView(GeonaRecordsPaginatedView grpw) { + this.grpw = grpw; geonaListOfConcessioniPanel.clear(); VerticalPanel htmllPanel = new VerticalPanel(); htmllPanel.add(grpw.getCellPanel()); @@ -228,23 +315,21 @@ public class GeonaMainTabPanel extends Composite { * @param labelFilter the label filter * @return the sort filter */ - /*public SortFilter toSortFilter(String labelFilter) { - - String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR); - - SortFilter sortFilter = null; - try { - RECORD_FIELD recordField = RECORD_FIELD.valueOf(array[0]); - ORDER orderField = ORDER.valueOf(array[1]); - sortFilter = new SortFilter(recordField, orderField); - } catch (Exception e) { - - } - - GWT.log("Got " + sortFilter); - return sortFilter; - - }*/ + /* + * public SortFilter toSortFilter(String labelFilter) { + * + * String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR); + * + * SortFilter sortFilter = null; try { RECORD_FIELD recordField = + * RECORD_FIELD.valueOf(array[0]); ORDER orderField = ORDER.valueOf(array[1]); + * sortFilter = new SortFilter(recordField, orderField); } catch (Exception e) { + * + * } + * + * GWT.log("Got " + sortFilter); return sortFilter; + * + * } + */ public SortFilter getCurrentSortFilter() { return currentSortFilter; diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.ui.xml b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.ui.xml index 73272de..34fec38 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.ui.xml +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/client/ui/GeonaMainTabPanel.ui.xml @@ -31,6 +31,10 @@ font-size: 12px; text-align: right; } + + .max-height-300 { + max-height: auto; + } - - New Project - - Create New Project - - - -
    - Go to bottom -
    - - - -
    - Go to top -
    + + + + New Project + + Create New Project + + + +
    + Go to bottom +
    + + + +
    + Go to top +
    +
    +
    - - List of Projects - - - - - - - - - Reload Projects - - - -
    - Go to bottom -
    - - -
    - Go to top -
    + + + + List of Projects + + + + + + + + + Reload Projects + + + + + Show on Map + Show Publication Report + Edit + Delete Project + + + +
    + Go to bottom +
    + + +
    + Go to top +
    +
    +
    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 53b1659..9050724 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 @@ -23,7 +23,6 @@ import com.google.gwt.user.client.ui.MenuBar; import com.google.gwt.user.client.ui.MenuItem; import com.google.gwt.view.client.AbstractDataProvider; import com.google.gwt.view.client.AsyncDataProvider; -import com.google.gwt.view.client.DefaultSelectionEventManager; import com.google.gwt.view.client.ListDataProvider; import com.google.gwt.view.client.MultiSelectionModel; import com.google.gwt.view.client.SelectionChangeEvent; @@ -76,8 +75,7 @@ public abstract class AbstractItemsCellTable { //sortedCellTable.setStriped(true); sortedCellTable.setCondensed(true); sortedCellTable.setWidth("100%", true); - //sortedCellTable.setBordered(true); - + sortedCellTable.setAutoHeaderRefreshDisabled(true); sortedCellTable.setAutoFooterRefreshDisabled(true); @@ -85,8 +83,9 @@ public abstract class AbstractItemsCellTable { // initTable(cellTable, null, null); //sortedCellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); - DefaultSelectionEventManager checkBoxManager = DefaultSelectionEventManager. createCheckboxManager(); - sortedCellTable.setSelectionModel(theSelectionModel,checkBoxManager); +// DefaultSelectionEventManager checkBoxManager = DefaultSelectionEventManager. createCheckboxManager(); +// sortedCellTable.setSelectionModel(theSelectionModel,checkBoxManager); + sortedCellTable.setSelectionModel(theSelectionModel); theSelectionModel.addSelectionChangeHandler(new Handler() { @Override 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 91b560e..f801244 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 @@ -14,17 +14,13 @@ import org.gcube.application.geoportalcommon.ConvertToDataViewModel; import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV; import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV.ValidationStatus; -import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD; -import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent; import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter; import com.github.gwtbootstrap.client.ui.ButtonCell; import com.github.gwtbootstrap.client.ui.Pagination; -import com.github.gwtbootstrap.client.ui.constants.IconType; import com.google.gwt.cell.client.Cell.Context; import com.google.gwt.cell.client.DateCell; -import com.google.gwt.cell.client.FieldUpdater; import com.google.gwt.core.shared.GWT; import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.event.shared.HandlerManager; @@ -232,7 +228,7 @@ public class ItemsTable extends AbstractItemsCellTable< if (this.displayFields.contains(RECORD_FIELD.CREATED)) { - DateCell date = new DateCell(dtformat); + DateCell date = new DateCell(DateTimeFormat.getFormat(ConvertToDataViewModel.DATE_FORMAT+" "+ConvertToDataViewModel.TIME_FORMAT)); createdColumn = new Column(date) { @Override @@ -301,7 +297,7 @@ public class ItemsTable extends AbstractItemsCellTable< sortedCellTable.setColumnWidth(insertedBy, 220, Unit.PX); } - if (this.displayFields.contains(RECORD_FIELD.PUBLISHING_STATUS)) { + if (this.displayFields.contains(RECORD_FIELD.RECORD_STATUS)) { statusColumn = new TextColumn() { @Override @@ -335,69 +331,69 @@ public class ItemsTable extends AbstractItemsCellTable< } }; - sortedCellTable.addColumn(statusColumn, RECORD_FIELD.PUBLISHING_STATUS.getDisplayName(), false); + sortedCellTable.addColumn(statusColumn, RECORD_FIELD.RECORD_STATUS.getDisplayName(), false); sortedCellTable.setColumnWidth(statusColumn, 120, Unit.PX); } - ButtonCell showOnMapButton = new ButtonCell(); - showOnMapButton.setIcon(IconType.MAP_MARKER); - - MyToolTipColumn showOnMapColumn = new MyToolTipColumn(showOnMapButton, "Show on Map") { - - @Override - public String getValue(T object) { - return ""; - } - }; - - 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, 50, Unit.PX); - - ButtonCell showReportRecordButton = new ButtonCell(); - showReportRecordButton.setIcon(IconType.FILE_TEXT_ALT); - MyToolTipColumn showReportRecordColumn = new MyToolTipColumn(showReportRecordButton, - "Show Publication Report") { - public String getValue(T object) { - return ""; - } - }; - - showReportRecordColumn.setFieldUpdater(new FieldUpdater() { - @Override - public void update(int index, T object, String value) { - - eventBus.fireEvent(new ActionOnItemEvent(Arrays.asList(object), ACTION_ON_ITEM.SHOW_REPORT)); - } - }); - sortedCellTable.addColumn(showReportRecordColumn); - sortedCellTable.setColumnWidth(showReportRecordColumn, 50, Unit.PX); - - ButtonCell deleteRecordButton = new ButtonCell(); - deleteRecordButton.setIcon(IconType.TRASH); - MyToolTipColumn deleteRecordColumn = new MyToolTipColumn(deleteRecordButton, - "Delete Project") { - public String getValue(T object) { - return ""; - } - }; - - 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, 50, Unit.PX); +// ButtonCell showOnMapButton = new ButtonCell(); +// showOnMapButton.setIcon(IconType.MAP_MARKER); +// +// MyToolTipColumn showOnMapColumn = new MyToolTipColumn(showOnMapButton, "Show on Map") { +// +// @Override +// public String getValue(T object) { +// return ""; +// } +// }; +// +// 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, 50, Unit.PX); +// +// ButtonCell showReportRecordButton = new ButtonCell(); +// showReportRecordButton.setIcon(IconType.FILE_TEXT_ALT); +// MyToolTipColumn showReportRecordColumn = new MyToolTipColumn(showReportRecordButton, +// "Show Publication Report") { +// public String getValue(T object) { +// return ""; +// } +// }; +// +// showReportRecordColumn.setFieldUpdater(new FieldUpdater() { +// @Override +// public void update(int index, T object, String value) { +// +// eventBus.fireEvent(new ActionOnItemEvent(Arrays.asList(object), ACTION_ON_ITEM.SHOW_REPORT)); +// } +// }); +// sortedCellTable.addColumn(showReportRecordColumn); +// sortedCellTable.setColumnWidth(showReportRecordColumn, 50, Unit.PX); +// +// ButtonCell deleteRecordButton = new ButtonCell(); +// deleteRecordButton.setIcon(IconType.TRASH); +// MyToolTipColumn deleteRecordColumn = new MyToolTipColumn(deleteRecordButton, +// "Delete Project") { +// public String getValue(T object) { +// return ""; +// } +// }; +// +// deleteRecordColumn.setFieldUpdater(new FieldUpdater() { +// @Override +// public void update(int index, T object, String value) { +// +// eventBus.fireEvent(new ActionOnItemEvent(Arrays.asList(object), ACTION_ON_ITEM.DELETE_RECORD)); +// } +// }); +// sortedCellTable.addColumn(deleteRecordColumn); +// sortedCellTable.setColumnWidth(deleteRecordColumn, 50, Unit.PX); GWT.log("currentSortFilter: " + currentSortFilter); @@ -423,6 +419,11 @@ public class ItemsTable extends AbstractItemsCellTable< } } + + + public void enableWriteOperations() { + + } /** * To display authors. diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java index b2d5250..b235e07 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/GeoportalDataEntryServiceImpl.java @@ -26,7 +26,7 @@ import org.gcube.portlets.user.geoportaldataentry.client.ConcessioniFormCardTitl import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE; import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService; -import org.gcube.portlets.user.geoportaldataentry.server.ServiceUtil.ConcessioneDVValidationReportStatusComparator; +import org.gcube.portlets.user.geoportaldataentry.server.ServiceUtil.ConcessioneValidationReportStatusComparator; import org.gcube.portlets.user.geoportaldataentry.shared.CommitReport; import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject; import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig; @@ -551,7 +551,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen RECORD_FIELD orderBy = null; ORDER order = null; - ConcessioneDVValidationReportStatusComparator statusComparator = null; + ConcessioneValidationReportStatusComparator statusComparator = null; if (filter == null) { // unsorted list of records @@ -613,8 +613,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen } break; - case PUBLISHING_STATUS: - statusComparator = new ConcessioneDVValidationReportStatusComparator(); + case RECORD_STATUS: + statusComparator = new ConcessioneValidationReportStatusComparator(); default: break; } @@ -622,6 +622,21 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen // sorting with nullsLast if (comparator != null) listOfConcessioni.sort(Comparator.nullsLast(comparator)); + + //solution quick&dirty + try { + if(statusComparator!=null) { + if(order.equals(ORDER.ASC)) { + listOfConcessioni.sort(Comparator.nullsLast(statusComparator)); + } + else { + Collections.sort(listOfConcessioni, Comparator.nullsLast(Collections.reverseOrder(new ConcessioneValidationReportStatusComparator()))); + } + } + }catch (Exception e) { + LOG.warn("comparator Exception: " + e.getMessage()); + } + LOG.debug("sorted list: " + listOfConcessioni); // pagination @@ -635,13 +650,6 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen toReturnList.add(concessioneDV); } - if(statusComparator!=null) { - toReturnList.sort(statusComparator); - if (order.equals(ORDER.DESC)) { - Collections.sort(toReturnList, Collections.reverseOrder(new ConcessioneDVValidationReportStatusComparator())); - } - } - searchedData.setData(toReturnList); if (listConcessioniSize == limit || listConcessioniSize == 0) { diff --git a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/ServiceUtil.java b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/ServiceUtil.java index f0a270b..e63c458 100644 --- a/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/ServiceUtil.java +++ b/src/main/java/org/gcube/portlets/user/geoportaldataentry/server/ServiceUtil.java @@ -147,9 +147,9 @@ public class ServiceUtil { */ @Override public int compare(ConcessioneDV o1, ConcessioneDV o2) { - if (o1 == null || o1.getValidationStatus() == null) + if (o1.getValidationStatus() == null) return 1; - if (o2 == null || o2.getValidationStatus() == null) + if (o2.getValidationStatus() == null) return -1; return o1.getValidationStatus().name().compareTo(o2.getValidationStatus().name()); diff --git a/src/main/webapp/GeoPortalDataEntryApp.css b/src/main/webapp/GeoPortalDataEntryApp.css index 7545a72..0d68ffb 100644 --- a/src/main/webapp/GeoPortalDataEntryApp.css +++ b/src/main/webapp/GeoPortalDataEntryApp.css @@ -1,5 +1,11 @@ /** Add css rules here for your application. */ /** Example rules used by the template application (remove for your app) */ + +/** JUST to override the gwt-boostrap body */ +body { + padding: 0px !important; +} + h1 { font-size: 2em; font-weight: bold; @@ -64,7 +70,7 @@ h1 { overflow: hidden !important; } -.table-glor td:nth-last-child(-n+4) { +.table-glor td:nth-last-child(-n+3) { background-color: #d9edf7 !important; } @@ -72,3 +78,10 @@ h1 { height: 50%; vertical-align: middle !important; } + +.move-sticky { + position: -webkit-sticky; + position: sticky; + top: 0; + background-color: #eeeeee; +}