fixing NavBar with actions for "List of Project"

pull/4/head
Francesco Mangiacrapa 3 years ago
parent 8a74c1f0d0
commit 1bcd52cc94

@ -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;

@ -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 <T> void onDoActionFired(ActionOnItemEvent<T> showItemEvent) {
public <T extends RecordDV> void onDoActionFired(ActionOnItemEvent<T> showItemEvent) {
GWT.log("Fired event: " + showItemEvent);
if (showItemEvent != null) {
ACTION_ON_ITEM action = showItemEvent.getAction();
List<T> items = showItemEvent.getSelectItems();
if (items == null)
if (items == null) {
if (grpw != null) {
items = (List<T>) 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 += "<ul>";
@ -539,6 +584,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
}
}
});
}

@ -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 <T> the generic type
*/
public class ActionOnItemEvent<T> extends GwtEvent<ActionOnItemEventHandler> {
public class ActionOnItemEvent<T extends RecordDV> extends GwtEvent<ActionOnItemEventHandler> {
public static Type<ActionOnItemEventHandler> TYPE = new Type<ActionOnItemEventHandler>();
private List<T> selectItems;
private ACTION_ON_ITEM action;
@ -23,6 +24,7 @@ public class ActionOnItemEvent<T> extends GwtEvent<ActionOnItemEventHandler> {
* Instantiates a new click item event.
*
* @param selectItems the select items
* @param doAction the do action
*/
public ActionOnItemEvent(List<T> selectItems, ACTION_ON_ITEM doAction) {
this.selectItems = selectItems;
@ -70,7 +72,24 @@ public class ActionOnItemEvent<T> extends GwtEvent<ActionOnItemEventHandler> {
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();
}
}

@ -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 <T> the generic type
* @param showItemEvent the show item event
*/
<T> void onDoActionFired(ActionOnItemEvent<T> showItemEvent);
<T extends RecordDV> void onDoActionFired(ActionOnItemEvent<T> showItemEvent);
}

@ -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<ConcessioneDV> listConcessioni = null;
if (grpw != null && grpw.getSelectItems() != null) {
listConcessioni = grpw.getSelectItems();
}
appManagerBus
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.SHOW_ON_MAP));
}
});
navShowReport.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<ConcessioneDV> listConcessioni = null;
if (grpw != null && grpw.getSelectItems() != null) {
listConcessioni = grpw.getSelectItems();
}
appManagerBus
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.SHOW_REPORT));
}
});
navEditMode.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<ConcessioneDV> listConcessioni = null;
if (grpw != null && grpw.getSelectItems() != null) {
listConcessioni = grpw.getSelectItems();
}
appManagerBus
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(listConcessioni, ACTION_ON_ITEM.EDIT_RECORD));
}
});
navDelete.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
List<ConcessioneDV> listConcessioni = null;
if (grpw != null && grpw.getSelectItems() != null) {
listConcessioni = grpw.getSelectItems();
}
appManagerBus
.fireEvent(new ActionOnItemEvent<ConcessioneDV>(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;

@ -31,6 +31,10 @@
font-size: 12px;
text-align: right;
}
.max-height-300 {
max-height: auto;
}
</ui:style>
<g:HTMLPanel>
<b:PageHeader subtext="data entry facility"
@ -38,50 +42,70 @@
<b:TabPanel tabPosition="top" ui:field="tabPanel">
<b:Tab icon="FILE_TEXT" heading="New Project" active="true"
ui:field="tabNewProject">
<b:Navbar>
<b:Brand addStyleNames="{style.margin-top-5}">New Project</b:Brand>
<b:Nav>
<b:NavLink ui:field="buttCreateNewProject"
title="Create a new Project" icon="FILE">Create New Project</b:NavLink>
</b:Nav>
</b:Navbar>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="topPage"></div>
<a href="#bottomPage">Go to bottom</a>
</g:HTMLPanel>
<r:LoaderIcon ui:field="loader"></r:LoaderIcon>
<g:HTMLPanel ui:field="geonaMainFormPanel"></g:HTMLPanel>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="bottomPage"></div>
<a href="#topPage">Go to top</a>
</g:HTMLPanel>
<g:ScrollPanel>
<g:HTMLPanel ui:field="contTabNewProject">
<b:Navbar>
<b:Brand addStyleNames="{style.margin-top-5}">New Project</b:Brand>
<b:Nav>
<b:NavLink ui:field="buttCreateNewProject"
title="Create a new Project" icon="FILE">Create New Project</b:NavLink>
</b:Nav>
</b:Navbar>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="topPage"></div>
<a href="#bottomPage">Go to bottom</a>
</g:HTMLPanel>
<r:LoaderIcon ui:field="loader"></r:LoaderIcon>
<g:HTMLPanel ui:field="geonaMainFormPanel"></g:HTMLPanel>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="bottomPage"></div>
<a href="#topPage">Go to top</a>
</g:HTMLPanel>
</g:HTMLPanel>
</g:ScrollPanel>
</b:Tab>
<b:Tab icon="TABLE" heading="List of Projects"
ui:field="tabGetListOfProjects">
<b:Navbar>
<b:Brand addStyleNames="{style.margin-top-5}">List of Projects</b:Brand>
<b:Nav>
<b:Dropdown text="Sort by" ui:field="dropdownSortBy">
</b:Dropdown>
</b:Nav>
<b:Nav>
<b:TextBox ui:field="textBoxSortBy" readOnly="true"
addStyleNames="{style.margin-top-8}"></b:TextBox>
</b:Nav>
<b:Nav>
<b:NavLink ui:field="buttonReloadConcessioni"
title="Create a new Project" icon="ROTATE_RIGHT">Reload Projects</b:NavLink>
</b:Nav>
</b:Navbar>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="topPage2"></div>
<a href="#bottomPage2">Go to bottom</a>
</g:HTMLPanel>
<g:HTMLPanel ui:field="geonaListOfConcessioniPanel"></g:HTMLPanel>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="bottomPage2"></div>
<a href="#topPage2">Go to top</a>
</g:HTMLPanel>
<g:ScrollPanel>
<g:HTMLPanel ui:field="contTabGetListOfProjects">
<b:Navbar>
<b:Brand addStyleNames="{style.margin-top-5}">List of Projects</b:Brand>
<b:Nav>
<b:Dropdown text="Sort by" ui:field="dropdownSortBy">
</b:Dropdown>
</b:Nav>
<b:Nav>
<b:TextBox ui:field="textBoxSortBy" readOnly="true"
addStyleNames="{style.margin-top-8}"></b:TextBox>
</b:Nav>
<b:Nav>
<b:NavLink ui:field="buttonReloadConcessioni"
title="Create a new Project" icon="ROTATE_RIGHT">Reload Projects</b:NavLink>
</b:Nav>
</b:Navbar>
<g:FlowPanel addStyleNames="move-sticky">
<b:NavPills>
<b:NavLink ui:field="navShowOnMap" title="Show on Map"
icon="MAP_MARKER">Show on Map</b:NavLink>
<b:NavLink ui:field="navShowReport"
title="Show Publication Report" icon="FILE_TEXT_ALT">Show Publication Report</b:NavLink>
<b:NavLink ui:field="navEditMode" title="Edit"
icon="PENCIL">Edit</b:NavLink>
<b:NavLink ui:field="navDelete" title="Delete Project"
icon="TRASH">Delete Project</b:NavLink>
</b:NavPills>
</g:FlowPanel>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="topPage2"></div>
<a href="#bottomPage2">Go to bottom</a>
</g:HTMLPanel>
<g:HTMLPanel ui:field="geonaListOfConcessioniPanel"></g:HTMLPanel>
<g:HTMLPanel addStyleNames="{style.float-right}">
<div id="bottomPage2"></div>
<a href="#topPage2">Go to top</a>
</g:HTMLPanel>
</g:HTMLPanel>
</g:ScrollPanel>
</b:Tab>
</b:TabPanel>
</g:HTMLPanel>

@ -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<T> {
//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<T> {
// initTable(cellTable, null, null);
//sortedCellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
DefaultSelectionEventManager<T> checkBoxManager = DefaultSelectionEventManager.<T> createCheckboxManager();
sortedCellTable.setSelectionModel(theSelectionModel,checkBoxManager);
// DefaultSelectionEventManager<T> checkBoxManager = DefaultSelectionEventManager.<T> createCheckboxManager();
// sortedCellTable.setSelectionModel(theSelectionModel,checkBoxManager);
sortedCellTable.setSelectionModel(theSelectionModel);
theSelectionModel.addSelectionChangeHandler(new Handler() {
@Override

@ -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<T extends ConcessioneDV> 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<T, Date>(date) {
@Override
@ -301,7 +297,7 @@ public class ItemsTable<T extends ConcessioneDV> 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<T>() {
@Override
@ -335,69 +331,69 @@ public class ItemsTable<T extends ConcessioneDV> 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<T, String> showOnMapColumn = new MyToolTipColumn<T, String>(showOnMapButton, "Show on Map") {
@Override
public String getValue(T object) {
return "";
}
};
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, 50, Unit.PX);
ButtonCell showReportRecordButton = new ButtonCell();
showReportRecordButton.setIcon(IconType.FILE_TEXT_ALT);
MyToolTipColumn<T, String> showReportRecordColumn = new MyToolTipColumn<T, String>(showReportRecordButton,
"Show Publication Report") {
public String getValue(T object) {
return "";
}
};
showReportRecordColumn.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.SHOW_REPORT));
}
});
sortedCellTable.addColumn(showReportRecordColumn);
sortedCellTable.setColumnWidth(showReportRecordColumn, 50, Unit.PX);
ButtonCell deleteRecordButton = new ButtonCell();
deleteRecordButton.setIcon(IconType.TRASH);
MyToolTipColumn<T, String> deleteRecordColumn = new MyToolTipColumn<T, String>(deleteRecordButton,
"Delete Project") {
public String getValue(T object) {
return "";
}
};
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, 50, Unit.PX);
// ButtonCell showOnMapButton = new ButtonCell();
// showOnMapButton.setIcon(IconType.MAP_MARKER);
//
// MyToolTipColumn<T, String> showOnMapColumn = new MyToolTipColumn<T, String>(showOnMapButton, "Show on Map") {
//
// @Override
// public String getValue(T object) {
// return "";
// }
// };
//
// 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, 50, Unit.PX);
//
// ButtonCell showReportRecordButton = new ButtonCell();
// showReportRecordButton.setIcon(IconType.FILE_TEXT_ALT);
// MyToolTipColumn<T, String> showReportRecordColumn = new MyToolTipColumn<T, String>(showReportRecordButton,
// "Show Publication Report") {
// public String getValue(T object) {
// return "";
// }
// };
//
// showReportRecordColumn.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.SHOW_REPORT));
// }
// });
// sortedCellTable.addColumn(showReportRecordColumn);
// sortedCellTable.setColumnWidth(showReportRecordColumn, 50, Unit.PX);
//
// ButtonCell deleteRecordButton = new ButtonCell();
// deleteRecordButton.setIcon(IconType.TRASH);
// MyToolTipColumn<T, String> deleteRecordColumn = new MyToolTipColumn<T, String>(deleteRecordButton,
// "Delete Project") {
// public String getValue(T object) {
// return "";
// }
// };
//
// 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.DELETE_RECORD));
// }
// });
// sortedCellTable.addColumn(deleteRecordColumn);
// sortedCellTable.setColumnWidth(deleteRecordColumn, 50, Unit.PX);
GWT.log("currentSortFilter: " + currentSortFilter);
@ -423,6 +419,11 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
}
}
public void enableWriteOperations() {
}
/**
* To display authors.

@ -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) {

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

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

Loading…
Cancel
Save