fixing NavBar with actions for "List of Project"

This commit is contained in:
Francesco Mangiacrapa 2021-09-15 16:14:27 +02:00
parent 8a74c1f0d0
commit 1bcd52cc94
11 changed files with 352 additions and 155 deletions

View File

@ -38,7 +38,7 @@ public class ConstantsGeoPortalDataEntryApp {
* Aug 6, 2021 * Aug 6, 2021
*/ */
public enum ACTION_ON_ITEM { 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 { public static enum RECORD_FIELD {
NAME("name", "Name"), INTRODUCTION("introduction", "Introduction"), AUTHOR("author", "Author/s"), 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"); CREATED_BY("createdBy", "Created by");
String jsonFieldName; String jsonFieldName;

View File

@ -9,6 +9,7 @@ import java.util.TreeMap;
import org.gcube.application.geoportalcommon.shared.GeoNaItemRef; import org.gcube.application.geoportalcommon.shared.GeoNaItemRef;
import org.gcube.application.geoportalcommon.shared.products.ConcessioneDV; 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.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.ACTION_ON_ITEM;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_FIELD; 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.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; 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.event.shared.HandlerManager;
import com.google.gwt.user.client.Window; import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
@ -89,13 +92,15 @@ public class GeoPortalDataEntryApp implements EntryPoint {
private boolean projectSavedWithSuccess; private boolean projectSavedWithSuccess;
private GeonaRecordsPaginatedView grpw = null;
/** /**
* This is the entry point method. * This is the entry point method.
*/ */
public void onModuleLoad() { public void onModuleLoad() {
RECORD_FIELD[] sortByOptions = new RECORD_FIELD[] { RECORD_FIELD.NAME, RECORD_FIELD.PROJECT_START_END_DATE, 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); SortFilter initialSortFilter = new SortFilter(RECORD_FIELD.NAME, ORDER.ASC);
@ -126,6 +131,35 @@ public class GeoPortalDataEntryApp implements EntryPoint {
bindEvents(); bindEvents();
mainTabPanel.addFormPanel(geoNaMainForm); mainTabPanel.addFormPanel(geoNaMainForm);
RootPanel.get(DIV_PORTLET_ID).add(mainTabPanel); 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) { private void callGetMetadataProfiles(String scope, String secondaryType) {
@ -394,8 +428,8 @@ public class GeoPortalDataEntryApp implements EntryPoint {
@Override @Override
public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) { public void onGetList(GetListOfRecordsEvent getListOfRecordsEvent) {
GeonaRecordsPaginatedView grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, null,
null, getListOfRecordsEvent.getSortFilter()); getListOfRecordsEvent.getSortFilter());
mainTabPanel.showListOfConcessioniView(grpw); mainTabPanel.showListOfConcessioniView(grpw);
} }
}); });
@ -403,15 +437,25 @@ public class GeoPortalDataEntryApp implements EntryPoint {
appManagerBus.addHandler(ActionOnItemEvent.TYPE, new ActionOnItemEventHandler() { appManagerBus.addHandler(ActionOnItemEvent.TYPE, new ActionOnItemEventHandler() {
@Override @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) { if (showItemEvent != null) {
ACTION_ON_ITEM action = showItemEvent.getAction(); ACTION_ON_ITEM action = showItemEvent.getAction();
List<T> items = showItemEvent.getSelectItems(); 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; return;
}
T item = items.get(0); T item = items.get(0);
@ -461,6 +505,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
case SHOW_REPORT: case SHOW_REPORT:
final Modal modal2 = new Modal(true, true); final Modal modal2 = new Modal(true, true);
modal2.setTitle(concessione.getNome());
modal2.setWidth(800); modal2.setWidth(800);
modal2.setCloseVisible(true); modal2.setCloseVisible(true);
if (concessione.getValidationReport() == null) { if (concessione.getValidationReport() == null) {
@ -473,7 +518,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
modal2.show(); modal2.show();
break; break;
case REMOVE: case DELETE_RECORD:
String htmlMsg = "Going to delete the project with:"; String htmlMsg = "Going to delete the project with:";
htmlMsg += "<ul>"; htmlMsg += "<ul>";
@ -539,6 +584,7 @@ public class GeoPortalDataEntryApp implements EntryPoint {
} }
} }
}); });
} }

View File

@ -2,6 +2,7 @@ package org.gcube.portlets.user.geoportaldataentry.client.events;
import java.util.List; 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 org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.ACTION_ON_ITEM;
import com.google.gwt.event.shared.GwtEvent; 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 * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
* *
* Aug 5, 2021 * Sep 15, 2021
* @param <T> the generic type * @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>(); public static Type<ActionOnItemEventHandler> TYPE = new Type<ActionOnItemEventHandler>();
private List<T> selectItems; private List<T> selectItems;
private ACTION_ON_ITEM action; private ACTION_ON_ITEM action;
@ -23,6 +24,7 @@ public class ActionOnItemEvent<T> extends GwtEvent<ActionOnItemEventHandler> {
* Instantiates a new click item event. * Instantiates a new click item event.
* *
* @param selectItems the select items * @param selectItems the select items
* @param doAction the do action
*/ */
public ActionOnItemEvent(List<T> selectItems, ACTION_ON_ITEM doAction) { public ActionOnItemEvent(List<T> selectItems, ACTION_ON_ITEM doAction) {
this.selectItems = selectItems; this.selectItems = selectItems;
@ -70,7 +72,24 @@ public class ActionOnItemEvent<T> extends GwtEvent<ActionOnItemEventHandler> {
return selectItems; return selectItems;
} }
/**
* Gets the action.
*
* @return the action
*/
public ACTION_ON_ITEM getAction() { public ACTION_ON_ITEM getAction() {
return action; 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();
}
} }

View File

@ -1,5 +1,7 @@
package org.gcube.portlets.user.geoportaldataentry.client.events; package org.gcube.portlets.user.geoportaldataentry.client.events;
import org.gcube.application.geoportalcommon.shared.products.model.RecordDV;
import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.EventHandler;
/** /**
@ -17,5 +19,5 @@ public interface ActionOnItemEventHandler extends EventHandler {
* @param <T> the generic type * @param <T> the generic type
* @param showItemEvent the show item event * @param showItemEvent the show item event
*/ */
<T> void onDoActionFired(ActionOnItemEvent<T> showItemEvent); <T extends RecordDV> void onDoActionFired(ActionOnItemEvent<T> showItemEvent);
} }

