Compare commits

..

No commits in common. "master" and "task_24166" have entirely different histories.

12 changed files with 134 additions and 272 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-3.2.0/WEB-INF/classes" path="src/main/java"> <classpathentry including="**/*.java" kind="src" output="target/geoportal-data-entry-app-3.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes> <attributes>
<attribute name="optional" value="true"/> <attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
@ -31,5 +31,5 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="output" path="target/geoportal-data-entry-app-3.2.0/WEB-INF/classes"/> <classpathentry kind="output" path="target/geoportal-data-entry-app-3.2.0-SNAPSHOT/WEB-INF/classes"/>
</classpath> </classpath>

View File

@ -1,5 +1,5 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
jarsExcludedFromWebInfLib= jarsExcludedFromWebInfLib=
lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-3.2.0 lastWarOutDir=/home/francescomangiacrapa/git/geoportal-data-entry-app/target/geoportal-data-entry-app-3.2.0-SNAPSHOT
warSrcDir=src/main/webapp warSrcDir=src/main/webapp
warSrcDirIsOutput=false warSrcDirIsOutput=false

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0"> <?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
@ -111,14 +111,8 @@
<wb-module deploy-name="geoportal-data-entry-app-3.2.0-SNAPSHOT">
<wb-module deploy-name="geoportal-data-entry-app-3.2.0">
@ -231,10 +225,7 @@
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/> <wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
@ -347,10 +338,7 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/> <wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
@ -463,10 +451,7 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
@ -531,10 +516,7 @@
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/> <wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
@ -647,10 +629,7 @@
<property name="context-root" value="geoportal-data-entry-app"/> <property name="context-root" value="geoportal-data-entry-app"/>
@ -763,10 +742,7 @@
<property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/> <property name="java-output-path" value="/geoportal-data-entry-app/target/geoportal-data-entry-app-2.0.0-SNAPSHOT/WEB-INF/classes"/>
@ -879,10 +855,7 @@
</wb-module> </wb-module>

View File

@ -4,22 +4,14 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v3.2.2] - 2024-01-11 ## [v3.2.0-SNAPSHOT] - 2022-05-11
- Improved display of results on multiple fields (in the table) [#26372]
## [v3.2.1] - 2023-06-16
- Fixed issue in the Search facility [#25265]
## [v3.2.0] - 2023-05-12
- Implemented the Update facility [#24166] - Implemented the Update facility [#24166]
- Integrated with the geoportal-data-mapper library [#24244] - Integrated with the geoportal-data-mapper library [#24244]
- Integrated the Geoportal Data-Viewer Widget [#25015] - Integrated the Geoportal Data-Viewer Widget [#25015]
- Passed to Geoportal_Resolver service [#25031] - Passed to Geoportal_Resolver service [#25031]
- Provided the "View Document" and "View As JSON" facilities - Provided the "View Document" and "View As JSON" facilities
- DELETE relation operation allowed only in DRAFT phase [#25104] - DELETE relation" operation allowed only in DRAFT phase [#25104]
## [v3.1.0] - 2023-03-06 ## [v3.1.0] - 2023-03-06
@ -57,7 +49,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- [#23913] Integrated with GUI presentation configurations read from IS - [#23913] Integrated with GUI presentation configurations read from IS
- [#23926] Integrated a Post Creation Action in the UCD and manage it - [#23926] Integrated a Post Creation Action in the UCD and manage it
- [#24136] Integrated the temporal dimension on the front-end side - [#24136] Integrated the temporal dimension on the front-end side
- [#24458] Published projects cannot be edited/updated
## [v2.2.1] - 2022-06-29 ## [v2.2.1] - 2022-06-29

View File

@ -1,6 +1,6 @@
# GeoPortal Data Entry App # GeoPortal Data Entry App
Geoportal data-entry technology allows the actors who use it, the project management of spatio-temporal documents specified by meta-documents called "Use Case Descriptor" (UCD) which determine the document model, management, life cycle, etc. The system allows you to: (i) access and search for published projects by role for VRE, (ii) access the project publication report, view the publication status (SUCCESS, WARNING, ERROR), etc., (iii ) generate links for visualization on the map, (iv) update the contents of the registered projects through the workflow, (v) manage the relationships (quantity and quality temporal links) between the documents. In general, the technology allows the data entry of any document having spatio-temporal characteristics, whose metadata and payload are specified by one or more "gCube Profile" profiles which determine the structure of the resulting document (JSON). The GeoPortal Data Entry App is an application to build the web forms for data entries needed to create projects/documents (based on UCD) in the D4Science Geoportal service
## Built With ## Built With
@ -18,42 +18,14 @@ Geoportal data-entry technology allows the actors who use it, the project manage
<img src="https://gcube.wiki.gcube-system.org/images_gcube/8/8e/GeoPortalDataEntry_Architecture.png" style="max-width:800px;" alt="GeoPortal Data-Entry - Architecture" /> <img src="https://gcube.wiki.gcube-system.org/images_gcube/8/8e/GeoPortalDataEntry_Architecture.png" style="max-width:800px;" alt="GeoPortal Data-Entry - Architecture" />
## Showcase
##### D4GNA instance of Geoportal D4Science
see at [Dataset per il Geoportale Nazionale per lArcheologia (D4GNA)](https://gna.d4science.org/)
**New Project facility**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/c/c0/D4GNA_New_Project.png" style="max-width:800px;" alt="Workspace Home" />
**List of Projects facility**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/6/67/D4GNA_List_Of_Projects.png" style="max-width:800px;" alt="List of Projects" />
**UnPublish facility**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/6/6a/D4GNA_Unpublish.png" style="max-width:800px;" alt="UnPublish" />
**View Relations facility**
<img src="https://gcube.wiki.gcube-system.org/images_gcube/7/76/D4GNA_ViewRelations.png" style="max-width:800px;" alt="View Relations" />
## Documentation ## Documentation
Geoportal Service Documentation is available at [gCube CMS Suite](https://geoportal.d4science.org/geoportal-service/docs/index.html)
User Guide (DRAFT ITA) is available at [Guida al Sistema D4GNA (DRAFT-ITA)](https://gcube.wiki.gcube-system.org/images_gcube/b/b7/D4science_Guida_al_Sistema_D4GNA_bozza.pdf)
D4GNA Use Case - 3 Phase Lifecycle D4GNA Use Case - 3 Phase Lifecycle
<img src="https://gcube.wiki.gcube-system.org/images_gcube/4/46/D4GNA_Workflow_Phases_and_Operations.png" style="max-width:800px;" alt="GeoPortal Data-Entry - Workflow & Phases & Operations" /> <img src="https://gcube.wiki.gcube-system.org/images_gcube/4/46/D4GNA_Workflow_Phases_and_Operations.png" style="max-width:800px;" alt="GeoPortal Data-Entry - Workflow & Phases & Operations" />
Geoportal Service Documentation is available at [gCube CMS Suite](https://geoportal.d4science.org/geoportal-service/docs/index.html)
## Change log ## Change log
See the [Releases](https://code-repo.d4science.org/gCubeSystem/geoportal-data-entry-app/releases) See the [Releases](https://code-repo.d4science.org/gCubeSystem/geoportal-data-entry-app/releases)

12
pom.xml
View File

@ -7,14 +7,14 @@
<parent> <parent>
<artifactId>maven-parent</artifactId> <artifactId>maven-parent</artifactId>
<groupId>org.gcube.tools</groupId> <groupId>org.gcube.tools</groupId>
<version>1.2.0</version> <version>1.1.0</version>
<relativePath /> <relativePath />
</parent> </parent>
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>geoportal-data-entry-app</artifactId> <artifactId>geoportal-data-entry-app</artifactId>
<packaging>war</packaging> <packaging>war</packaging>
<version>3.2.2</version> <version>3.2.0-SNAPSHOT</version>
<name>GeoPortal Data Entry App</name> <name>GeoPortal Data Entry App</name>
<description>The GeoPortal Data Entry App is an application to build the web forms for data entries needed to create projects/documents (based on UCD) in the D4Science Geoportal service</description> <description>The GeoPortal Data Entry App is an application to build the web forms for data entries needed to create projects/documents (based on UCD) in the D4Science Geoportal service</description>
<scm> <scm>
@ -25,7 +25,7 @@
<properties> <properties>
<!-- Convenience property to set the GWT version --> <!-- Convenience property to set the GWT version -->
<gwt.version>2.9.0</gwt.version> <gwt.version>2.10.0</gwt.version>
<!-- GWT needs at least java 1.6 --> <!-- GWT needs at least java 1.6 -->
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory> <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -51,7 +51,7 @@
<dependency> <dependency>
<groupId>org.gcube.distribution</groupId> <groupId>org.gcube.distribution</groupId>
<artifactId>maven-portal-bom</artifactId> <artifactId>maven-portal-bom</artifactId>
<version>3.7.0</version> <version>3.8.0-SNAPSHOT</version>
<type>pom</type> <type>pom</type>
<scope>import</scope> <scope>import</scope>
</dependency> </dependency>
@ -95,14 +95,14 @@
<dependency> <dependency>
<groupId>org.gcube.portlets.widgets</groupId> <groupId>org.gcube.portlets.widgets</groupId>
<artifactId>geoportal-data-viewer-widget</artifactId> <artifactId>geoportal-data-viewer-widget</artifactId>
<version>[1.0.1, 2.0.0-SNAPSHOT)</version> <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.gcube.application</groupId> <groupId>org.gcube.application</groupId>
<artifactId>geoportal-data-mapper</artifactId> <artifactId>geoportal-data-mapper</artifactId>
<version>[1.0.1, 2.0.0-SNAPSHOT)</version> <version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>

View File

@ -837,10 +837,14 @@ public class GeoPortalDataEntryApp implements EntryPoint {
} }
} }
// TODO MUST MANAGE getListOfRecordsEvent.isReloadFilteringParameters()
searchingFilter.setProjection(seachingFilterParameters.getProjection()); searchingFilter.setProjection(seachingFilterParameters.getProjection());
List<ItemFieldDV> displayFields = seachingFilterParameters.getDisplayFields(); List<ItemFieldDV> displayFields = seachingFilterParameters.getDisplayFields();
grpw = new GeonaRecordsPaginatedView(appManagerBus, profileID, displayFields, searchingFilter); grpw = new GeonaRecordsPaginatedView(appManagerBus, profileID, displayFields, searchingFilter);
mainTabPanel.showListOfProjectsView(grpw); mainTabPanel.showListOfProjectsView(grpw);
// The Project Type is changed // The Project Type is changed

View File

@ -15,7 +15,7 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
/** The type. */ /** The type. */
public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>(); public static Type<GetListOfRecordsEventHandler> TYPE = new Type<GetListOfRecordsEventHandler>();
private SearchingFilter searchingFilter; private SearchingFilter sortFilter;
private String profileID; private String profileID;
private String projectName; private String projectName;
private Boolean reloadFilteringParameters = false; private Boolean reloadFilteringParameters = false;
@ -26,13 +26,13 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
* *
* @param onApplicationInit the on application init * @param onApplicationInit the on application init
* @param profileID the profile ID * @param profileID the profile ID
* @param searchingFilter the searching filter * @param sortFilter the sort filter
* @param reloadFilteringParameters the reload filtering parameters * @param reloadFilteringParameters the reload filtering parameters
*/ */
public GetListOfRecordsEvent(boolean onApplicationInit, String profileID, SearchingFilter searchingFilter, public GetListOfRecordsEvent(boolean onApplicationInit, String profileID, SearchingFilter sortFilter,
Boolean reloadFilteringParameters) { Boolean reloadFilteringParameters) {
this.onApplicationInit = onApplicationInit; this.onApplicationInit = onApplicationInit;
this.searchingFilter = searchingFilter; this.sortFilter = sortFilter;
this.profileID = profileID; this.profileID = profileID;
this.reloadFilteringParameters = reloadFilteringParameters; this.reloadFilteringParameters = reloadFilteringParameters;
} }
@ -75,7 +75,7 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
* @return the searching filter * @return the searching filter
*/ */
public SearchingFilter getSearchingFilter() { public SearchingFilter getSearchingFilter() {
return searchingFilter; return sortFilter;
} }
/** /**
@ -113,8 +113,8 @@ public class GetListOfRecordsEvent extends GwtEvent<GetListOfRecordsEventHandler
@Override @Override
public String toString() { public String toString() {
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append("GetListOfRecordsEvent [searchingFilter="); builder.append("GetListOfRecordsEvent [sortFilter=");
builder.append(searchingFilter); builder.append(sortFilter);
builder.append(", profileID="); builder.append(", profileID=");
builder.append(profileID); builder.append(profileID);
builder.append(", projectName="); builder.append(", projectName=");

View File

@ -50,6 +50,7 @@ public class GeonaRecordsPaginatedView {
private MyCustomDataProvider<DocumentDV> dataProvider = new MyCustomDataProvider<DocumentDV>(); private MyCustomDataProvider<DocumentDV> dataProvider = new MyCustomDataProvider<DocumentDV>();
protected Widget orginalLoadingIndicator = null; protected Widget orginalLoadingIndicator = null;
private LoaderIcon loadingPanel = new LoaderIcon("Loading data..."); private LoaderIcon loadingPanel = new LoaderIcon("Loading data...");
// private int serverStartIndex;
private HandlerManager eventBus; private HandlerManager eventBus;
private SearchingFilter currentSearchingFilter; private SearchingFilter currentSearchingFilter;
private String profileID; private String profileID;
@ -73,6 +74,7 @@ public class GeonaRecordsPaginatedView {
orginalLoadingIndicator = itemsTable.getCellTable().getLoadingIndicator(); orginalLoadingIndicator = itemsTable.getCellTable().getLoadingIndicator();
initPagination(ITEMS_PER_PAGE); initPagination(ITEMS_PER_PAGE);
// loadNewPage(ITEM_START_INDEX, ITEMS_PER_PAGE, false);
loadItemsForType(profileID); loadItemsForType(profileID);
} }
@ -115,27 +117,31 @@ public class GeonaRecordsPaginatedView {
/** /**
* Load new page. * Load new page.
* *
* @param profileID the profile ID * @param profileID the profile ID
* @param startIdx the start idx * @param startIdx the start idx
* @param limit the limit * @param limit the limit
* @param resetStore the reset store * @param resetStore the reset store
* @param currentSearchFilter the current search filter * @param currentSortFilter the current sort filter
* @param invalidCache the invalid cache * @param invalidCache the invalid cache
*/ */
private void loadNewPage(String profileID, final int startIdx, final int limit, final boolean resetStore, private void loadNewPage(String profileID, final int startIdx, final int limit, final boolean resetStore,
final SearchingFilter currentSearchFilter, final boolean invalidCache) { final SearchingFilter currentSortFilter, final boolean invalidCache) {
// initFirstRangeChanged = resetStore;
GWT.log("loadNewPage with parameters [startIdx: " + startIdx + ", limit: " + limit + ", resetStore:" GWT.log("loadNewPage with parameters [startIdx: " + startIdx + ", limit: " + limit + ", resetStore:"
+ resetStore + "]"); + resetStore + "]");
// showLoading(true);
int newStartIndex = startIdx; int newStartIndex = startIdx;
if (resetStore) { if (resetStore) {
GWT.log("Cleaning all data..."); GWT.log("Cleaning all data...");
newStartIndex = 0; newStartIndex = 0;
// serverStartIndex = 0;
GWT.log("Store reset performed start index is: " + newStartIndex); GWT.log("Store reset performed start index is: " + newStartIndex);
getTableDataProvider().updateRowCount(ITEMS_PER_PAGE, false); getTableDataProvider().updateRowCount(ITEMS_PER_PAGE, false);
} }
loadProjects(profileID, newStartIndex, limit, currentSearchFilter, invalidCache); loadProjects(profileID, newStartIndex, limit, currentSortFilter, invalidCache);
} }
/** /**
@ -188,16 +194,6 @@ public class GeonaRecordsPaginatedView {
} }
// initFirstRangeChanged = false; // initFirstRangeChanged = false;
//printData((List<DocumentDV>) result.getData());
}
private void printData(List<DocumentDV> data) {
GWT.log("printData");
int i = 0;
for (DocumentDV documentDV : data) {
GWT.log(++i + ") json: " + documentDV.getDocumentAsJSON());
}
} }
/** /**
@ -225,17 +221,17 @@ public class GeonaRecordsPaginatedView {
* @param theProfileID the the profile ID * @param theProfileID the the profile ID
* @param newStartIndex the new start index * @param newStartIndex the new start index
* @param limit the limit * @param limit the limit
* @param searchFilter the search filter * @param sortFilter the sort filter
* @param invalidCache the invalid cache * @param invalidCache the invalid cache
*/ */
private <T> void loadProjects(String theProfileID, int newStartIndex, int limit, SearchingFilter searchFilter, private <T> void loadProjects(String theProfileID, int newStartIndex, int limit, SearchingFilter sortFilter,
boolean invalidCache) { boolean invalidCache) {
showLoading(true); showLoading(true);
GWT.log("calling loadItemsForStatus with parameters [theProfileID: " + theProfileID + ", startIndex: " GWT.log("calling loadItemsForStatus with parameters [theProfileID: " + theProfileID + ", startIndex: "
+ newStartIndex + ", limit: " + limit + ", searchFilter: " + searchFilter + "]"); + newStartIndex + ", limit: " + limit + ", sortFilter: " + sortFilter + "]");
GeoPortalDataEntryApp.geoportalDataEntryService.getListProjects(theProfileID, newStartIndex, limit, GeoPortalDataEntryApp.geoportalDataEntryService.getListProjects(theProfileID, newStartIndex, limit, sortFilter,
searchFilter, invalidCache, new AsyncCallback<ResultSetPaginatedData>() { invalidCache, new AsyncCallback<ResultSetPaginatedData>() {
@Override @Override
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
@ -269,16 +265,11 @@ public class GeonaRecordsPaginatedView {
itemsTable.getSelectionModel().setSelected(item, select); itemsTable.getSelectionModel().setSelected(item, select);
} }
} }
/**
* Removes the column.
*
* @param columnName the column name
*/
public void removeColumn(DEFAULT_DISPLAYING_COLUMN_NAME columnName) { public void removeColumn(DEFAULT_DISPLAYING_COLUMN_NAME columnName) {
try { try {
itemsTable.removeColumn(columnName); itemsTable.removeColumn(columnName);
} catch (Exception e) { }catch (Exception e) {
// TODO: handle exception // TODO: handle exception
} }
} }
@ -292,6 +283,9 @@ public class GeonaRecordsPaginatedView {
return itemsTable.getSelectedItems(); return itemsTable.getSelectedItems();
} }
// int latestRangeStart = -1;
// int latestRangeLenght = -1;
/** /**
* A custom {@link AsyncDataProvider}. * A custom {@link AsyncDataProvider}.
* *
@ -316,6 +310,15 @@ public class GeonaRecordsPaginatedView {
int start = range.getStart(); int start = range.getStart();
int length = range.getLength(); int length = range.getLength();
// if(latestRangeStart!=start || latestRangeLenght!=length) {
// GWT.log("ranges really changed");
// latestRangeStart = start;
// latestRangeLenght = length;
// }else {
// GWT.log("ranges DO NOT changed");
// return;
// }
if (initClassFirstRangeChanged) { if (initClassFirstRangeChanged) {
GWT.log("initClassFirstRangeChanged is true.. returning"); GWT.log("initClassFirstRangeChanged is true.. returning");
initClassFirstRangeChanged = false; initClassFirstRangeChanged = false;
@ -323,6 +326,8 @@ public class GeonaRecordsPaginatedView {
} }
GWT.log("Range changed: " + start + " " + length + " visible count: " + display.getVisibleItemCount()); GWT.log("Range changed: " + start + " " + length + " visible count: " + display.getVisibleItemCount());
loadNewPage(profileID, start, length, false, currentSearchingFilter, false); loadNewPage(profileID, start, length, false, currentSearchingFilter, false);
// eventBus.fireEvent(new TableRangeViewChangedEvent<T>(start, length));
} }
} }

View File

@ -35,7 +35,7 @@ public class JSONEditorWrapper extends JavaScriptObject {
console.log("JSONEditorWrapper error: " + error) console.log("JSONEditorWrapper error: " + error)
} }
}; };
//console.log("container is: " + container); console.log("container is: " + container);
return new $wnd.JSONEditor(container, options); return new $wnd.JSONEditor(container, options);
}-*/; }-*/;
@ -47,7 +47,7 @@ public class JSONEditorWrapper extends JavaScriptObject {
public final native void set(String json) /*-{ public final native void set(String json) /*-{
var toJSONObject = JSON.parse(json); var toJSONObject = JSON.parse(json);
// set json // set json
//console.log("displayng JSON: " + toJSONObject); console.log("displayng JSON: " + toJSONObject);
this.set(toJSONObject); this.set(toJSONObject);
this.refresh(); this.refresh();
}-*/; }-*/;
@ -58,7 +58,7 @@ public class JSONEditorWrapper extends JavaScriptObject {
* @return the text * @return the text
*/ */
public final native String getText() /*-{ public final native String getText() /*-{
//console.log("this.get(): " +this.getText()); console.log("this.get(): " +this.getText());
return this.getText(); return this.getText();
}-*/; }-*/;

View File

@ -1,6 +1,5 @@
package org.gcube.portlets.user.geoportaldataentry.client.ui.projects; package org.gcube.portlets.user.geoportaldataentry.client.ui.projects;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
@ -82,7 +81,7 @@ public class ListOfProjectTablePanel extends Composite {
@UiField @UiField
Dropdown ddProjectType; Dropdown ddProjectType;
@UiField @UiField
Hero noProjectSelectionMessage; Hero noProjectSelectionMessage;
@ -347,25 +346,21 @@ public class ListOfProjectTablePanel extends Composite {
if (searchText != null && !searchText.isEmpty()) { if (searchText != null && !searchText.isEmpty()) {
Map<String, Object> searchInto = new HashMap<String, Object>(); Map<String, Object> searchInto = new HashMap<String, Object>();
List<String> listOfSeachingFields = new ArrayList<String>(); String searchForField = "";
for (ItemFieldDV recordField : cacheSearchingFilterParameters.getSearchByFields()) { for (ItemFieldDV recordField : cacheSearchingFilterParameters.getSearchByFields()) {
if (recordField.getDisplayName().equals(alertSearchFor.getText())) { if (recordField.getDisplayName().equals(alertSearchFor.getText())) {
listOfSeachingFields = recordField.getJsonFields(); searchForField = recordField.getJsonFields().get(0);
continue; continue;
} }
} }
searchInto.put(searchForField, searchText);
for (String fieldname : listOfSeachingFields) {
searchInto.put(fieldname, searchText);
}
WhereClause where = new WhereClause(); WhereClause where = new WhereClause();
where.setSearchInto(searchInto); where.setSearchInto(searchInto);
where.setOperator(LOGICAL_OP.OR); where.setOperator(LOGICAL_OP.OR);
searchingFilter.setConditions(Arrays.asList(where)); searchingFilter.setConditions(Arrays.asList(where));
} }
return searchingFilter; return searchingFilter;
} }
@ -426,7 +421,7 @@ public class ListOfProjectTablePanel extends Composite {
} }
public void showListOfProjectsView(GeonaRecordsPaginatedView grpw) { public void showListOfProjectsView(GeonaRecordsPaginatedView grpw) {
GWT.log("showListOfProjectsView for: " + grpw); GWT.log("showListOfProjectsView for: "+grpw);
this.grpw = grpw; this.grpw = grpw;
geonaListOfRecordsPanel.clear(); geonaListOfRecordsPanel.clear();
VerticalPanel verticalPanel = new VerticalPanel(); VerticalPanel verticalPanel = new VerticalPanel();

View File

@ -27,7 +27,6 @@ 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;
import com.google.gwt.i18n.client.DateTimeFormat; import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.safehtml.client.SafeHtmlTemplates;
import com.google.gwt.safehtml.shared.SafeHtml; import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlUtils; import com.google.gwt.safehtml.shared.SafeHtmlUtils;
@ -103,127 +102,6 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
super.addItems(items); super.addItems(items);
} }
class CellRender {
String tooltip;
String value;
public CellRender() {
}
public String getTooltip() {
return tooltip;
}
public String getValue() {
return value;
}
public void setTooltip(String tooltip) {
this.tooltip = tooltip;
}
public void setValue(String value) {
this.value = value;
}
}
public CellRender toCellRender(ItemFieldDV itemField, DocumentDV documentDV) {
StringBuilder tooltipBuilder = new StringBuilder();
StringBuilder valueBuilder = new StringBuilder();
String newLine = "<br>";
String newLineTxt = "\n";
String bullet = "&#8226; "; // it is the dot. As <li> rendered in the <ul> tag
String newBullet = newLine + bullet;
List<String> listJsonFields = itemField.getJsonFields();
int numberOfFields = listJsonFields.size();
if (numberOfFields > 1) {
valueBuilder.append(bullet);
}
for (String jsonKey : listJsonFields) {
try {
String objectToRender = "";
// removing the '_theDocument.' prefix for searching in the Document Map
String key = jsonKey.replace(ConstantsGeoPortalDataEntryApp.DEFAULT_DOCUMENT_PROJECTION_NAME + ".", "");
Object value = documentDV.getDocumentAsMap().get(key);
// GWT.log("key: "+key+" is instance of: "+value.getClass());
if (value == null)
continue;
GWT.log("value instance: " + value.getClass());
if (value instanceof ArrayList) {
ArrayList<Object> arrayValues = (ArrayList<Object>) value;
String toReturn = "<ul>";
for (Object arrayValue : arrayValues) {
toReturn += "<li>" + arrayValue + "</li>";
}
toReturn += "</ul>";
GWT.log("Array returning: " + key + " is instance of: " + value.getClass() + " to return: "
+ toReturn);
objectToRender = StringUtil.ellipsize(toReturn, MAX_TEXT_DIMENSION);
} else {
objectToRender = StringUtil.ellipsize(value.toString(), MAX_TEXT_DIMENSION);
}
valueBuilder.append(objectToRender);
valueBuilder.append(newBullet);
if (numberOfFields > 1) {
tooltipBuilder.append("* " + key + newLineTxt);
}else {
tooltipBuilder.append(key);
}
} catch (Exception e) {
GWT.log("Error e: " + e);
}
}
CellRender cellRender = new CellRender();
String toRender = valueBuilder.toString();
cellRender.setValue(toRender.substring(0, toRender.length() - newBullet.length()));
String toTooltip = tooltipBuilder.toString();
toTooltip = numberOfFields > 1 ? toTooltip.substring(0, toTooltip.length() - newLineTxt.length())
: toTooltip;
cellRender.setTooltip(toTooltip);
return cellRender;
}
interface Templates extends SafeHtmlTemplates {
/**
* Start tool tip.
*
* @param toolTipText the tool tip text
* @return the safe html
*/
@Template("<span title=\"{0}\">")
SafeHtml startToolTip(String toolTipText);
/**
* End tool tip.
*
* @return the safe html
*/
@Template("</span>")
SafeHtml endToolTip();
}
/** /**
* Inits the table. * Inits the table.
* *
@ -252,10 +130,27 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
String displayName = itemField.getDisplayName(); String displayName = itemField.getDisplayName();
TextColumn<T> col = new TextColumn<T>() { TextColumn<T> col = new TextColumn<T>() {
@Override @Override
public String getValue(T object) { public String getValue(T object) {
if (object == null)
return "";
DocumentDV documentDV = (DocumentDV) object;
try {
// removing the '_theDocument.' prefix for searching in the Document Map
String key = itemField.getJsonFields().get(0)
.replace(ConstantsGeoPortalDataEntryApp.DEFAULT_DOCUMENT_PROJECTION_NAME + ".", "");
Object value = documentDV.getDocumentAsMap().get(key);
if(value==null)
return "";
return value.toString();
} catch (Exception e) {
GWT.log("Error e: " + e);
}
return ""; return "";
} }
@ -263,12 +158,39 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) { public void render(com.google.gwt.cell.client.Cell.Context context, T object, SafeHtmlBuilder sb) {
if (object == null) if (object == null)
return; return;
Templates TEMPLATES = GWT.create(Templates.class);
CellRender cellRender = toCellRender(itemField, object); DocumentDV documentDV = (DocumentDV) object;
sb.append(TEMPLATES.startToolTip(cellRender.getTooltip())); String objectToRender = "";
sb.appendHtmlConstant(cellRender.getValue()); try {
sb.append(TEMPLATES.endToolTip()); // removing the '_theDocument.' prefix for searching in the Document Map
String key = itemField.getJsonFields().get(0)
.replace(ConstantsGeoPortalDataEntryApp.DEFAULT_DOCUMENT_PROJECTION_NAME + ".", "");
Object value = documentDV.getDocumentAsMap().get(key);
// GWT.log("key: "+key+" is instance of: "+value.getClass());
if(value==null)
return;
if (value instanceof ArrayList) {
ArrayList<Object> arrayValues = (ArrayList<Object>) value;
String toReturn = "<ul>";
for (Object arrayValue : arrayValues) {
toReturn += "<li>" + arrayValue + "</li>";
}
toReturn += "</ul>";
GWT.log("Array returning: " + key + " is instance of: " + value.getClass() + " to return: "
+ toReturn);
objectToRender = StringUtil.ellipsize(toReturn, MAX_TEXT_DIMENSION);
} else {
objectToRender = StringUtil.ellipsize(value.toString(), MAX_TEXT_DIMENSION);
}
} catch (Exception e) {
GWT.log("Error e: " + e);
}
sb.appendHtmlConstant(objectToRender);
// super.render(context, object, sb);
// sb.appendHtmlConstant("</span>");
}; };
@ -276,7 +198,7 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
sortedCellTable.addColumn(col, displayName, true); sortedCellTable.addColumn(col, displayName, true);
i++; i++;
} }
// COL RELATIONS // COL RELATIONS
TextColumn<T> colRelationship = new TextColumn<T>() { TextColumn<T> colRelationship = new TextColumn<T>() {
@Override @Override
@ -309,7 +231,7 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
}; };
}; };
colRelationship.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_B); colRelationship.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_B);
sortedCellTable.addColumn(colRelationship, DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS.getTitle(), true); sortedCellTable.addColumn(colRelationship, DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS.getTitle(), true);
mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS, colRelationship); mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.RELATIONSHIPS, colRelationship);
@ -336,7 +258,7 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
} }
}; };
colCreated.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_O); colCreated.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_O);
sortedCellTable.addColumn(colCreated, DEFAULT_DISPLAYING_COLUMN_NAME.CREATED.getTitle(), true); sortedCellTable.addColumn(colCreated, DEFAULT_DISPLAYING_COLUMN_NAME.CREATED.getTitle(), true);
sortedCellTable.setColumnWidth(colCreated, 130, Unit.PX); sortedCellTable.setColumnWidth(colCreated, 130, Unit.PX);
@ -364,7 +286,7 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
} }
}; };
colPublisher.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_O); colPublisher.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_O);
sortedCellTable.addColumn(colPublisher, DEFAULT_DISPLAYING_COLUMN_NAME.CREATED_BY.getTitle(), true); sortedCellTable.addColumn(colPublisher, DEFAULT_DISPLAYING_COLUMN_NAME.CREATED_BY.getTitle(), true);
mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.CREATED_BY, colPublisher); mapColumns.put(DEFAULT_DISPLAYING_COLUMN_NAME.CREATED_BY, colPublisher);
@ -441,7 +363,7 @@ public class ItemsTable<T extends DocumentDV> extends AbstractItemsCellTable<T>
}; };
}; };
colOperationStatus.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_Y); colOperationStatus.setCellStyleNames(CSS_CLASS_BACK_SYSTEM_CELL_Y);
sortedCellTable.addColumn(colOperationStatus, DEFAULT_DISPLAYING_COLUMN_NAME.STATUS.getTitle(), true); sortedCellTable.addColumn(colOperationStatus, DEFAULT_DISPLAYING_COLUMN_NAME.STATUS.getTitle(), true);
sortedCellTable.setColumnWidth(colOperationStatus, 120, Unit.PX); sortedCellTable.setColumnWidth(colOperationStatus, 120, Unit.PX);