View File

@ -1,7 +1,12 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui; 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_FIELD;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE; 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.CreateNewProjectEvent;
import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent; import org.gcube.portlets.user.geoportaldataentry.client.events.GetListOfRecordsEvent;
import org.gcube.portlets.user.geoportaldataentry.client.ui.form.GeonaDataEntryMainForm; 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 { 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 final String LABEL_FILTER_SEPARATOR = " - ";
private static GeonaMainTabPanelUiBinder uiBinder = GWT.create(GeonaMainTabPanelUiBinder.class); private static GeonaMainTabPanelUiBinder uiBinder = GWT.create(GeonaMainTabPanelUiBinder.class);
@ -54,6 +61,13 @@ public class GeonaMainTabPanel extends Composite {
@UiField @UiField
HTMLPanel geonaListOfConcessioniPanel; HTMLPanel geonaListOfConcessioniPanel;
/** The geona main form panel. */
@UiField
HTMLPanel contTabNewProject;
@UiField
HTMLPanel contTabGetListOfProjects;
/** The loader. */ /** The loader. */
@UiField @UiField
LoaderIcon loader; LoaderIcon loader;
@ -76,12 +90,26 @@ public class GeonaMainTabPanel extends Composite {
@UiField @UiField
TextBox textBoxSortBy; TextBox textBoxSortBy;
@UiField
NavLink navShowOnMap;
@UiField
NavLink navShowReport;
@UiField
NavLink navEditMode;
@UiField
NavLink navDelete;
private HandlerManager appManagerBus; private HandlerManager appManagerBus;
private RECORD_FIELD[] sortByFields; private RECORD_FIELD[] sortByFields;
private SortFilter currentSortFilter; private SortFilter currentSortFilter;
private GeonaRecordsPaginatedView grpw = null;
/** /**
* Instantiates a new geona main tab panel. * 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. * Bind events.
*/ */
@ -126,8 +159,7 @@ public class GeonaMainTabPanel extends Composite {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
GeonaRecordsPaginatedView grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, grpw = new GeonaRecordsPaginatedView(appManagerBus, RECORD_TYPE.CONCESSIONE, null, currentSortFilter);
null, currentSortFilter);
showListOfConcessioniView(grpw); 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 * @param grpw the grpw
*/ */
public void showListOfConcessioniView(GeonaRecordsPaginatedView grpw) { public void showListOfConcessioniView(GeonaRecordsPaginatedView grpw) {
this.grpw = grpw;
geonaListOfConcessioniPanel.clear(); geonaListOfConcessioniPanel.clear();
VerticalPanel htmllPanel = new VerticalPanel(); VerticalPanel htmllPanel = new VerticalPanel();
htmllPanel.add(grpw.getCellPanel()); htmllPanel.add(grpw.getCellPanel());
@ -228,23 +315,21 @@ public class GeonaMainTabPanel extends Composite {
* @param labelFilter the label filter * @param labelFilter the label filter
* @return the sort filter * @return the sort filter
*/ */
/*public SortFilter toSortFilter(String labelFilter) { /*
* public SortFilter toSortFilter(String labelFilter) {
String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR); *
* String[] array = labelFilter.split(LABEL_FILTER_SEPARATOR);
SortFilter sortFilter = null; *
try { * SortFilter sortFilter = null; try { RECORD_FIELD recordField =
RECORD_FIELD recordField = RECORD_FIELD.valueOf(array[0]); * RECORD_FIELD.valueOf(array[0]); ORDER orderField = ORDER.valueOf(array[1]);
ORDER orderField = ORDER.valueOf(array[1]); * sortFilter = new SortFilter(recordField, orderField); } catch (Exception e) {
sortFilter = new SortFilter(recordField, orderField); *
} catch (Exception e) { * }
*
} * GWT.log("Got " + sortFilter); return sortFilter;
*
GWT.log("Got " + sortFilter); * }
return sortFilter; */
}*/
public SortFilter getCurrentSortFilter() { public SortFilter getCurrentSortFilter() {
return currentSortFilter; return currentSortFilter;

View File

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

View File

@ -23,7 +23,6 @@ import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem; import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.view.client.AbstractDataProvider; import com.google.gwt.view.client.AbstractDataProvider;
import com.google.gwt.view.client.AsyncDataProvider; 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.ListDataProvider;
import com.google.gwt.view.client.MultiSelectionModel; import com.google.gwt.view.client.MultiSelectionModel;
import com.google.gwt.view.client.SelectionChangeEvent; import com.google.gwt.view.client.SelectionChangeEvent;
@ -76,8 +75,7 @@ public abstract class AbstractItemsCellTable<T> {
//sortedCellTable.setStriped(true); //sortedCellTable.setStriped(true);
sortedCellTable.setCondensed(true); sortedCellTable.setCondensed(true);
sortedCellTable.setWidth("100%", true); sortedCellTable.setWidth("100%", true);
//sortedCellTable.setBordered(true);
sortedCellTable.setAutoHeaderRefreshDisabled(true); sortedCellTable.setAutoHeaderRefreshDisabled(true);
sortedCellTable.setAutoFooterRefreshDisabled(true); sortedCellTable.setAutoFooterRefreshDisabled(true);
@ -85,8 +83,9 @@ public abstract class AbstractItemsCellTable<T> {
// initTable(cellTable, null, null); // initTable(cellTable, null, null);
//sortedCellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED); //sortedCellTable.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.ENABLED);
DefaultSelectionEventManager<T> checkBoxManager = DefaultSelectionEventManager.<T> createCheckboxManager(); // DefaultSelectionEventManager<T> checkBoxManager = DefaultSelectionEventManager.<T> createCheckboxManager();
sortedCellTable.setSelectionModel(theSelectionModel,checkBoxManager); // sortedCellTable.setSelectionModel(theSelectionModel,checkBoxManager);
sortedCellTable.setSelectionModel(theSelectionModel);
theSelectionModel.addSelectionChangeHandler(new Handler() { theSelectionModel.addSelectionChangeHandler(new Handler() {
@Override @Override

View File

@ -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.ConcessioneDV;
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV; import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV;
import org.gcube.application.geoportalcommon.shared.products.model.ValidationReportDV.ValidationStatus; 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.ConstantsGeoPortalDataEntryApp.RECORD_FIELD;
import org.gcube.portlets.user.geoportaldataentry.client.events.ActionOnItemEvent;
import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter; import org.gcube.portlets.user.geoportaldataentry.shared.SortFilter;
import com.github.gwtbootstrap.client.ui.ButtonCell; import com.github.gwtbootstrap.client.ui.ButtonCell;
import com.github.gwtbootstrap.client.ui.Pagination; 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.Cell.Context;
import com.google.gwt.cell.client.DateCell; 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.core.shared.GWT;
import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.shared.HandlerManager; 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)) { 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) { createdColumn = new Column<T, Date>(date) {
@Override @Override
@ -301,7 +297,7 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
sortedCellTable.setColumnWidth(insertedBy, 220, Unit.PX); 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>() { statusColumn = new TextColumn<T>() {
@Override @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); sortedCellTable.setColumnWidth(statusColumn, 120, Unit.PX);
} }
ButtonCell showOnMapButton = new ButtonCell(); // ButtonCell showOnMapButton = new ButtonCell();
showOnMapButton.setIcon(IconType.MAP_MARKER); // showOnMapButton.setIcon(IconType.MAP_MARKER);
//
MyToolTipColumn<T, String> showOnMapColumn = new MyToolTipColumn<T, String>(showOnMapButton, "Show on Map") { // MyToolTipColumn<T, String> showOnMapColumn = new MyToolTipColumn<T, String>(showOnMapButton, "Show on Map") {
//
@Override // @Override
public String getValue(T object) { // public String getValue(T object) {
return ""; // return "";
} // }
}; // };
//
showOnMapColumn.setFieldUpdater(new FieldUpdater<T, String>() { // showOnMapColumn.setFieldUpdater(new FieldUpdater<T, String>() {
@Override // @Override
public void update(int index, T object, String value) { // public void update(int index, T object, String value) {
GWT.log("clicked show"); // GWT.log("clicked show");
eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.SHOW_ON_MAP)); // eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.SHOW_ON_MAP));
} // }
}); // });
sortedCellTable.addColumn(showOnMapColumn); // sortedCellTable.addColumn(showOnMapColumn);
sortedCellTable.setColumnWidth(showOnMapColumn, 50, Unit.PX); // sortedCellTable.setColumnWidth(showOnMapColumn, 50, Unit.PX);
//
ButtonCell showReportRecordButton = new ButtonCell(); // ButtonCell showReportRecordButton = new ButtonCell();
showReportRecordButton.setIcon(IconType.FILE_TEXT_ALT); // showReportRecordButton.setIcon(IconType.FILE_TEXT_ALT);
MyToolTipColumn<T, String> showReportRecordColumn = new MyToolTipColumn<T, String>(showReportRecordButton, // MyToolTipColumn<T, String> showReportRecordColumn = new MyToolTipColumn<T, String>(showReportRecordButton,
"Show Publication Report") { // "Show Publication Report") {
public String getValue(T object) { // public String getValue(T object) {
return ""; // return "";
} // }
}; // };
//
showReportRecordColumn.setFieldUpdater(new FieldUpdater<T, String>() { // showReportRecordColumn.setFieldUpdater(new FieldUpdater<T, String>() {
@Override // @Override
public void update(int index, T object, String value) { // public void update(int index, T object, String value) {
//
eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.SHOW_REPORT)); // eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.SHOW_REPORT));
} // }
}); // });
sortedCellTable.addColumn(showReportRecordColumn); // sortedCellTable.addColumn(showReportRecordColumn);
sortedCellTable.setColumnWidth(showReportRecordColumn, 50, Unit.PX); // sortedCellTable.setColumnWidth(showReportRecordColumn, 50, Unit.PX);
//
ButtonCell deleteRecordButton = new ButtonCell(); // ButtonCell deleteRecordButton = new ButtonCell();
deleteRecordButton.setIcon(IconType.TRASH); // deleteRecordButton.setIcon(IconType.TRASH);
MyToolTipColumn<T, String> deleteRecordColumn = new MyToolTipColumn<T, String>(deleteRecordButton, // MyToolTipColumn<T, String> deleteRecordColumn = new MyToolTipColumn<T, String>(deleteRecordButton,
"Delete Project") { // "Delete Project") {
public String getValue(T object) { // public String getValue(T object) {
return ""; // return "";
} // }
}; // };
//
deleteRecordColumn.setFieldUpdater(new FieldUpdater<T, String>() { // deleteRecordColumn.setFieldUpdater(new FieldUpdater<T, String>() {
@Override // @Override
public void update(int index, T object, String value) { // public void update(int index, T object, String value) {
//
eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.REMOVE)); // eventBus.fireEvent(new ActionOnItemEvent<T>(Arrays.asList(object), ACTION_ON_ITEM.DELETE_RECORD));
} // }
}); // });
sortedCellTable.addColumn(deleteRecordColumn); // sortedCellTable.addColumn(deleteRecordColumn);
sortedCellTable.setColumnWidth(deleteRecordColumn, 50, Unit.PX); // sortedCellTable.setColumnWidth(deleteRecordColumn, 50, Unit.PX);
GWT.log("currentSortFilter: " + currentSortFilter); GWT.log("currentSortFilter: " + currentSortFilter);
@ -423,6 +419,11 @@ public class ItemsTable<T extends ConcessioneDV> extends AbstractItemsCellTable<
} }
} }
public void enableWriteOperations() {
}
/** /**
* To display authors. * To display authors.

View File

@ -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_FIELD;
import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE; import org.gcube.portlets.user.geoportaldataentry.client.ConstantsGeoPortalDataEntryApp.RECORD_TYPE;
import org.gcube.portlets.user.geoportaldataentry.client.GeoportalDataEntryService; 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.CommitReport;
import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject; import org.gcube.portlets.user.geoportaldataentry.shared.GeoNaFormDataObject;
import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig; import org.gcube.portlets.user.geoportaldataentry.shared.GeonaISConfig;
@ -551,7 +551,7 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
RECORD_FIELD orderBy = null; RECORD_FIELD orderBy = null;
ORDER order = null; ORDER order = null;
ConcessioneDVValidationReportStatusComparator statusComparator = null; ConcessioneValidationReportStatusComparator statusComparator = null;
if (filter == null) { if (filter == null) {
// unsorted list of records // unsorted list of records
@ -613,8 +613,8 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
} }
break; break;
case PUBLISHING_STATUS: case RECORD_STATUS:
statusComparator = new ConcessioneDVValidationReportStatusComparator(); statusComparator = new ConcessioneValidationReportStatusComparator();
default: default:
break; break;
} }
@ -622,6 +622,21 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
// sorting with nullsLast // sorting with nullsLast
if (comparator != null) if (comparator != null)
listOfConcessioni.sort(Comparator.nullsLast(comparator)); 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); LOG.debug("sorted list: " + listOfConcessioni);
// pagination // pagination
@ -635,13 +650,6 @@ public class GeoportalDataEntryServiceImpl extends RemoteServiceServlet implemen
toReturnList.add(concessioneDV); toReturnList.add(concessioneDV);
} }
if(statusComparator!=null) {
toReturnList.sort(statusComparator);
if (order.equals(ORDER.DESC)) {
Collections.sort(toReturnList, Collections.reverseOrder(new ConcessioneDVValidationReportStatusComparator()));
}
}
searchedData.setData(toReturnList); searchedData.setData(toReturnList);
if (listConcessioniSize == limit || listConcessioniSize == 0) { if (listConcessioniSize == limit || listConcessioniSize == 0) {

View File

@ -147,9 +147,9 @@ public class ServiceUtil {
*/ */
@Override @Override
public int compare(ConcessioneDV o1, ConcessioneDV o2) { public int compare(ConcessioneDV o1, ConcessioneDV o2) {
if (o1 == null || o1.getValidationStatus() == null) if (o1.getValidationStatus() == null)
return 1; return 1;
if (o2 == null || o2.getValidationStatus() == null) if (o2.getValidationStatus() == null)
return -1; return -1;
return o1.getValidationStatus().name().compareTo(o2.getValidationStatus().name()); return o1.getValidationStatus().name().compareTo(o2.getValidationStatus().name());

View File

@ -1,5 +1,11 @@
/** Add css rules here for your application. */ /** Add css rules here for your application. */
/** Example rules used by the template application (remove for your app) */ /** Example rules used by the template application (remove for your app) */
/** JUST to override the gwt-boostrap body */
body {
padding: 0px !important;
}
h1 { h1 {
font-size: 2em; font-size: 2em;
font-weight: bold; font-weight: bold;
@ -64,7 +70,7 @@ h1 {
overflow: hidden !important; overflow: hidden !important;
} }
.table-glor td:nth-last-child(-n+4) { .table-glor td:nth-last-child(-n+3) {
background-color: #d9edf7 !important; background-color: #d9edf7 !important;
} }
@ -72,3 +78,10 @@ h1 {
height: 50%; height: 50%;
vertical-align: middle !important; vertical-align: middle !important;
} }
.move-sticky {
position: -webkit-sticky;
position: sticky;
top: 0;
background-color: #eeeeee;
}