From 471c1f373c9bdc96e1db8ed4a7481bc33755ee72 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 2 Feb 2024 16:52:40 +0100 Subject: [PATCH 01/10] Aligned to ckan-metadata-publisher-widget --- CHANGELOG.md | 6 + pom.xml | 2 +- .../form/catalogue/CreateDatasetForm.ui.xml | 18 +- .../shared/catalogue/DatasetBean.java | 670 +++++++++--------- 4 files changed, 351 insertions(+), 345 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 35324ff..c6185d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ 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). +## [v2.1.1-SNAPSHOT] - 2024-02-02 + +#### Enhancements + +- [#26656] Aligned the data-model to ckan-metadata-publisher-widget + ## [v2.1.0] - 2023-02-01 #### Enhancements diff --git a/pom.xml b/pom.xml index 5951622..ffbe3b8 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ org.gcube.portlets.widgets metadata-profile-form-builder-widget jar - 2.1.0 + 2.1.1-SNAPSHOT Metadata Profile Form Builder The Metadata Profile Form Builder is a widget able to build dynamically a web form by reading "gCube Metadata Profile/s" diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.ui.xml b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.ui.xml index ef4aca5..2c728a6 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.ui.xml @@ -1,4 +1,4 @@ - + + Alert blocks for info/errors @@ -104,7 +104,7 @@ - + TAGS Panel @@ -294,13 +294,13 @@ - + Alert block on continue - + Alert block on continue @@ -359,11 +359,11 @@ - + Here will be placed the metadata fields formats - + Custom fields can be dinamically added Custom Field(s): @@ -383,7 +383,7 @@ - + Alert block on create @@ -407,4 +407,4 @@ - \ No newline at end of file + --> \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/DatasetBean.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/DatasetBean.java index 108c18b..8f27e03 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/DatasetBean.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/DatasetBean.java @@ -1,335 +1,335 @@ -package org.gcube.portlets.widgets.mpformbuilder.shared.catalogue; - -import java.io.Serializable; -import java.util.List; -import java.util.Map; - -import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean; - -/** - * This bean will contain during ckan metadata creation information related to the future build. - * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) - */ -@SuppressWarnings("serial") -public class DatasetBean implements Serializable { - - private String id; - private String title; - private String description; - private String license; // chosen by the user - private String source; // url of the folder in the workspace - private String authorName; // author name - private String authorSurname; // author surname - private String authorFullName; - private String authorEmail; // owner's email - private String maintainer; - private String maintainerEmail; - private String ownerIdentifier; // owner of the folder into the workspace (e.g., andrea.rossi) - private String chosenType; // the name of the MetaDataType chosen - private String selectedOrganization; - private long version; // version 1, 2 ... - private boolean visible; // Private (false) or Public(true) - private List organizationList; // list of organization in which the user is present and could create the dataset - private ResourceElementBean resourceRoot; // in case of workspace, this is the directory root or the single file information - private List metadataList; - private List tags; // on retrieve, they are the keys of the product - private List tagsVocabulary; // when available - private Map> customFields; - private List groups; - private List groupsForceCreation; - - public DatasetBean(){ - super(); - } - - /** Create a metadata bean object. - * @param id - * @param title - * @param description - * @param customFields - * @param tags - * @param license - * @param visibility - * @param source - * @param version - * @param author - * @param authorEmail - * @param maintainer - * @param maintainerEmail - * @param ownerIdentifier - * @param organizationList - * @param selectedOrganization - * @param resourcesIds - * @param addResources - * @param metadataList - */ - public DatasetBean(String id, String title, String description, - Map> customFields, List tags, - String license, boolean visible, String source, long version, - String authorName, String authorSurname, String authorEmail, String maintainer, - String maintainerEmail, String ownerIdentifier, - List organizationList, String selectedOrganization, - ResourceElementBean resourceRoot, - List metadataList, List groups, List tagsVocabulary) { - super(); - this.id = id; - this.title = title; - this.description = description; - this.customFields = customFields; - this.tags = tags; - this.license = license; - this.visible = visible; - this.source = source; - this.version = version; - this.authorName = authorName; - this.authorSurname = authorSurname; - this.authorEmail = authorEmail; - this.maintainer = maintainer; - this.maintainerEmail = maintainerEmail; - this.ownerIdentifier = ownerIdentifier; - this.organizationList = organizationList; - this.selectedOrganization = selectedOrganization; - this.resourceRoot = resourceRoot; - this.metadataList = metadataList; - this.groups = groups; - this.tagsVocabulary = tagsVocabulary; - } - - public String getChosenType() { - return chosenType; - } - - public void setChosenType(String chosenType) { - this.chosenType = chosenType; - } - - public List getMetadataList() { - return metadataList; - } - - public void setMetadataList(List metadataListTypes) { - this.metadataList = metadataListTypes; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getOwnerIdentifier() { - return ownerIdentifier; - } - - public void setOwnerIdentifier(String ownerIdentifier) { - this.ownerIdentifier = ownerIdentifier; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public Map> getCustomFields() { - return customFields; - } - - public void setCustomFields(Map> customFields) { - this.customFields = customFields; - } - - public List getTags() { - return tags; - } - - public void setTags(List tags) { - this.tags = tags; - } - - public String getLicense() { - return license; - } - - public void setLicense(String license) { - this.license = license; - } - - public boolean getVisibility() { - return visible; - } - - public void setVisibile(boolean visibile) { - this.visible = visibile; - } - - public String getSource() { - return source; - } - - public void setSource(String source) { - this.source = source; - } - - public long getVersion() { - return version; - } - - public void setVersion(long version) { - this.version = version; - } - - public String getAuthorName() { - return authorName; - } - - public void setAuthorName(String authorName) { - this.authorName = authorName; - } - - public String getAuthorSurname() { - return authorSurname; - } - - public void setAuthorSurname(String authorSurname) { - this.authorSurname = authorSurname; - } - - public String getAuthorEmail() { - return authorEmail; - } - - public void setAuthorEmail(String authorEmail) { - this.authorEmail = authorEmail; - } - - public String getMaintainer() { - return maintainer; - } - - public void setMaintainer(String maintainer) { - this.maintainer = maintainer; - } - - public String getMaintainerEmail() { - return maintainerEmail; - } - - public void setMaintainerEmail(String maintainerEmail) { - this.maintainerEmail = maintainerEmail; - } - - public List getOrganizationList() { - return organizationList; - } - - public void setOrganizationList(List organizationList) { - this.organizationList = organizationList; - } - - public String getSelectedOrganization() { - return selectedOrganization; - } - - public void setSelectedOrganization(String selectedOrganization) { - this.selectedOrganization = selectedOrganization; - } - - public ResourceElementBean getResourceRoot() { - return resourceRoot; - } - - public void setResourceRoot(ResourceElementBean resourceRoot) { - this.resourceRoot = resourceRoot; - } - - public String getAuthorFullName() { - return authorFullName; - } - - public void setAuthorFullName(String authorFullName) { - this.authorFullName = authorFullName; - } - - public List getGroups() { - return groups; - } - - public void setGroups(List groups) { - this.groups = groups; - } - - public List getTagsVocabulary() { - return tagsVocabulary; - } - - public void setTagsVocabulary(List tagsVocabulary) { - this.tagsVocabulary = tagsVocabulary; - } - - public List getGroupsForceCreation() { - return groupsForceCreation; - } - - public void setGroupsForceCreation(List groupsForceCreation) { - this.groupsForceCreation = groupsForceCreation; - } - - @Override - public String toString() { - return "DatasetBean [" - + (id != null ? "id=" + id + ", " : "") - + (title != null ? "title=" + title + ", " : "") - + (description != null ? "description=" + description + ", " - : "") - + (license != null ? "license=" + license + ", " : "") - + (source != null ? "source=" + source + ", " : "") - + (authorName != null ? "authorName=" + authorName + ", " : "") - + (authorSurname != null ? "authorSurname=" + authorSurname - + ", " : "") - + (authorFullName != null ? "authorFullName=" + authorFullName - + ", " : "") - + (authorEmail != null ? "authorEmail=" + authorEmail + ", " - : "") - + (maintainer != null ? "maintainer=" + maintainer + ", " : "") - + (maintainerEmail != null ? "maintainerEmail=" - + maintainerEmail + ", " : "") - + (ownerIdentifier != null ? "ownerIdentifier=" - + ownerIdentifier + ", " : "") - + (chosenType != null ? "chosenType=" + chosenType + ", " : "") - + (selectedOrganization != null ? "selectedOrganization=" - + selectedOrganization + ", " : "") - + "version=" - + version - + ", visible=" - + visible - + ", " - + (organizationList != null ? "organizationList=" - + organizationList + ", " : "") - + (resourceRoot != null ? "resourceRoot=" + resourceRoot + ", " - : "") - + (metadataList != null ? "metadataList=" + metadataList + ", " - : "") - + (tags != null ? "tags=" + tags + ", " : "") - + (tagsVocabulary != null ? "tagsVocabulary=" + tagsVocabulary - + ", " : "") - + (customFields != null ? "customFields=" + customFields + ", " - : "") - + (groups != null ? "groups=" + groups + ", " : "") - + (groupsForceCreation != null ? "groupsForceCreation=" - + groupsForceCreation : "") + "]"; - } - -} \ No newline at end of file +//package org.gcube.portlets.widgets.mpformbuilder.shared.catalogue; +// +//import java.io.Serializable; +//import java.util.List; +//import java.util.Map; +// +//import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean; +// +///** +// * This bean will contain during ckan metadata creation information related to the future build. +// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) +// */ +//@SuppressWarnings("serial") +//public class DatasetBean implements Serializable { +// +// private String id; +// private String title; +// private String description; +// private String license; // chosen by the user +// private String source; // url of the folder in the workspace +// private String authorName; // author name +// private String authorSurname; // author surname +// private String authorFullName; +// private String authorEmail; // owner's email +// private String maintainer; +// private String maintainerEmail; +// private String ownerIdentifier; // owner of the folder into the workspace (e.g., andrea.rossi) +// private String chosenType; // the name of the MetaDataType chosen +// private String selectedOrganization; +// private long version; // version 1, 2 ... +// private boolean visible; // Private (false) or Public(true) +// private List organizationList; // list of organization in which the user is present and could create the dataset +// private ResourceElementBean resourceRoot; // in case of workspace, this is the directory root or the single file information +// private List metadataList; +// private List tags; // on retrieve, they are the keys of the product +// private List tagsVocabulary; // when available +// private Map> customFields; +// private List groups; +// private List groupsForceCreation; +// +// public DatasetBean(){ +// super(); +// } +// +// /** Create a metadata bean object. +// * @param id +// * @param title +// * @param description +// * @param customFields +// * @param tags +// * @param license +// * @param visibility +// * @param source +// * @param version +// * @param author +// * @param authorEmail +// * @param maintainer +// * @param maintainerEmail +// * @param ownerIdentifier +// * @param organizationList +// * @param selectedOrganization +// * @param resourcesIds +// * @param addResources +// * @param metadataList +// */ +// public DatasetBean(String id, String title, String description, +// Map> customFields, List tags, +// String license, boolean visible, String source, long version, +// String authorName, String authorSurname, String authorEmail, String maintainer, +// String maintainerEmail, String ownerIdentifier, +// List organizationList, String selectedOrganization, +// ResourceElementBean resourceRoot, +// List metadataList, List groups, List tagsVocabulary) { +// super(); +// this.id = id; +// this.title = title; +// this.description = description; +// this.customFields = customFields; +// this.tags = tags; +// this.license = license; +// this.visible = visible; +// this.source = source; +// this.version = version; +// this.authorName = authorName; +// this.authorSurname = authorSurname; +// this.authorEmail = authorEmail; +// this.maintainer = maintainer; +// this.maintainerEmail = maintainerEmail; +// this.ownerIdentifier = ownerIdentifier; +// this.organizationList = organizationList; +// this.selectedOrganization = selectedOrganization; +// this.resourceRoot = resourceRoot; +// this.metadataList = metadataList; +// this.groups = groups; +// this.tagsVocabulary = tagsVocabulary; +// } +// +// public String getChosenType() { +// return chosenType; +// } +// +// public void setChosenType(String chosenType) { +// this.chosenType = chosenType; +// } +// +// public List getMetadataList() { +// return metadataList; +// } +// +// public void setMetadataList(List metadataListTypes) { +// this.metadataList = metadataListTypes; +// } +// +// public String getId() { +// return id; +// } +// +// public void setId(String id) { +// this.id = id; +// } +// +// public String getOwnerIdentifier() { +// return ownerIdentifier; +// } +// +// public void setOwnerIdentifier(String ownerIdentifier) { +// this.ownerIdentifier = ownerIdentifier; +// } +// +// public String getTitle() { +// return title; +// } +// +// public void setTitle(String title) { +// this.title = title; +// } +// +// public String getDescription() { +// return description; +// } +// +// public void setDescription(String description) { +// this.description = description; +// } +// +// public Map> getCustomFields() { +// return customFields; +// } +// +// public void setCustomFields(Map> customFields) { +// this.customFields = customFields; +// } +// +// public List getTags() { +// return tags; +// } +// +// public void setTags(List tags) { +// this.tags = tags; +// } +// +// public String getLicense() { +// return license; +// } +// +// public void setLicense(String license) { +// this.license = license; +// } +// +// public boolean getVisibility() { +// return visible; +// } +// +// public void setVisibile(boolean visibile) { +// this.visible = visibile; +// } +// +// public String getSource() { +// return source; +// } +// +// public void setSource(String source) { +// this.source = source; +// } +// +// public long getVersion() { +// return version; +// } +// +// public void setVersion(long version) { +// this.version = version; +// } +// +// public String getAuthorName() { +// return authorName; +// } +// +// public void setAuthorName(String authorName) { +// this.authorName = authorName; +// } +// +// public String getAuthorSurname() { +// return authorSurname; +// } +// +// public void setAuthorSurname(String authorSurname) { +// this.authorSurname = authorSurname; +// } +// +// public String getAuthorEmail() { +// return authorEmail; +// } +// +// public void setAuthorEmail(String authorEmail) { +// this.authorEmail = authorEmail; +// } +// +// public String getMaintainer() { +// return maintainer; +// } +// +// public void setMaintainer(String maintainer) { +// this.maintainer = maintainer; +// } +// +// public String getMaintainerEmail() { +// return maintainerEmail; +// } +// +// public void setMaintainerEmail(String maintainerEmail) { +// this.maintainerEmail = maintainerEmail; +// } +// +// public List getOrganizationList() { +// return organizationList; +// } +// +// public void setOrganizationList(List organizationList) { +// this.organizationList = organizationList; +// } +// +// public String getSelectedOrganization() { +// return selectedOrganization; +// } +// +// public void setSelectedOrganization(String selectedOrganization) { +// this.selectedOrganization = selectedOrganization; +// } +// +// public ResourceElementBean getResourceRoot() { +// return resourceRoot; +// } +// +// public void setResourceRoot(ResourceElementBean resourceRoot) { +// this.resourceRoot = resourceRoot; +// } +// +// public String getAuthorFullName() { +// return authorFullName; +// } +// +// public void setAuthorFullName(String authorFullName) { +// this.authorFullName = authorFullName; +// } +// +// public List getGroups() { +// return groups; +// } +// +// public void setGroups(List groups) { +// this.groups = groups; +// } +// +// public List getTagsVocabulary() { +// return tagsVocabulary; +// } +// +// public void setTagsVocabulary(List tagsVocabulary) { +// this.tagsVocabulary = tagsVocabulary; +// } +// +// public List getGroupsForceCreation() { +// return groupsForceCreation; +// } +// +// public void setGroupsForceCreation(List groupsForceCreation) { +// this.groupsForceCreation = groupsForceCreation; +// } +// +// @Override +// public String toString() { +// return "DatasetBean [" +// + (id != null ? "id=" + id + ", " : "") +// + (title != null ? "title=" + title + ", " : "") +// + (description != null ? "description=" + description + ", " +// : "") +// + (license != null ? "license=" + license + ", " : "") +// + (source != null ? "source=" + source + ", " : "") +// + (authorName != null ? "authorName=" + authorName + ", " : "") +// + (authorSurname != null ? "authorSurname=" + authorSurname +// + ", " : "") +// + (authorFullName != null ? "authorFullName=" + authorFullName +// + ", " : "") +// + (authorEmail != null ? "authorEmail=" + authorEmail + ", " +// : "") +// + (maintainer != null ? "maintainer=" + maintainer + ", " : "") +// + (maintainerEmail != null ? "maintainerEmail=" +// + maintainerEmail + ", " : "") +// + (ownerIdentifier != null ? "ownerIdentifier=" +// + ownerIdentifier + ", " : "") +// + (chosenType != null ? "chosenType=" + chosenType + ", " : "") +// + (selectedOrganization != null ? "selectedOrganization=" +// + selectedOrganization + ", " : "") +// + "version=" +// + version +// + ", visible=" +// + visible +// + ", " +// + (organizationList != null ? "organizationList=" +// + organizationList + ", " : "") +// + (resourceRoot != null ? "resourceRoot=" + resourceRoot + ", " +// : "") +// + (metadataList != null ? "metadataList=" + metadataList + ", " +// : "") +// + (tags != null ? "tags=" + tags + ", " : "") +// + (tagsVocabulary != null ? "tagsVocabulary=" + tagsVocabulary +// + ", " : "") +// + (customFields != null ? "customFields=" + customFields + ", " +// : "") +// + (groups != null ? "groups=" + groups + ", " : "") +// + (groupsForceCreation != null ? "groupsForceCreation=" +// + groupsForceCreation : "") + "]"; +// } +// +//} \ No newline at end of file From 845a8c4ece5a1cc955596d124b80a08d8ae02205 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 2 Feb 2024 17:00:07 +0100 Subject: [PATCH 02/10] refactored beans --- .../client/events/AddResourceEvent.java | 8 +-- .../client/events/DeleteResourceEvent.java | 8 +-- .../form/catalogue/CreateDatasetForm.java | 32 ++++----- .../form/generic/CreateMetadataForm.java | 10 +-- .../ui/resources/AddResourceToDataset.java | 8 +-- .../ui/resources/AddedResourcesSummary.java | 10 +-- .../twincolumnselection/ResourceCellLeft.java | 6 +- .../ResourceCellRight.java | 10 +-- .../twincolumnselection/ResourceInfoForm.java | 6 +- .../TwinColumnSelectionMainPanel.java | 70 +++++++++---------- .../shared/catalogue/DatasetBean.java | 30 ++++---- ...Bean.java => OrganizationBeanProfile.java} | 10 +-- ...n.java => ResourceElementBeanProfile.java} | 42 +++++------ 13 files changed, 125 insertions(+), 125 deletions(-) rename src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/{OrganizationBean.java => OrganizationBeanProfile.java} (80%) rename src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/{ResourceElementBean.java => ResourceElementBeanProfile.java} (79%) diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEvent.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEvent.java index f0485cc..af65fd5 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEvent.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEvent.java @@ -1,6 +1,6 @@ package org.gcube.portlets.widgets.mpformbuilder.client.events; -import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean; +import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile; import com.google.gwt.event.shared.GwtEvent; @@ -11,13 +11,13 @@ import com.google.gwt.event.shared.GwtEvent; public class AddResourceEvent extends GwtEvent { public static Type TYPE = new Type(); - private ResourceElementBean resource; + private ResourceElementBeanProfile resource; - public AddResourceEvent(ResourceElementBean resource) { + public AddResourceEvent(ResourceElementBeanProfile resource) { this.resource = resource; } - public ResourceElementBean getResource() { + public ResourceElementBeanProfile getResource() { return resource; } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceEvent.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceEvent.java index c528579..6a08831 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceEvent.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceEvent.java @@ -1,6 +1,6 @@ package org.gcube.portlets.widgets.mpformbuilder.client.events; -import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean; +import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile; import com.google.gwt.event.shared.GwtEvent; @@ -11,13 +11,13 @@ import com.google.gwt.event.shared.GwtEvent; public class DeleteResourceEvent extends GwtEvent { public static Type TYPE = new Type(); - private ResourceElementBean resource; + private ResourceElementBeanProfile resource; - public DeleteResourceEvent(ResourceElementBean resource) { + public DeleteResourceEvent(ResourceElementBeanProfile resource) { this.resource = resource; } - public ResourceElementBean getResource() { + public ResourceElementBeanProfile getResource() { return resource; } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.java index aef4a3b..1665743 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.java @@ -26,7 +26,7 @@ //import org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection.TwinColumnSelectionMainPanel; //import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.InfoIconsLabels; //import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.DatasetBean; -//import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.OrganizationBean; +//import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.OrganizationBeanProfile; //import org.gcube.portlets.widgets.mpformbuilder.shared.license.LicenseBean; //import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.CategoryWrapper; //import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean; @@ -365,9 +365,9 @@ // } // // // set organizations -// List organizations = bean.getOrganizationList(); +// List organizations = bean.getOrganizationList(); // -// for (OrganizationBean organization : organizations) { +// for (OrganizationBeanProfile organization : organizations) { // organizationsListbox.addItem(organization.getTitle()); // nameTitleOrganizationMap.put(organization.getTitle(), organization.getName()); // } @@ -460,10 +460,10 @@ // setAlertBlock("Retrieving groups, please wait...", AlertType.INFO, true); // // // request groups -// ckanServices.getUserGroups(orgName, new AsyncCallback>() { +// ckanServices.getUserGroups(orgName, new AsyncCallback>() { // // @Override -// public void onSuccess(List groups) { +// public void onSuccess(List groups) { // if(groups == null){ // setAlertBlock("Error while retrieving groups", AlertType.ERROR, true); // }else{ @@ -473,7 +473,7 @@ // else{ // // // add groups -// for (OrganizationBean group : groups) { +// for (OrganizationBeanProfile group : groups) { // groupsListbox.addItem(group.getTitle(), group.getName()); // } // hideGroupsAlreadyInProfile(profiles); @@ -565,10 +565,10 @@ // setAlertBlock("Retrieving groups, please wait...", AlertType.INFO, true); // // // request groups -// ckanServices.getUserGroups(orgName, new AsyncCallback>() { +// ckanServices.getUserGroups(orgName, new AsyncCallback>() { // // @Override -// public void onSuccess(List groups) { +// public void onSuccess(List groups) { // // if(groups == null){ // setAlertBlock("Error while retrieving groups, try later", AlertType.ERROR, true); @@ -579,7 +579,7 @@ // else{ // // // add groups -// for (OrganizationBean group : groups) { +// for (OrganizationBeanProfile group : groups) { // groupsListbox.addItem(group.getTitle(), group.getName()); // } // groupsListbox.setEnabled(true); @@ -934,17 +934,17 @@ // Set tags = new HashSet(tagsPanel.getTags()); // // //we need to retrieve the organization's name from this title -// List orgs = receivedBean.getOrganizationList(); +// List orgs = receivedBean.getOrganizationList(); // String chosenOrganization = null; -// for (OrganizationBean organizationBean : orgs) { +// for (OrganizationBeanProfile organizationBean : orgs) { // if(chosenOrganizationTitle.equals(organizationBean.getTitle())){ // chosenOrganization = organizationBean.getName(); // break; // } // } // -// List groups = new ArrayList(); -// List groupsToForceCreation = new ArrayList(); +// List groups = new ArrayList(); +// List groupsToForceCreation = new ArrayList(); // // // get groups, if any // int items = groupsListbox.getItemCount(); @@ -952,7 +952,7 @@ // String groupTitle = groupsListbox.getItemText(i); // String groupName = groupsListbox.getValue(i); // if(groupsListbox.isItemSelected(i)){ -// groups.add(new OrganizationBean(groupTitle, groupName, false)); +// groups.add(new OrganizationBeanProfile(groupTitle, groupName, false)); // } // } // @@ -984,9 +984,9 @@ // if(groupsTitle != null){ // for (String groupTitle : groupsTitle) { // if(field.isGroupToForce()) -// groupsToForceCreation.add(new OrganizationBean(groupTitle, groupTitle, false, field.isPropagateUp())); +// groupsToForceCreation.add(new OrganizationBeanProfile(groupTitle, groupTitle, false, field.isPropagateUp())); // else -// groups.add(new OrganizationBean(groupTitle, groupTitle, false, field.isPropagateUp())); +// groups.add(new OrganizationBeanProfile(groupTitle, groupTitle, false, field.isPropagateUp())); // } // } // } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java index 8884abc..e6ad544 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java @@ -25,7 +25,7 @@ import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.CustomLegend; import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.InfoIconsLabels; import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.LoaderIcon; import org.gcube.portlets.widgets.mpformbuilder.shared.GenericDatasetBean; -import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.OrganizationBean; +import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.OrganizationBeanProfile; import org.gcube.portlets.widgets.mpformbuilder.shared.license.LicenseBean; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.CategoryWrapper; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean; @@ -633,8 +633,8 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe } else { // Set tags = new HashSet(tagsPanel.getTags()); - List groups = new ArrayList(); - List groupsToForceCreation = new ArrayList(); + List groups = new ArrayList(); + List groupsToForceCreation = new ArrayList(); LinkedHashMap> customFieldsMap = new LinkedHashMap>(); List listFilesUploaded = new ArrayList(); @@ -673,10 +673,10 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe if (groupsTitle != null) { for (String groupTitle : groupsTitle) { if (field.isGroupToForce()) - groupsToForceCreation.add(new OrganizationBean(groupTitle, groupTitle, false, + groupsToForceCreation.add(new OrganizationBeanProfile(groupTitle, groupTitle, false, field.isPropagateUp())); else - groups.add(new OrganizationBean(groupTitle, groupTitle, false, + groups.add(new OrganizationBeanProfile(groupTitle, groupTitle, false, field.isPropagateUp())); } } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddResourceToDataset.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddResourceToDataset.java index 8f8211f..5d8e377 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddResourceToDataset.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddResourceToDataset.java @@ -112,8 +112,8 @@ public class AddResourceToDataset extends Composite{ // collect data and build up the bean /*//TODO MUST BE DONE IN ANOTHER POINT * - * final ResourceElementBean resource = - new ResourceElementBean( + * final ResourceElementBeanProfile resource = + new ResourceElementBeanProfile( resourceNameTextBox.getText(), true, false, @@ -130,10 +130,10 @@ public class AddResourceToDataset extends Composite{ addResourceButton.setEnabled(false); // try to create - ckanServices.addResourceToDataset(resource, datasetId, new AsyncCallback() { + ckanServices.addResourceToDataset(resource, datasetId, new AsyncCallback() { @Override - public void onSuccess(ResourceElementBean result) { + public void onSuccess(ResourceElementBeanProfile result) { if(result != null){ showAlert("Resource created correctly", AlertType.SUCCESS); diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummary.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummary.java index b5b5ca4..24cf5b9 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummary.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummary.java @@ -7,7 +7,7 @@ import org.gcube.portlets.widgets.mpformbuilder.client.events.AddResourceEvent; import org.gcube.portlets.widgets.mpformbuilder.client.events.AddResourceEventHandler; import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteResourceEvent; import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteResourceEventHandler; -import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean; +import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile; import com.github.gwtbootstrap.client.ui.Accordion; import com.github.gwtbootstrap.client.ui.AccordionGroup; @@ -40,7 +40,7 @@ public class AddedResourcesSummary extends Composite{ private HandlerManager eventBus; // list of added resources (beans) - List addedResources; + List addedResources; @UiField VerticalPanel addResourcesPanel; @@ -54,7 +54,7 @@ public class AddedResourcesSummary extends Composite{ bind(); // init list - addedResources = new ArrayList(); + addedResources = new ArrayList(); } /** @@ -69,7 +69,7 @@ public class AddedResourcesSummary extends Composite{ public void onAddedResource(AddResourceEvent addResourceEvent) { // get the resource - final ResourceElementBean justAddedResource = addResourceEvent.getResource(); + final ResourceElementBeanProfile justAddedResource = addResourceEvent.getResource(); // Build an accordion to show resource info Accordion accordion = new Accordion(); @@ -116,7 +116,7 @@ public class AddedResourcesSummary extends Composite{ public void onDeletedResource(DeleteResourceEvent deleteResourceEvent) { // to delete - ResourceElementBean toDelete = deleteResourceEvent.getResource(); + ResourceElementBeanProfile toDelete = deleteResourceEvent.getResource(); diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellLeft.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellLeft.java index d954816..146de09 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellLeft.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellLeft.java @@ -1,7 +1,7 @@ package org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection; import org.gcube.portlets.widgets.mpformbuilder.client.ui.icons.Images; -import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean; +import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile; import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.core.client.GWT; @@ -11,14 +11,14 @@ import com.google.gwt.user.client.ui.Image; * Cell that renders left side panel objects * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) */ -public class ResourceCellLeft extends AbstractCell{ +public class ResourceCellLeft extends AbstractCell{ private static final Images image = GWT.create(Images.class); private static final String tipFile = "Hold down the Control (ctrl) or Command button to select multiple options"; private static final String tipFolder = "Click on the folder to navigate it"; @Override public void render(com.google.gwt.cell.client.Cell.Context context, - ResourceElementBean value, SafeHtmlBuilder sb) { + ResourceElementBeanProfile value, SafeHtmlBuilder sb) { if (value == null || value.isToBeAdded()) { return; diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellRight.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellRight.java index 84aab96..407fbf1 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellRight.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellRight.java @@ -1,7 +1,7 @@ package org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection; import org.gcube.portlets.widgets.mpformbuilder.client.ui.icons.Images; -import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean; +import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile; import com.google.gwt.cell.client.AbstractCell; import com.google.gwt.cell.client.ValueUpdater; @@ -15,7 +15,7 @@ import com.google.gwt.user.client.ui.Image; * Cell that renders right side panel objects * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) */ -public class ResourceCellRight extends AbstractCell{ +public class ResourceCellRight extends AbstractCell{ private static final Images image = GWT.create(Images.class); private static final String tip = "Hold down the Control (CTRL) or Command button to select multiple options. Double click to access " @@ -27,7 +27,7 @@ public class ResourceCellRight extends AbstractCell{ @Override public void render(com.google.gwt.cell.client.Cell.Context context, - ResourceElementBean value, SafeHtmlBuilder sb) { + ResourceElementBeanProfile value, SafeHtmlBuilder sb) { if (value == null || !value.isToBeAdded() || value.isFolder()) { return; @@ -51,8 +51,8 @@ public class ResourceCellRight extends AbstractCell{ @Override public void onBrowserEvent(com.google.gwt.cell.client.Cell.Context context, - Element parent, ResourceElementBean value, NativeEvent event, - ValueUpdater valueUpdater) { + Element parent, ResourceElementBeanProfile value, NativeEvent event, + ValueUpdater valueUpdater) { if(value == null || TwinColumnSelectionMainPanel.isFroozen()) return; super.onBrowserEvent(context, parent, value, event, valueUpdater); diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceInfoForm.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceInfoForm.java index fabb27d..4b41426 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceInfoForm.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceInfoForm.java @@ -1,6 +1,6 @@ package org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection; -import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean; +import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile; import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.ControlGroup; @@ -44,7 +44,7 @@ public class ResourceInfoForm extends Composite{ @UiField ControlGroup controlName; - private ResourceElementBean resourceBean; + private ResourceElementBeanProfile resourceBean; private static ResourceInfoFormUiBinder uiBinder = GWT .create(ResourceInfoFormUiBinder.class); @@ -57,7 +57,7 @@ public class ResourceInfoForm extends Composite{ initWidget(uiBinder.createAndBindUi(this)); } - public ResourceInfoForm(final ResourceElementBean resource, final ValueUpdater valueUpdater) { + public ResourceInfoForm(final ResourceElementBeanProfile resource, final ValueUpdater valueUpdater) { initWidget(uiBinder.createAndBindUi(this)); resourceBean = resource; diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/TwinColumnSelectionMainPanel.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/TwinColumnSelectionMainPanel.java index 09b3800..4b68fd5 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/TwinColumnSelectionMainPanel.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/TwinColumnSelectionMainPanel.java @@ -7,7 +7,7 @@ import java.util.Iterator; import java.util.List; import java.util.Set; -import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBean; +import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile; import com.github.gwtbootstrap.client.ui.Breadcrumbs; import com.github.gwtbootstrap.client.ui.Button; @@ -72,9 +72,9 @@ public class TwinColumnSelectionMainPanel extends Composite{ */ private class PathBean{ NavLink link; - ResourceElementBean resourceFolder; + ResourceElementBeanProfile resourceFolder; - PathBean(NavLink link, ResourceElementBean resourceFolder){ + PathBean(NavLink link, ResourceElementBeanProfile resourceFolder){ this.link = link; this.resourceFolder = resourceFolder; } @@ -86,13 +86,13 @@ public class TwinColumnSelectionMainPanel extends Composite{ private static final String PANEL_HEIGHT = "400px"; private ShowMorePagerPanel showMorePanelLeft = new ShowMorePagerPanel(); private ShowMorePagerPanel showMorePanelRight = new ShowMorePagerPanel(); - private CellList cellListLeft; - private CellList cellListRight; - private ListDataProvider dataProviderLeft = new ListDataProvider(); - private ListDataProvider dataProviderRight = new ListDataProvider(); - private MultiSelectionModel selectionModelRight; - private MultiSelectionModel selectionModelLeft; - private final ResourceElementBean initialBean; + private CellList cellListLeft; + private CellList cellListRight; + private ListDataProvider dataProviderLeft = new ListDataProvider(); + private ListDataProvider dataProviderRight = new ListDataProvider(); + private MultiSelectionModel selectionModelRight; + private MultiSelectionModel selectionModelLeft; + private final ResourceElementBeanProfile initialBean; // private final static HTML aboutHeader = new HTML("Resource Manager"); // private final static HTML aboutBody = new HTML("

Move the files you want to attach to the product on the right panel below." // + " Please consider that any complex hierarchy structure you may have will be flatten.

"); @@ -106,7 +106,7 @@ public class TwinColumnSelectionMainPanel extends Composite{ UiBinder { } - public TwinColumnSelectionMainPanel(ResourceElementBean initialBean) { + public TwinColumnSelectionMainPanel(ResourceElementBeanProfile initialBean) { initWidget(uiBinder.createAndBindUi(this)); frozen = false; @@ -143,13 +143,13 @@ public class TwinColumnSelectionMainPanel extends Composite{ /** * Initialize the left side panel */ - private void initLeftSidePanel(final ResourceElementBean initialBean) { + private void initLeftSidePanel(final ResourceElementBeanProfile initialBean) { // initialize the left side list ResourceCellLeft cell = new ResourceCellLeft(); // Set a key provider that provides a unique key for each object. - cellListLeft = new CellList(cell, ResourceElementBean.KEY_PROVIDER); + cellListLeft = new CellList(cell, ResourceElementBeanProfile.KEY_PROVIDER); cellListLeft.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE); // set page size @@ -157,7 +157,7 @@ public class TwinColumnSelectionMainPanel extends Composite{ cellListLeft.setPageSize(size); // Add a selection model so we can select cells. - selectionModelLeft = new MultiSelectionModel(ResourceElementBean.KEY_PROVIDER); + selectionModelLeft = new MultiSelectionModel(ResourceElementBeanProfile.KEY_PROVIDER); cellListLeft.setSelectionModel(selectionModelLeft); // perform an action on selection @@ -168,10 +168,10 @@ public class TwinColumnSelectionMainPanel extends Composite{ if(frozen) return; - Iterator selectedObjectsIterator = selectionModelLeft.getSelectedSet().iterator(); + Iterator selectedObjectsIterator = selectionModelLeft.getSelectedSet().iterator(); while (selectedObjectsIterator.hasNext()) { - ResourceElementBean selectedBean = selectedObjectsIterator.next(); + ResourceElementBeanProfile selectedBean = selectedObjectsIterator.next(); if(selectedBean.isFolder()){ // a single folder selected @@ -190,7 +190,7 @@ public class TwinColumnSelectionMainPanel extends Composite{ removeStartingFromBreadcrumbs(navElem, pathBean); GWT.log("Clicked on element " + pathBean.resourceFolder.getName()); //breadcrumbsUpdater(); - ResourceElementBean folder = pathBean.resourceFolder; + ResourceElementBeanProfile folder = pathBean.resourceFolder; Collections.sort(folder.getChildren()); dataProviderLeft.setList(folder.getChildren()); dataProviderLeft.refresh(); @@ -306,12 +306,12 @@ public class TwinColumnSelectionMainPanel extends Composite{ ResourceCellRight cell = new ResourceCellRight(); // Set a key provider that provides a unique key for each object. - cellListRight = new CellList(cell, ResourceElementBean.KEY_PROVIDER); + cellListRight = new CellList(cell, ResourceElementBeanProfile.KEY_PROVIDER); cellListRight.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE); - cellListRight.setValueUpdater(new ValueUpdater() { + cellListRight.setValueUpdater(new ValueUpdater() { @Override - public void update(ResourceElementBean value) { + public void update(ResourceElementBeanProfile value) { // just redraw the list cellListRight.redraw(); @@ -320,7 +320,7 @@ public class TwinColumnSelectionMainPanel extends Composite{ }); // Add a selection model so we can select cells. - selectionModelRight = new MultiSelectionModel(ResourceElementBean.KEY_PROVIDER); + selectionModelRight = new MultiSelectionModel(ResourceElementBeanProfile.KEY_PROVIDER); cellListRight.setSelectionModel(selectionModelRight); // perform an action on selection @@ -353,7 +353,7 @@ public class TwinColumnSelectionMainPanel extends Composite{ * Enable/disable the buttons to move objects from left to right properly. * @param setselectedItemsLeft */ - private void enableMoveToRightButtons(Set setselectedItemsLeft){ + private void enableMoveToRightButtons(Set setselectedItemsLeft){ if(setselectedItemsLeft == null || setselectedItemsLeft.isEmpty()){ allToRightButton.setEnabled(false); @@ -373,7 +373,7 @@ public class TwinColumnSelectionMainPanel extends Composite{ * Enable/disable the buttons to move objects from right to left properly. * @param setselectedItemsRight */ - private void enableMoveToLeftButtons(Set setselectedItemsRight){ + private void enableMoveToLeftButtons(Set setselectedItemsRight){ if(setselectedItemsRight == null || setselectedItemsRight.isEmpty()){ allToLeftButton.setEnabled(false); @@ -427,14 +427,14 @@ public class TwinColumnSelectionMainPanel extends Composite{ * Move to right elements * @param set the elements to move */ - private void moveToRight(Set setSelected){ + private void moveToRight(Set setSelected){ if(setSelected == null || setSelected.isEmpty()) return; - Iterator iterator = setSelected.iterator(); + Iterator iterator = setSelected.iterator(); while (iterator.hasNext()) { - ResourceElementBean resourceElementBean = iterator + ResourceElementBeanProfile resourceElementBean = iterator .next(); resourceElementBean.setToBeAdded(true); @@ -456,14 +456,14 @@ public class TwinColumnSelectionMainPanel extends Composite{ * Move to left elements * @param setSelected the elements to move */ - private void moveToLeft(Set setSelected){ + private void moveToLeft(Set setSelected){ if(setSelected == null || setSelected.isEmpty()) return; - Iterator iterator = setSelected.iterator(); + Iterator iterator = setSelected.iterator(); while (iterator.hasNext()) { - ResourceElementBean resourceElementBean = iterator.next(); + ResourceElementBeanProfile resourceElementBean = iterator.next(); resourceElementBean.setToBeAdded(false); } @@ -496,16 +496,16 @@ public class TwinColumnSelectionMainPanel extends Composite{ * Returns the root parent with the children as files to save * @return the resources to save */ - public ResourceElementBean getResourcesToPublish(){ + public ResourceElementBeanProfile getResourcesToPublish(){ - List current = dataProviderRight.getList(); + List current = dataProviderRight.getList(); - ResourceElementBean toReturn = new ResourceElementBean(); - List children = new ArrayList(); + ResourceElementBeanProfile toReturn = new ResourceElementBeanProfile(); + List children = new ArrayList(); - for (ResourceElementBean resource : current) { + for (ResourceElementBeanProfile resource : current) { if(resource.isToBeAdded() && !resource.isFolder()){ // be sure ... - ResourceElementBean beanWithoutChildren = new ResourceElementBean(resource); + ResourceElementBeanProfile beanWithoutChildren = new ResourceElementBeanProfile(resource); beanWithoutChildren.setName(resource.getEditableName()); children.add(beanWithoutChildren); } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/DatasetBean.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/DatasetBean.java index 8f27e03..02b8b12 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/DatasetBean.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/DatasetBean.java @@ -29,14 +29,14 @@ // private String selectedOrganization; // private long version; // version 1, 2 ... // private boolean visible; // Private (false) or Public(true) -// private List organizationList; // list of organization in which the user is present and could create the dataset -// private ResourceElementBean resourceRoot; // in case of workspace, this is the directory root or the single file information +// private List organizationList; // list of organization in which the user is present and could create the dataset +// private ResourceElementBeanProfile resourceRoot; // in case of workspace, this is the directory root or the single file information // private List metadataList; // private List tags; // on retrieve, they are the keys of the product // private List tagsVocabulary; // when available // private Map> customFields; -// private List groups; -// private List groupsForceCreation; +// private List groups; +// private List groupsForceCreation; // // public DatasetBean(){ // super(); @@ -68,9 +68,9 @@ // String license, boolean visible, String source, long version, // String authorName, String authorSurname, String authorEmail, String maintainer, // String maintainerEmail, String ownerIdentifier, -// List organizationList, String selectedOrganization, -// ResourceElementBean resourceRoot, -// List metadataList, List groups, List tagsVocabulary) { +// List organizationList, String selectedOrganization, +// ResourceElementBeanProfile resourceRoot, +// List metadataList, List groups, List tagsVocabulary) { // super(); // this.id = id; // this.title = title; @@ -231,11 +231,11 @@ // this.maintainerEmail = maintainerEmail; // } // -// public List getOrganizationList() { +// public List getOrganizationList() { // return organizationList; // } // -// public void setOrganizationList(List organizationList) { +// public void setOrganizationList(List organizationList) { // this.organizationList = organizationList; // } // @@ -247,11 +247,11 @@ // this.selectedOrganization = selectedOrganization; // } // -// public ResourceElementBean getResourceRoot() { +// public ResourceElementBeanProfile getResourceRoot() { // return resourceRoot; // } // -// public void setResourceRoot(ResourceElementBean resourceRoot) { +// public void setResourceRoot(ResourceElementBeanProfile resourceRoot) { // this.resourceRoot = resourceRoot; // } // @@ -263,11 +263,11 @@ // this.authorFullName = authorFullName; // } // -// public List getGroups() { +// public List getGroups() { // return groups; // } // -// public void setGroups(List groups) { +// public void setGroups(List groups) { // this.groups = groups; // } // @@ -279,11 +279,11 @@ // this.tagsVocabulary = tagsVocabulary; // } // -// public List getGroupsForceCreation() { +// public List getGroupsForceCreation() { // return groupsForceCreation; // } // -// public void setGroupsForceCreation(List groupsForceCreation) { +// public void setGroupsForceCreation(List groupsForceCreation) { // this.groupsForceCreation = groupsForceCreation; // } // diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBean.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBeanProfile.java similarity index 80% rename from src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBean.java rename to src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBeanProfile.java index 3b4fd82..0ea3f25 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBean.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBeanProfile.java @@ -6,7 +6,7 @@ import java.io.Serializable; * A ckan organization/group (you can check its nature by looking at getIsOrganization();) like bean with name and title * @author Costantino Perciante (costantino.perciante@isti.cnr.it) */ -public class OrganizationBean implements Serializable{ +public class OrganizationBeanProfile implements Serializable{ private static final long serialVersionUID = -6566519399945530602L; private String title; @@ -14,18 +14,18 @@ public class OrganizationBean implements Serializable{ private boolean isOrganization; private boolean propagateUp; // an item linked to this group has to be added on the whole hierarchy chain - public OrganizationBean(){ + public OrganizationBeanProfile(){ super(); } - public OrganizationBean(String title, String name, boolean isOrganization) { + public OrganizationBeanProfile(String title, String name, boolean isOrganization) { super(); this.title = title; this.name = name; this.isOrganization = isOrganization; } - public OrganizationBean(String title, String name, boolean isOrganization, boolean propagateUp) { + public OrganizationBeanProfile(String title, String name, boolean isOrganization, boolean propagateUp) { super(); this.title = title; this.name = name; @@ -67,7 +67,7 @@ public class OrganizationBean implements Serializable{ @Override public String toString() { - return "OrganizationBean [title=" + title + ", name=" + name + return "OrganizationBeanProfile [title=" + title + ", name=" + name + ", isOrganization=" + isOrganization + ", propagateUp=" + propagateUp + "]"; } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBean.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBeanProfile.java similarity index 79% rename from src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBean.java rename to src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBeanProfile.java index a40972e..a791ff4 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBean.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBeanProfile.java @@ -10,7 +10,7 @@ import com.google.gwt.view.client.ProvidesKey; * A resource element bean. Contains part of the logic used into the TwinColumn widget * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) */ -public class ResourceElementBean implements Comparable, Serializable{ +public class ResourceElementBeanProfile implements Comparable, Serializable{ private static final long serialVersionUID = -1230871392599580669L; private String name; @@ -23,8 +23,8 @@ public class ResourceElementBean implements Comparable, Ser private String url; private String description; private String organizationNameDatasetParent; // the organization name in which the parent dataset was created - private ResourceElementBean parent; - private List children; + private ResourceElementBeanProfile parent; + private List children; // to generate the GWT identifiers private static int nextId = 0; @@ -35,9 +35,9 @@ public class ResourceElementBean implements Comparable, Ser /** * The key provider that provides the unique ID of a bean. */ - public static final ProvidesKey KEY_PROVIDER = new ProvidesKey() { + public static final ProvidesKey KEY_PROVIDER = new ProvidesKey() { @Override - public Object getKey(ResourceElementBean item) { + public Object getKey(ResourceElementBeanProfile item) { return item == null ? null : item.identifierGWT; } }; @@ -46,7 +46,7 @@ public class ResourceElementBean implements Comparable, Ser * Copy constructor * @param another */ - public ResourceElementBean(ResourceElementBean another) { + public ResourceElementBeanProfile(ResourceElementBeanProfile another) { this.name = another.name; this.toBeAdded = another.toBeAdded; this.fullPath = another.fullPath; @@ -61,7 +61,7 @@ public class ResourceElementBean implements Comparable, Ser /** * Default constructor */ - public ResourceElementBean(){ + public ResourceElementBeanProfile(){ super(); this.identifierGWT = nextId; nextId++; @@ -74,11 +74,11 @@ public class ResourceElementBean implements Comparable, Ser * @param movedToRight * @param isFolder */ - public ResourceElementBean( - ResourceElementBean parent, + public ResourceElementBeanProfile( + ResourceElementBeanProfile parent, String name, boolean isFolder, - List children, + List children, String fullPath) { this.identifierGWT = nextId; nextId++; @@ -102,9 +102,9 @@ public class ResourceElementBean implements Comparable, Ser * @param description * @param organizationNameDatasetParent */ - public ResourceElementBean(String name, boolean toBeAdded, - boolean isFolder, ResourceElementBean parent, - List children, String fullPath, + public ResourceElementBeanProfile(String name, boolean toBeAdded, + boolean isFolder, ResourceElementBeanProfile parent, + List children, String fullPath, String originalIdInWorkspace, String mimeType, String url, String description, String organizationNameDatasetParent) { super(); @@ -123,11 +123,11 @@ public class ResourceElementBean implements Comparable, Ser this.organizationNameDatasetParent = organizationNameDatasetParent; } - public ResourceElementBean getParent() { + public ResourceElementBeanProfile getParent() { return parent; } - public void setParent(ResourceElementBean parent) { + public void setParent(ResourceElementBeanProfile parent) { this.parent = parent; } @@ -188,11 +188,11 @@ public class ResourceElementBean implements Comparable, Ser this.isFolder = isFolder; } - public List getChildren() { + public List getChildren() { return children; } - public void setChildren(List children) { + public void setChildren(List children) { this.children = children; } @@ -223,22 +223,22 @@ public class ResourceElementBean implements Comparable, Ser @Override public boolean equals(Object o) { boolean toReturn = false; - if (o instanceof ResourceElementBean) { - toReturn = identifierGWT == ((ResourceElementBean) o).identifierGWT; + if (o instanceof ResourceElementBeanProfile) { + toReturn = identifierGWT == ((ResourceElementBeanProfile) o).identifierGWT; } return toReturn; } @Override - public int compareTo(ResourceElementBean o) { + public int compareTo(ResourceElementBeanProfile o) { int toReturn = (o == null || o.fullPath == null) ? -1 : -o.fullPath.compareTo(fullPath); return toReturn; } @Override public String toString() { - return "ResourceElementBean [identifierGWT=" + identifierGWT + return "ResourceElementBeanProfile [identifierGWT=" + identifierGWT + ", name=" + name + ", editableName=" + editableName + ", toBeAdded=" + toBeAdded + ", isFolder=" + isFolder + ", fullPath=" + fullPath + ", originalIdInWorkspace=" From 67591125e695d0b9338142008dd2e1fe382ab417 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Mon, 5 Feb 2024 14:10:57 +0100 Subject: [PATCH 03/10] refactored to CustomFieldEntryProfile --- .../client/events/DeleteCustomFieldEvent.java | 8 ++++---- .../client/form/catalogue/CreateDatasetForm.java | 14 +++++++------- .../client/form/generic/CreateMetadataForm.java | 15 ++++++--------- ...eldEntry.java => CustomFieldEntryProfile.java} | 6 +++--- ...ntry.ui.xml => CustomFieldEntryProfile.ui.xml} | 0 5 files changed, 20 insertions(+), 23 deletions(-) rename src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/{CustomFieldEntry.java => CustomFieldEntryProfile.java} (91%) rename src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/{CustomFieldEntry.ui.xml => CustomFieldEntryProfile.ui.xml} (100%) diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldEvent.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldEvent.java index 41d01ab..d8a3ba5 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldEvent.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldEvent.java @@ -1,5 +1,5 @@ package org.gcube.portlets.widgets.mpformbuilder.client.events; -import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEntry; +import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEntryProfile; import com.google.gwt.event.shared.GwtEvent; @@ -10,13 +10,13 @@ import com.google.gwt.event.shared.GwtEvent; public class DeleteCustomFieldEvent extends GwtEvent { public static Type TYPE = new Type(); - private CustomFieldEntry removedEntry; + private CustomFieldEntryProfile removedEntry; - public DeleteCustomFieldEvent(CustomFieldEntry removedEntry) { + public DeleteCustomFieldEvent(CustomFieldEntryProfile removedEntry) { this.removedEntry = removedEntry; } - public CustomFieldEntry getRemovedEntry() { + public CustomFieldEntryProfile getRemovedEntry() { return removedEntry; } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.java index 1665743..6720318 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.java @@ -17,7 +17,7 @@ //import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldEventHandler; //import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField; //import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CategoryPanel; -//import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEntry; +//import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEntryProfile; //import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton; //import org.gcube.portlets.widgets.mpformbuilder.client.ui.resources.AddResourceContainer; //import org.gcube.portlets.widgets.mpformbuilder.client.ui.resources.AddResourceToDataset; @@ -190,7 +190,7 @@ // private HandlerManager eventBus; // // // added custom field entries (by the user) -// private List customFieldEntriesList = new ArrayList(); +// private List customFieldEntriesList = new ArrayList(); // // // the list of MetaDataField added // private List listOfMetadataFields = new ArrayList(); @@ -342,7 +342,7 @@ // // for (String value : values) { // // these are fixed key, variable value custom fields -// CustomFieldEntry toAdd = new CustomFieldEntry(eventBus, entry.getKey(), value, false); +// CustomFieldEntryProfile toAdd = new CustomFieldEntryProfile(eventBus, entry.getKey(), value, false); // customFieldEntriesList.add(toAdd); // customFields.add(toAdd); // @@ -796,7 +796,7 @@ // @UiHandler("addCustomFieldButton") // void addCustomFieldEvent(ClickEvent e){ // -// CustomFieldEntry toAdd = new CustomFieldEntry(eventBus, "", "", true); +// CustomFieldEntryProfile toAdd = new CustomFieldEntryProfile(eventBus, "", "", true); // customFieldEntriesList.add(toAdd); // customFields.add(toAdd); // @@ -993,7 +993,7 @@ // } // } // -// for(CustomFieldEntry customEntry : customFieldEntriesList){ +// for(CustomFieldEntryProfile customEntry : customFieldEntriesList){ // String key = customEntry.getKey(); // String value = customEntry.getValue(); // if(value != null && !value.isEmpty()){ @@ -1454,7 +1454,7 @@ // groupsListbox.setItemSelected(i, false); // // // delete custom fields -// for (CustomFieldEntry customField : customFieldEntriesList) { +// for (CustomFieldEntryProfile customField : customFieldEntriesList) { // customField.removeFromParent(); // } // customFieldEntriesList.clear(); @@ -1478,7 +1478,7 @@ // metadataTypeListbox.setEnabled(false); // groupsListbox.setEnabled(false); // -// for(CustomFieldEntry ce: customFieldEntriesList) +// for(CustomFieldEntryProfile ce: customFieldEntriesList) // ce.freeze(); // // // disable profile fields diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java index e6ad544..b3e530e 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java @@ -16,7 +16,7 @@ import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField; import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.GenericFormEventsListener; import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.HasGenericFormListenerRegistration; import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CategoryPanel; -import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEntry; +import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEntryProfile; import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton; import org.gcube.portlets.widgets.mpformbuilder.client.ui.resources.AddResourceToDataset; import org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection.TwinColumnSelectionMainPanel; @@ -205,9 +205,6 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe /** The Constant TRYING_TO_CREATE_PRODUCT. */ private static final String DATA_FORM_FILLED_IN_CORRECTLY = "Very well!!! Data form filled in correclty!"; - /** The Constant MISSING_PUBLISH_RIGHTS. */ - protected static final String MISSING_PUBLISH_RIGHTS = "It seems you are not authorized to publish on catalogue. Request it to the VRE manager or the portal administrator."; - /** The tab panel. */ // tab panel private TabPanel tabPanel; @@ -228,7 +225,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe /** The custom field entries list. */ // added custom field entries (by the user) - private List customFieldEntriesList = new ArrayList(); + private List customFieldEntriesList = new ArrayList(); /** The list of metadata fields. */ // the list of MetaDataField added @@ -611,7 +608,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe @UiHandler("addCustomFieldButton") void addCustomFieldEvent(ClickEvent e) { - CustomFieldEntry toAdd = new CustomFieldEntry(uiBus, "", "", true); + CustomFieldEntryProfile toAdd = new CustomFieldEntryProfile(uiBus, "", "", true); customFieldEntriesList.add(toAdd); customFields.add(toAdd); @@ -686,7 +683,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe } } - for (CustomFieldEntry customEntry : customFieldEntriesList) { + for (CustomFieldEntryProfile customEntry : customFieldEntriesList) { String key = customEntry.getKey(); String value = customEntry.getValue(); if (value != null && !value.isEmpty()) { @@ -856,7 +853,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe /* * @UiHandler("resetButton") void resetFormEvent(ClickEvent e){ * - * // delete custom fields for (CustomFieldEntry customField : + * // delete custom fields for (CustomFieldEntryProfile customField : * customFieldEntriesList) { customField.removeFromParent(); } * customFieldEntriesList.clear(); } */ @@ -871,7 +868,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe addCustomFieldButton.setEnabled(!bool); metadataTypeListbox.setEnabled(!bool); - for (CustomFieldEntry ce : customFieldEntriesList) + for (CustomFieldEntryProfile ce : customFieldEntriesList) ce.freeze(!bool); // disable profile fields diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntry.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntryProfile.java similarity index 91% rename from src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntry.java rename to src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntryProfile.java index 8332893..9799cef 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntry.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntryProfile.java @@ -18,13 +18,13 @@ import com.google.gwt.user.client.ui.Widget; * A custom field entry that has two textboxes, one for the key value and the other for the value. * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) */ -public class CustomFieldEntry extends Composite { +public class CustomFieldEntryProfile extends Composite { private static CustomFieldEntryUiBinder uiBinder = GWT .create(CustomFieldEntryUiBinder.class); interface CustomFieldEntryUiBinder extends - UiBinder { + UiBinder { } @UiField InputAddOn keyFieldPrepend; @@ -39,7 +39,7 @@ public class CustomFieldEntry extends Composite { // event bus private HandlerManager eventBus; - public CustomFieldEntry(HandlerManager eventBus, String key, String value, boolean isCustomCreatedByUser) { + public CustomFieldEntryProfile(HandlerManager eventBus, String key, String value, boolean isCustomCreatedByUser) { initWidget(uiBinder.createAndBindUi(this)); // save information diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntry.ui.xml b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntryProfile.ui.xml similarity index 100% rename from src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntry.ui.xml rename to src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntryProfile.ui.xml From cb9629d85aac26884f10ac2aca1ca9791a7ee62d Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Thu, 8 Feb 2024 12:32:20 +0100 Subject: [PATCH 04/10] Updated. Managing addTagElement to Vocabulary --- .../widgets/mpformbuilder/client/ui/tags/TagsPanel.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/tags/TagsPanel.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/tags/TagsPanel.java index d36373e..c358231 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/tags/TagsPanel.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/tags/TagsPanel.java @@ -176,6 +176,12 @@ public class TagsPanel extends Composite{ if(tagsList.contains(tag)) return; + + //selecting the item of the vocabulary + if(vocabulary!= null && vocabulary.size()>0) { + tagsEnterListBox.setSelectedValue(tag); + return; + } // ckan accepts only alphanumeric values String[] subTags = tag.trim().split(" "); From 506df65613406672a22d42e331273d90bb926f9d Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Mon, 12 Feb 2024 12:01:59 +0100 Subject: [PATCH 05/10] removed catalogue package. Refactored Resource Events --- .../events/AddResourceEventHandler.java | 11 - ...vent.java => AddResourceEventProfile.java} | 10 +- .../AddResourceEventProfileHandler.java | 21 + .../client/events/CloseCreationFormEvent.java | 27 - .../events/CloseCreationFormEventHandler.java | 13 - .../events/CloseCreationFormProfileEvent.java | 44 + .../CloseCreationFormProfileEventHandler.java | 20 + ...ava => DeleteCustomFieldProfileEvent.java} | 10 +- ...DeleteCustomFieldProfileEventHandler.java} | 6 +- ...t.java => DeleteResourceProfileEvent.java} | 10 +- ...=> DeleteResourceProfileEventHandler.java} | 4 +- .../form/catalogue/CreateDatasetForm.java | 1575 ----------------- .../form/catalogue/CreateDatasetForm.ui.xml | 410 ----- .../form/generic/CreateMetadataForm.java | 16 +- .../ui/metadata/CustomFieldEntryProfile.java | 4 +- .../ui/metadata/MetaDataFieldSkeleton.java | 8 +- .../ui/resources/AddResourceToDataset.java | 2 +- ...java => AddedResourcesSummaryProfile.java} | 52 +- ...ml => AddedResourcesSummaryProfile.ui.xml} | 0 .../shared/metadata/MetadataFieldWrapper.java | 2 +- 20 files changed, 147 insertions(+), 2098 deletions(-) delete mode 100644 src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEventHandler.java rename src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/{AddResourceEvent.java => AddResourceEventProfile.java} (58%) create mode 100644 src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEventProfileHandler.java delete mode 100644 src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormEvent.java delete mode 100644 src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormEventHandler.java create mode 100644 src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormProfileEvent.java create mode 100644 src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormProfileEventHandler.java rename src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/{DeleteCustomFieldEvent.java => DeleteCustomFieldProfileEvent.java} (56%) rename src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/{DeleteCustomFieldEventHandler.java => DeleteCustomFieldProfileEventHandler.java} (51%) rename src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/{DeleteResourceEvent.java => DeleteResourceProfileEvent.java} (57%) rename src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/{DeleteResourceEventHandler.java => DeleteResourceProfileEventHandler.java} (61%) delete mode 100644 src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.java delete mode 100644 src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.ui.xml rename src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/{AddedResourcesSummary.java => AddedResourcesSummaryProfile.java} (73%) rename src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/{AddedResourcesSummary.ui.xml => AddedResourcesSummaryProfile.ui.xml} (100%) diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEventHandler.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEventHandler.java deleted file mode 100644 index f73c2d5..0000000 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEventHandler.java +++ /dev/null @@ -1,11 +0,0 @@ -package org.gcube.portlets.widgets.mpformbuilder.client.events; - -import com.google.gwt.event.shared.EventHandler; - -/** - * Added resource handler interface - * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) - */ -public interface AddResourceEventHandler extends EventHandler { - void onAddedResource(AddResourceEvent addResourceEvent); -} diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEvent.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEventProfile.java similarity index 58% rename from src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEvent.java rename to src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEventProfile.java index af65fd5..b88e39c 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEvent.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEventProfile.java @@ -8,12 +8,12 @@ import com.google.gwt.event.shared.GwtEvent; * Added resource event * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) */ -public class AddResourceEvent extends GwtEvent { - public static Type TYPE = new Type(); +public class AddResourceEventProfile extends GwtEvent { + public static Type TYPE = new Type(); private ResourceElementBeanProfile resource; - public AddResourceEvent(ResourceElementBeanProfile resource) { + public AddResourceEventProfile(ResourceElementBeanProfile resource) { this.resource = resource; } @@ -22,12 +22,12 @@ public class AddResourceEvent extends GwtEvent { } @Override - public Type getAssociatedType() { + public Type getAssociatedType() { return TYPE; } @Override - protected void dispatch(AddResourceEventHandler handler) { + protected void dispatch(AddResourceEventProfileHandler handler) { handler.onAddedResource(this); } } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEventProfileHandler.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEventProfileHandler.java new file mode 100644 index 0000000..ac7f282 --- /dev/null +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/AddResourceEventProfileHandler.java @@ -0,0 +1,21 @@ +package org.gcube.portlets.widgets.mpformbuilder.client.events; + +import com.google.gwt.event.shared.EventHandler; + + +/** + * The Interface AddResourceEventProfileHandler. + * + * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it + * + * Feb 12, 2024 + */ +public interface AddResourceEventProfileHandler extends EventHandler { + + /** + * On added resource. + * + * @param addResourceEvent the add resource event + */ + void onAddedResource(AddResourceEventProfile addResourceEvent); +} diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormEvent.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormEvent.java deleted file mode 100644 index 1f0a215..0000000 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormEvent.java +++ /dev/null @@ -1,27 +0,0 @@ -package org.gcube.portlets.widgets.mpformbuilder.client.events; - -import com.google.gwt.event.shared.GwtEvent; - -/** - * Called on close form. - * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) - */ -public class CloseCreationFormEvent extends GwtEvent{ - - public static Type TYPE = new Type(); - - public CloseCreationFormEvent() { - super(); - } - - @Override - public Type getAssociatedType() { - return TYPE; - } - - @Override - protected void dispatch(CloseCreationFormEventHandler handler) { - handler.onClose(this); - } - -} diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormEventHandler.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormEventHandler.java deleted file mode 100644 index 203d211..0000000 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormEventHandler.java +++ /dev/null @@ -1,13 +0,0 @@ -package org.gcube.portlets.widgets.mpformbuilder.client.events; - -import com.google.gwt.event.shared.EventHandler; - -/** - * Close event handler interface - * @author Costantino Perciante at ISTI-CNR - * (costantino.perciante@isti.cnr.it) - * - */ -public interface CloseCreationFormEventHandler extends EventHandler { - void onClose(CloseCreationFormEvent event); -} diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormProfileEvent.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormProfileEvent.java new file mode 100644 index 0000000..cb2d18f --- /dev/null +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormProfileEvent.java @@ -0,0 +1,44 @@ +package org.gcube.portlets.widgets.mpformbuilder.client.events; + +import com.google.gwt.event.shared.GwtEvent; + + +/** + * The Class CloseCreationFormProfileEvent. + * + * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it + * + * Feb 12, 2024 + */ +public class CloseCreationFormProfileEvent extends GwtEvent{ + + public static Type TYPE = new Type(); + + /** + * Instantiates a new close creation form profile event. + */ + public CloseCreationFormProfileEvent() { + super(); + } + + /** + * Gets the associated type. + * + * @return the associated type + */ + @Override + public Type getAssociatedType() { + return TYPE; + } + + /** + * Dispatch. + * + * @param handler the handler + */ + @Override + protected void dispatch(CloseCreationFormProfileEventHandler handler) { + handler.onClose(this); + } + +} diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormProfileEventHandler.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormProfileEventHandler.java new file mode 100644 index 0000000..5a4bbc8 --- /dev/null +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/CloseCreationFormProfileEventHandler.java @@ -0,0 +1,20 @@ +package org.gcube.portlets.widgets.mpformbuilder.client.events; + +import com.google.gwt.event.shared.EventHandler; + +/** + * The Interface CloseCreationFormProfileEventHandler. + * + * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it + * + * Feb 12, 2024 + */ +public interface CloseCreationFormProfileEventHandler extends EventHandler { + + /** + * On close. + * + * @param event the event + */ + void onClose(CloseCreationFormProfileEvent event); +} diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldEvent.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldProfileEvent.java similarity index 56% rename from src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldEvent.java rename to src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldProfileEvent.java index d8a3ba5..8425a72 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldEvent.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldProfileEvent.java @@ -7,12 +7,12 @@ import com.google.gwt.event.shared.GwtEvent; * Delete custom field event. * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) */ -public class DeleteCustomFieldEvent extends GwtEvent { - public static Type TYPE = new Type(); +public class DeleteCustomFieldProfileEvent extends GwtEvent { + public static Type TYPE = new Type(); private CustomFieldEntryProfile removedEntry; - public DeleteCustomFieldEvent(CustomFieldEntryProfile removedEntry) { + public DeleteCustomFieldProfileEvent(CustomFieldEntryProfile removedEntry) { this.removedEntry = removedEntry; } @@ -21,12 +21,12 @@ public class DeleteCustomFieldEvent extends GwtEvent getAssociatedType() { + public Type getAssociatedType() { return TYPE; } @Override - protected void dispatch(DeleteCustomFieldEventHandler handler) { + protected void dispatch(DeleteCustomFieldProfileEventHandler handler) { handler.onRemoveEntry(this); } } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldEventHandler.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldProfileEventHandler.java similarity index 51% rename from src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldEventHandler.java rename to src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldProfileEventHandler.java index a8db9df..5825d54 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldEventHandler.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteCustomFieldProfileEventHandler.java @@ -3,9 +3,9 @@ package org.gcube.portlets.widgets.mpformbuilder.client.events; import com.google.gwt.event.shared.EventHandler; /** - * Handler associated to the DeleteCustomFieldEvent + * Handler associated to the DeleteCustomFieldProfileEvent * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) */ -public interface DeleteCustomFieldEventHandler extends EventHandler { - void onRemoveEntry(DeleteCustomFieldEvent event); +public interface DeleteCustomFieldProfileEventHandler extends EventHandler { + void onRemoveEntry(DeleteCustomFieldProfileEvent event); } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceEvent.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceProfileEvent.java similarity index 57% rename from src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceEvent.java rename to src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceProfileEvent.java index 6a08831..e0cc3ef 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceEvent.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceProfileEvent.java @@ -8,12 +8,12 @@ import com.google.gwt.event.shared.GwtEvent; * Deleted resource event. * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) */ -public class DeleteResourceEvent extends GwtEvent { - public static Type TYPE = new Type(); +public class DeleteResourceProfileEvent extends GwtEvent { + public static Type TYPE = new Type(); private ResourceElementBeanProfile resource; - public DeleteResourceEvent(ResourceElementBeanProfile resource) { + public DeleteResourceProfileEvent(ResourceElementBeanProfile resource) { this.resource = resource; } @@ -22,12 +22,12 @@ public class DeleteResourceEvent extends GwtEvent { } @Override - public Type getAssociatedType() { + public Type getAssociatedType() { return TYPE; } @Override - protected void dispatch(DeleteResourceEventHandler handler) { + protected void dispatch(DeleteResourceProfileEventHandler handler) { handler.onDeletedResource(this); } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceEventHandler.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceProfileEventHandler.java similarity index 61% rename from src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceEventHandler.java rename to src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceProfileEventHandler.java index f972473..432ad5e 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceEventHandler.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/events/DeleteResourceProfileEventHandler.java @@ -6,6 +6,6 @@ import com.google.gwt.event.shared.EventHandler; * The delete event handler * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) */ -public interface DeleteResourceEventHandler extends EventHandler{ - void onDeletedResource(DeleteResourceEvent deleteResourceEvent); +public interface DeleteResourceProfileEventHandler extends EventHandler{ + void onDeletedResource(DeleteResourceProfileEvent deleteResourceEvent); } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.java deleted file mode 100644 index 6720318..0000000 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.java +++ /dev/null @@ -1,1575 +0,0 @@ -//package org.gcube.portlets.widgets.mpformbuilder.client.form.catalogue; -// -//import java.util.ArrayList; -//import java.util.HashMap; -//import java.util.HashSet; -//import java.util.Iterator; -//import java.util.List; -//import java.util.Map; -//import java.util.Map.Entry; -//import java.util.Set; -// -//import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync; -//import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderService; -//import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormEvent; -//import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormEventHandler; -//import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldEvent; -//import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldEventHandler; -//import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField; -//import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CategoryPanel; -//import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEntryProfile; -//import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton; -//import org.gcube.portlets.widgets.mpformbuilder.client.ui.resources.AddResourceContainer; -//import org.gcube.portlets.widgets.mpformbuilder.client.ui.resources.AddResourceToDataset; -//import org.gcube.portlets.widgets.mpformbuilder.client.ui.resources.AddedResourcesSummary; -//import org.gcube.portlets.widgets.mpformbuilder.client.ui.tags.TagsPanel; -//import org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection.TwinColumnSelectionMainPanel; -//import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.InfoIconsLabels; -//import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.DatasetBean; -//import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.OrganizationBeanProfile; -//import org.gcube.portlets.widgets.mpformbuilder.shared.license.LicenseBean; -//import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.CategoryWrapper; -//import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean; -//import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetadataFieldWrapper; -// -//import com.github.gwtbootstrap.client.ui.AlertBlock; -//import com.github.gwtbootstrap.client.ui.Button; -//import com.github.gwtbootstrap.client.ui.ControlGroup; -//import com.github.gwtbootstrap.client.ui.Form; -//import com.github.gwtbootstrap.client.ui.Icon; -//import com.github.gwtbootstrap.client.ui.ListBox; -//import com.github.gwtbootstrap.client.ui.Paragraph; -//import com.github.gwtbootstrap.client.ui.Popover; -//import com.github.gwtbootstrap.client.ui.Tab; -//import com.github.gwtbootstrap.client.ui.TabPanel; -//import com.github.gwtbootstrap.client.ui.TextArea; -//import com.github.gwtbootstrap.client.ui.TextBox; -//import com.github.gwtbootstrap.client.ui.constants.AlertType; -//import com.github.gwtbootstrap.client.ui.constants.ControlGroupType; -//import com.github.gwtbootstrap.client.ui.resources.Bootstrap.Tabs; -//import com.google.gwt.core.client.GWT; -//import com.google.gwt.dom.client.SelectElement; -//import com.google.gwt.dom.client.Style.Unit; -//import com.google.gwt.event.dom.client.ChangeEvent; -//import com.google.gwt.event.dom.client.ChangeHandler; -//import com.google.gwt.event.dom.client.ClickEvent; -//import com.google.gwt.event.dom.client.ClickHandler; -//import com.google.gwt.event.shared.HandlerManager; -//import com.google.gwt.uibinder.client.UiBinder; -//import com.google.gwt.uibinder.client.UiField; -//import com.google.gwt.uibinder.client.UiHandler; -//import com.google.gwt.user.client.Timer; -//import com.google.gwt.user.client.Window; -//import com.google.gwt.user.client.rpc.AsyncCallback; -//import com.google.gwt.user.client.ui.Anchor; -//import com.google.gwt.user.client.ui.Composite; -//import com.google.gwt.user.client.ui.FocusPanel; -//import com.google.gwt.user.client.ui.HTMLPanel; -//import com.google.gwt.user.client.ui.HorizontalPanel; -//import com.google.gwt.user.client.ui.SimplePanel; -//import com.google.gwt.user.client.ui.VerticalPanel; -//import com.google.gwt.user.client.ui.Widget; -// -///** -// * Create metadata form for ckan product. -// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) -// */ -//public class CreateDatasetForm extends Composite{ -// -// private static EditMetadataFormUiBinder uiBinder = GWT -// .create(EditMetadataFormUiBinder.class); -// -// interface EditMetadataFormUiBinder extends -// UiBinder { -// } -// -// @UiField HTMLPanel createDatasetMainPanel; -// @UiField TextBox titleTextBox; -// @UiField TextArea descriptionTextarea; -// @UiField ListBox licenseListbox; -// @UiField ListBox visibilityListbox; -// @UiField ListBox organizationsListbox; -// @UiField TextBox versionTextbox; -// @UiField TextBox authorTextbox; -// @UiField TextBox authorEmailTextbox; -// @UiField TextBox maintainerTextbox; -// @UiField TextBox maintainerEmailTextbox; -// @UiField ControlGroup customFields; -// @UiField Button addCustomFieldButton; -// @UiField Button createButton; -// @UiField Button resetButton; -// @UiField AlertBlock infoBlock; -// @UiField AlertBlock alertNoResources; -// @UiField AlertBlock onContinueAlertBlock; -// @UiField AlertBlock onCreateAlertBlock; -// @UiField VerticalPanel metadataFieldsPanel; -// @UiField ListBox metadataTypeListbox; -// @UiField Form formFirstStep; -// @UiField Form formSecondStep; -// @UiField Form formThirdStep; -// @UiField Button continueButton; -// @UiField Button goBackButtonSecondStep; -// @UiField Paragraph selectedProfile; -// @UiField Button goToDatasetButton; -// @UiField HorizontalPanel goToDatasetButtonPanel; -// @UiField Button addResourcesButton; -// @UiField SimplePanel workspaceResourcesContainer; -// @UiField Button continueThirdStep; -// @UiField Button goBackButtonFirstStep; -// @UiField Anchor licenseUrlAnchor; -// @UiField Paragraph unavailableUrl; -// @UiField TagsPanel tagsPanel; -// @UiField ListBox groupsListbox; -// -// // info panels -// @UiField Icon infoIconLicenses; -// @UiField FocusPanel focusPanelLicenses; -// @UiField Popover popoverLicenses; -// @UiField Icon infoIconVisibility; -// @UiField FocusPanel focusPanelVisibility; -// @UiField Popover popoverVisibility; -// @UiField Icon infoIconAuthor; -// @UiField FocusPanel focusPanelAuthor; -// @UiField Popover popoverAuthor; -// @UiField Icon infoIconMaintainerEmail; -// @UiField FocusPanel focusPanelMaintainerEmail; -// @UiField Popover popoverMaintainerEmail; -// @UiField Icon infoIconAuthorEmail; -// @UiField FocusPanel focusPanelAuthorEmail; -// @UiField Popover popoverAuthorEmail; -// @UiField Icon infoIconTypes; -// @UiField FocusPanel focusPanelTypes; -// @UiField Popover popoverTypes; -// @UiField Icon infoIconMaintainer; -// @UiField FocusPanel focusPanelMaintainer; -// @UiField Popover popoverMaintainer; -// @UiField Icon infoIconCustomFields; -// @UiField FocusPanel focusPanelCustomFields; -// @UiField Popover popoverCustomFields; -// @UiField Icon infoIconResources; -// @UiField FocusPanel focusPanelResources; -// @UiField Popover popoverResources; -// @UiField Icon infoIconTitle; -// @UiField FocusPanel focusPanelTitle; -// @UiField Popover popoverGroups; -// @UiField Icon infoIconGroups; -// @UiField FocusPanel focusPanelGroups; -// @UiField Popover popoverTitle; -// @UiField Icon infoIconDescription; -// @UiField Popover popoverDescription; -// @UiField FocusPanel focusPanelDescription; -// @UiField ControlGroup metadataTypesControlGroup; -// @UiField ControlGroup productTitleGroup; -// @UiField ControlGroup maintainerControlGroup; -// @UiField ControlGroup versionControlGroup; -// @UiField ControlGroup organizationsGroup; -// @UiField ControlGroup groupsControlGroup; -// -// private final MetadataProfileFormBuilderServiceAsync formBuilderService = GWT.create(MetadataProfileFormBuilderService.class); -// -// private static final String REGEX_TITLE_PRODUCT_SUBWORD = "[^a-zA-Z0-9_.-]"; -// private static final String REGEX_MAIL = "\\b[\\w.%-]+@[-.\\w]+\\.[A-Za-z]{2,4}\\b"; -// private static final String NONE_PROFILE = "none"; -// -// // error/info messages -// protected static final String ERROR_PRODUCT_CREATION = "There was an error while trying to publish your item."; -// protected static final String PRODUCT_CREATED_OK = "Item correctly published!"; -// private static final String TRYING_TO_CREATE_PRODUCT = "Trying to publish the item, please wait..."; -// protected static final String MISSING_PUBLISH_RIGHTS = "It seems you are not authorized to publish on catalogue. Request it to the VRE manager or the portal administrator."; -// -// // tab panel -// private TabPanel tabPanel; -// -// // add resource form -// private AddResourceToDataset resourceForm; -// -// // the licenses -// private List licenseBean; -// -// // event bus -// private HandlerManager eventBus; -// -// // added custom field entries (by the user) -// private List customFieldEntriesList = new ArrayList(); -// -// // the list of MetaDataField added -// private List listOfMetadataFields = new ArrayList(); -// -// // dataset metadata bean -// private DatasetBean receivedBean; -// -// // the owner -// private String owner; -// -// // workspace request? -// private boolean isWorkspaceRequest = false; -// -// // resource table -// private TwinColumnSelectionMainPanel resourcesTwinPanel; -// -// // List of opened popup'ids -// private List popupOpenedIds = new ArrayList(); -// -// // map of organization name title -// private Map nameTitleOrganizationMap = new HashMap(); -// -// /** -// * Invoked in the most general case -// * @param eventBus the event bus -// */ -// public CreateDatasetForm(HandlerManager eventBus) { -// createDatasetFormBody(false, null, eventBus); -// } -// -// /** -// * Invoked when the workspace is used -// * @param idFolderWorkspace -// * @param eventBus the event bus -// */ -// public CreateDatasetForm(String idFolderOrFileWorkspace, HandlerManager eventBus) { -// createDatasetFormBody(true, idFolderOrFileWorkspace, eventBus); -// } -// -// /** -// * Bind on events -// */ -// private void bind() { -// // when a custom field is removed, remove it from the list -// eventBus.addHandler(DeleteCustomFieldEvent.TYPE, new DeleteCustomFieldEventHandler() { -// -// @Override -// public void onRemoveEntry(DeleteCustomFieldEvent event) { -// customFieldEntriesList.remove(event.getRemovedEntry()); -// customFields.remove(event.getRemovedEntry()); -// } -// }); -// -// // on close form -// eventBus.addHandler(CloseCreationFormEvent.TYPE, new CloseCreationFormEventHandler() { -// @Override -// public void onClose(CloseCreationFormEvent event) { -// InfoIconsLabels.closeDialogBox(popupOpenedIds); -// } -// }); -// } -// -// /** -// * The real constructor -// * @param isWorkspaceRequest -// * @param idFolderWorkspace -// * @param owner -// * @param eventBus -// */ -// private void createDatasetFormBody(final boolean isWorkspaceRequest, final String idFolderOrFileWorkspace, final HandlerManager eventBus){ -// -// initWidget(uiBinder.createAndBindUi(this)); -// this.eventBus = eventBus; -// this.isWorkspaceRequest = isWorkspaceRequest; -// bind(); -// prepareInfoIcons(); -// -// // disable continue button -// continueButton.setEnabled(false); -// resetButton.setEnabled(false); -// -// // hide tags panel -// tagsPanel.setVisible(false); -// -// // check if the user has publishing rights -// setAlertBlock("Checking your permissions, please wait...", AlertType.INFO, true); -// -// ckanServices.isPublisherUser(isWorkspaceRequest, new AsyncCallback() { -// -// @Override -// public void onSuccess(Boolean result) { -// -// if(result){ -// -// // set info block -// setAlertBlock("Retrieving information, please wait...", AlertType.INFO, true); -// -// // get back the licenses and the metadata information -// ckanServices.getDatasetBean(idFolderOrFileWorkspace, new AsyncCallback() { -// -// @Override -// public void onFailure(Throwable caught) { -// -// setAlertBlock(caught.getMessage(), AlertType.ERROR, true); -// -// } -// -// @Override -// public void onSuccess(final DatasetBean bean) { -// -// if(bean == null){ -// -// setAlertBlock("Error while retrieving information.", AlertType.ERROR, true); -// } -// else{ -// -// // save it -// receivedBean = bean; -// -// // fill the form -// titleTextBox.setText(bean.getTitle()); -// descriptionTextarea.setText(bean.getDescription()); -// versionTextbox.setText(String.valueOf(bean.getVersion())); -// authorTextbox.setText(bean.getAuthorSurname() + " " + bean.getAuthorName()); -// authorEmailTextbox.setText(bean.getAuthorEmail()); -// maintainerTextbox.setText(bean.getAuthorSurname() + " " + bean.getAuthorName()); -// maintainerEmailTextbox.setText(bean.getMaintainerEmail()); -// -// setAlertBlock("Retrieving information, please wait...", AlertType.INFO, true); -// -// // vocabulary list of tags has preemption -// List vocabularyTags = bean.getTagsVocabulary(); -// tagsPanel.setVocabulary(vocabularyTags); -// -// // retrieve custom fields -// Map> customFieldsMap = bean.getCustomFields(); -// -// // TODO Check if these tags are ok for the vocabulary -// if(customFieldsMap != null && vocabularyTags == null){ -// -// // get the keys and put them as tags -// Iterator>> iteratorOverCustomField = customFieldsMap.entrySet().iterator(); -// -// while (iteratorOverCustomField.hasNext()) { -// Map.Entry> entry = iteratorOverCustomField -// .next(); -// -// List values = entry.getValue(); -// -// for (String value : values) { -// // these are fixed key, variable value custom fields -// CustomFieldEntryProfile toAdd = new CustomFieldEntryProfile(eventBus, entry.getKey(), value, false); -// customFieldEntriesList.add(toAdd); -// customFields.add(toAdd); -// -// // add as tag -// tagsPanel.addTagElement(entry.getKey()); -// } -// } -// } -// -// // set it as visible anyway -// tagsPanel.setVisible(true); -// -// if(isWorkspaceRequest){ -// // if there are not resources, for now just checked it ( and hide so that the step will be skipped) -// if(hideManageResources()){ -// alertNoResources.setType(AlertType.WARNING); -// alertNoResources.setVisible(true); -// }else -// resourcesTwinPanel = new TwinColumnSelectionMainPanel(bean.getResourceRoot()); -// } -// -// // set organizations -// List organizations = bean.getOrganizationList(); -// -// for (OrganizationBeanProfile organization : organizations) { -// organizationsListbox.addItem(organization.getTitle()); -// nameTitleOrganizationMap.put(organization.getTitle(), organization.getName()); -// } -// -// // force the selection of the first one, and retrieve the list of profiles -// organizationsListbox.setSelectedIndex(0); -// -// // add change handler to dynamically retrieve the list of profiles -// organizationsListbox.addChangeHandler(new ChangeHandler() { -// -// @Override -// public void onChange(ChangeEvent event) { -// event.preventDefault(); -// organizationsListboxChangeHandlerBody(); -// } -// }); -// -// // get the name of the organization from the title -// final String orgName = nameTitleOrganizationMap.get(organizationsListbox.getSelectedItemText()); -// -// // force tags -// setAlertBlock("Checking for tags vocabulary, please wait...", AlertType.INFO, true); -// ckanServices.getTagsForOrganization(orgName, new AsyncCallback>() { -// -// @Override -// public void onSuccess(List vocabulary) { -// -// tagsPanel.setVocabulary(vocabulary); -// tagsPanel.setVisible(true); -// } -// -// @Override -// public void onFailure(Throwable arg0) { -// -// setAlertBlock("Error while checking if a vocabulary of tags is defined in the selected organization.", AlertType.ERROR, true); -// tagsPanel.setVisible(true); -// -// } -// }); -// -// // try to retrieve the profiles -// setAlertBlock("Retrieving types, please wait...", AlertType.INFO, true); -// -// // perform remote request of profiles for the selected organization -// ckanServices.getProfiles(orgName, new AsyncCallback>() { -// -// @Override -// public void onFailure(Throwable caught) { -// setAlertBlock(caught.getMessage(), AlertType.ERROR, true); -// } -// -// @Override -// public void onSuccess(final List profiles) { -// -// if(profiles == null){ -// setAlertBlock("An unknow error occurred while retrieving types, sorry", AlertType.ERROR, true); -// } -// else{ -// -// receivedBean.setMetadataList(profiles); -// prepareMetadataList(receivedBean); -// organizationsListbox.setEnabled(true); -// metadataTypeListbox.setEnabled(true); -// -// // try to retrieve the licenses -// setAlertBlock("Retrieving licenses, please wait...", AlertType.INFO, true); -// ckanServices.getLicenses(new AsyncCallback>() { -// -// @Override -// public void onFailure(Throwable caught){ -// setAlertBlock(caught.getMessage(), AlertType.ERROR, true); -// } -// -// @Override -// public void onSuccess(List licenses) { -// -// if(licenses != null && !licenses.isEmpty()){ -// -// licenseBean = licenses; -// -// // fill the listbox -// for(int i = 0; i < licenses.size(); i++){ -// licenseListbox.addItem(licenses.get(i).getTitle()); -// } -// -// // set the url of the license, if any -// showLicenseUrl(); -// -// // try to retrieve the licenses -// setAlertBlock("Retrieving groups, please wait...", AlertType.INFO, true); -// -// // request groups -// ckanServices.getUserGroups(orgName, new AsyncCallback>() { -// -// @Override -// public void onSuccess(List groups) { -// if(groups == null){ -// setAlertBlock("Error while retrieving groups", AlertType.ERROR, true); -// }else{ -// if(groups.isEmpty()){ -// groupsControlGroup.setVisible(false); -// } -// else{ -// -// // add groups -// for (OrganizationBeanProfile group : groups) { -// groupsListbox.addItem(group.getTitle(), group.getName()); -// } -// hideGroupsAlreadyInProfile(profiles); -// } -// // everything went ok -// setAlertBlock("", AlertType.ERROR, false); -// continueButton.setEnabled(true); -// resetButton.setEnabled(true); -// } -// } -// -// @Override -// public void onFailure(Throwable caught) { -// setAlertBlock(caught.getMessage(), AlertType.ERROR, true); -// } -// }); -// -// }else{ -// setAlertBlock("Error while retrieving licenses", AlertType.ERROR, true); -// } -// } -// }); -// } -// } -// }); -// } -// } -// }); -// -// }else{ -// setAlertBlock(MISSING_PUBLISH_RIGHTS, AlertType.ERROR, true); -// } -// -// } -// -// @Override -// public void onFailure(Throwable caught) { -// setAlertBlock(MISSING_PUBLISH_RIGHTS, AlertType.ERROR, true); -// } -// }); -// -// -// -// } -// -// -// /** -// * When the organization name is changed we need to retrieve the list of profiles and groups -// */ -// private void organizationsListboxChangeHandlerBody() { -// -// // remove any other product profiles -// metadataTypeListbox.clear(); -// -// // add "none" item again -// metadataTypeListbox.addItem(NONE_PROFILE); -// -// // select "none" -// metadataTypeListbox.setSelectedIndex(0); -// -// // get the name of the organization from the title -// String selectedOrganizationTitle = organizationsListbox.getSelectedItemText(); -// final String orgName = nameTitleOrganizationMap.get(selectedOrganizationTitle); -// -// // try to retrieve the profiles -// setAlertBlock("Retrieving types, please wait...", AlertType.INFO, true); -// -// // disable the list of organizations name so that the user doesn't change it again -// // also disable the profiles and the list of groups -// organizationsListbox.setEnabled(false); -// metadataTypeListbox.setEnabled(false); -// groupsListbox.clear(); -// groupsControlGroup.setVisible(false); -// -// // perform remote request of profiles for the selected organization -// ckanServices.getProfiles(orgName, new AsyncCallback>() { -// -// @Override -// public void onSuccess(final List profiles) { -// -// if(profiles != null){ -// -// receivedBean.setMetadataList(profiles); -// prepareMetadataList(receivedBean); -// organizationsListbox.setEnabled(true); -// metadataTypeListbox.setEnabled(true); -// -// // try to retrieve the licenses -// setAlertBlock("Retrieving groups, please wait...", AlertType.INFO, true); -// -// // request groups -// ckanServices.getUserGroups(orgName, new AsyncCallback>() { -// -// @Override -// public void onSuccess(List groups) { -// -// if(groups == null){ -// setAlertBlock("Error while retrieving groups, try later", AlertType.ERROR, true); -// }else{ -// if(groups.isEmpty()){ -// groupsControlGroup.setVisible(false); -// } -// else{ -// -// // add groups -// for (OrganizationBeanProfile group : groups) { -// groupsListbox.addItem(group.getTitle(), group.getName()); -// } -// groupsListbox.setEnabled(true); -// hideGroupsAlreadyInProfile(profiles); -// } -// setAlertBlock("", AlertType.ERROR, false); -// } -// } -// -// @Override -// public void onFailure(Throwable caught) { -// setAlertBlock("Error while retrieving groups, try later", AlertType.ERROR, true); -// } -// }); -// -// -// // check also for tags (if for that context there is a vocabulary or not) -// tagsPanel.setVisible(false); -// setAlertBlock("Checking for tags vocabulary, please wait...", AlertType.INFO, true); -// ckanServices.getTagsForOrganization(orgName, new AsyncCallback>() { -// -// @Override -// public void onSuccess(List vocabulary) { -// -// tagsPanel.setVocabulary(vocabulary); -// tagsPanel.setVisible(true); -// setAlertBlock("", AlertType.ERROR, false); -// } -// -// @Override -// public void onFailure(Throwable arg0) { -// -// setAlertBlock("Error while checking if a vocabulary of tags is defined in the selected organization.", AlertType.ERROR, true); -// tagsPanel.setVocabulary(null); -// tagsPanel.setVisible(true); -// -// } -// }); -// -// }else -// setAlertBlock("Error while retrieving types, sorry", AlertType.ERROR, true); -// -// } -// -// @Override -// public void onFailure(Throwable caught) { -// -// setAlertBlock("Error while retrieving types, sorry", AlertType.ERROR, true); -// -// } -// }); -// -// } -// -// /** -// * Add the items to the listbox and put data into the metadataPanel -// * @param receivedBean -// */ -// private void prepareMetadataList(final DatasetBean receivedBean) { -// -// List profiles = receivedBean.getMetadataList(); -// -// if(profiles != null && !profiles.isEmpty()){ -// for(MetaDataProfileBean metadataBean: profiles){ -// -// metadataTypeListbox.addItem(metadataBean.getType()); -// -// // add handler on select -// metadataTypeListbox.addChangeHandler(new ChangeHandler() { -// -// @Override -// public void onChange(ChangeEvent event) { -// -// String selectedItemText = metadataTypeListbox.getSelectedItemText(); -// metadataFieldsPanel.clear(); -// if(selectedItemText.equals(NONE_PROFILE)){ -// metadataFieldsPanel.setVisible(false); -// receivedBean.setChosenType(null); -// }else{ -// receivedBean.setChosenType(selectedItemText); -// addFields(selectedItemText); -// } -// } -// }); -// } -// -// // hide elements or show them if needed (groups in profiles cannot be present again in groups listbox) -// if(groupsControlGroup.isVisible()){ -// List groupsToHide = new ArrayList(); -// for(MetaDataProfileBean profile: profiles) -// groupsToHide.add(profile.getType().toString()); -// -// SelectElement se = groupsListbox.getElement().cast(); -// -// for (int i = 0; i < groupsListbox.getItemCount(); i++) { -// if(groupsToHide.contains(groupsListbox.getItemText(i))){ -// se.getOptions().getItem(i).getStyle().setProperty("display", "none"); -// }else -// se.getOptions().getItem(i).getStyle().setProperty("display", ""); -// } -// } -// -// metadataTypesControlGroup.setVisible(true); -// }else{ -// // just hide this listbox -// metadataTypesControlGroup.setVisible(false); -// metadataFieldsPanel.clear(); -// listOfMetadataFields.clear(); -// receivedBean.setChosenType(null); -// } -// } -// -// /** -// * Add fields of the selected metadata profile to the widget -// * @param selectedItem -// */ -// protected void addFields(String selectedItem) { -// -// for(MetaDataProfileBean bean: receivedBean.getMetadataList()){ -// if(bean.getType().equals(selectedItem)){ -// -// // clear old data -// listOfMetadataFields.clear(); -// -// // prepare the data -// List fields = bean.getMetadataFields(); -// List categories = bean.getCategories(); -// -// GWT.log("There are " + categories.size() + " categories for profile " + bean.getTitle()); -// -// if(categories == null || categories.isEmpty()){ -// for (MetadataFieldWrapper field : fields) { -// /*MetaDataFieldSkeleton fieldWidget; -// try { -// fieldWidget = new MetaDataFieldSkeleton(field, eventBus); -// metadataFieldsPanel.add(fieldWidget); -// listOfMetadataFields.add(fieldWidget); -// } catch (Exception e) { -// GWT.log("Unable to build such widget", e); -// }*/ -// -// MetaDataField fieldWidget; -// try { -// fieldWidget = new MetaDataField(field, eventBus); -// metadataFieldsPanel.add(fieldWidget); -// listOfMetadataFields.add(fieldWidget); -// } catch (Exception e) { -// GWT.log("Unable to build such widget", e); -// } -// } -// }else{ -// -// // create the categories, then parse the fields. Fields do not belonging to a category are put at the end -// for (CategoryWrapper categoryWrapper : categories) { -// if(categoryWrapper.getFieldsForThisCategory() != null && categoryWrapper.getFieldsForThisCategory().size() > 0){ -// CategoryPanel cp = new CategoryPanel(categoryWrapper.getTitle(), categoryWrapper.getDescription()); -// List fieldsForThisCategory = categoryWrapper.getFieldsForThisCategory(); -// fields.removeAll(fieldsForThisCategory); -// -// for (MetadataFieldWrapper metadataFieldWrapper : fieldsForThisCategory) { -// -// /*MetaDataFieldSkeleton fieldWidget; -// try { -// fieldWidget = new MetaDataFieldSkeleton(metadataFieldWrapper, eventBus); -// cp.addField(fieldWidget); -// listOfMetadataFields.add(fieldWidget); -// } catch (Exception e) { -// GWT.log("Unable to build such widget", e); -// }*/ -// -// MetaDataField fieldWidget; -// try { -// fieldWidget = new MetaDataField(metadataFieldWrapper, eventBus); -// cp.addField(fieldWidget); -// listOfMetadataFields.add(fieldWidget); -// } catch (Exception e) { -// GWT.log("Unable to build such widget", e); -// } -// } -// metadataFieldsPanel.add(cp); -// } -// } -// -// // add the remaining one at the end of the categories -// CategoryPanel extrasCategory = new CategoryPanel("Other", null); -// for (MetadataFieldWrapper field : fields) { -// -// /*MetaDataFieldSkeleton fieldWidget; -// try { -// fieldWidget = new MetaDataFieldSkeleton(field, eventBus); -// extrasCategory.addField(fieldWidget); -// listOfMetadataFields.add(fieldWidget); -// } catch (Exception e) { -// GWT.log("Unable to build such widget", e); -// }*/ -// -// MetaDataField fieldWidget; -// try { -// fieldWidget = new MetaDataField(field, eventBus); -// extrasCategory.addField(fieldWidget); -// listOfMetadataFields.add(fieldWidget); -// } catch (Exception e) { -// GWT.log("Unable to build such widget", e); -// } -// } -// metadataFieldsPanel.add(extrasCategory); -// } -// metadataFieldsPanel.setVisible(true); -// } -// } -// } -// -// -// @UiHandler("addCustomFieldButton") -// void addCustomFieldEvent(ClickEvent e){ -// -// CustomFieldEntryProfile toAdd = new CustomFieldEntryProfile(eventBus, "", "", true); -// customFieldEntriesList.add(toAdd); -// customFields.add(toAdd); -// -// } -// -// @UiHandler("continueButton") -// void onContinueButton(ClickEvent e){ -// -// // validate data -// final String errorMsg = validateDataOnContinue(); -// -// if(errorMsg != null){ -// -// alertOnContinue("Please check inserted data [" + errorMsg + "]", AlertType.ERROR); -// return; -// -// }else{ -// -// // better check for title (only if the dataset was not created.. if it is the case, fields are not frozen) -// if(!titleTextBox.isEnabled()) -// actionsAfterOnContinue(); -// else{ -// alertOnContinue("Checking if a item with such title already exists, please wait...", AlertType.INFO); -// ckanServices.datasetIdAlreadyExists(titleTextBox.getText(), organizationsListbox.getSelectedItemText(), new AsyncCallback() { -// -// @Override -// public void onSuccess(Boolean result) { -// if(result){ -// alertOnContinue("Sorry but an item with such title already exists, try to change it", AlertType.WARNING); -// }else{ -// actionsAfterOnContinue(); -// } -// } -// -// @Override -// public void onFailure(Throwable caught) { -// alertOnContinue("Sorry but there was a problem while checking if the inserted data are correct", AlertType.ERROR); -// } -// }); -// } -// } -// } -// -// /** -// * After onContinue ... -// */ -// private void actionsAfterOnContinue(){ -// -// // check what to do -// if(isWorkspaceRequest){ -// -// // we need to show the page to handle resources one by one from the workspace -// formFirstStep.setVisible(false); -// formSecondStep.setVisible(!hideManageResources()); -// formThirdStep.setVisible(hideManageResources()); -// -// // add the resources to the container panel -// if(workspaceResourcesContainer.getWidget() == null){ -// workspaceResourcesContainer.getElement().getStyle().setMarginLeft(20, Unit.PX); -// workspaceResourcesContainer.add(resourcesTwinPanel); -// } -// -// }else{ -// -// // this is not a workspace request -// formFirstStep.setVisible(false); -// formThirdStep.setVisible(true); -// -// } -// -// if(metadataTypeListbox.getSelectedItemText().equals(NONE_PROFILE)) -// selectedProfile.setText(""); -// else -// selectedProfile.setText("Selected Type is " + metadataTypeListbox.getSelectedItemText()); -// -// } -// -// -// @UiHandler("goBackButtonFirstStep") -// void onGoBackButtonFirstStep(ClickEvent e){ -// -// // swap forms -// formFirstStep.setVisible(true); -// formSecondStep.setVisible(false); -// formThirdStep.setVisible(false); -// -// } -// -// -// @UiHandler("goBackButtonSecondStep") -// void onGoBackButton(ClickEvent e){ -// -// // swap forms -// if(isWorkspaceRequest){ -// formFirstStep.setVisible(hideManageResources()); -// formSecondStep.setVisible(!hideManageResources()); -// }else{ -// formFirstStep.setVisible(true); -// formSecondStep.setVisible(false); -// } -// formThirdStep.setVisible(false); -// -// } -// -// @UiHandler("continueThirdStep") -// void onContinueThirdStep(ClickEvent e){ -// -// // swap forms -// formSecondStep.setVisible(false); -// formThirdStep.setVisible(true); -// -// } -// -// -// @UiHandler("createButton") -// void createDatasetEvent(ClickEvent e){ -// -// String errorMessage = areProfileDataValid(); -// -// if(errorMessage != null){ -// alertOnCreate("Please check the inserted values and the mandatory fields [" + errorMessage +"]", AlertType.ERROR, true); -// } -// else{ -// -// String title = titleTextBox.getValue().trim(); -// String description = descriptionTextarea.getText().trim(); -// String selectedLicense = licenseListbox.getSelectedItemText(); -// String visibility = visibilityListbox.getSelectedItemText(); -// long version = Long.valueOf(versionTextbox.getValue().trim()); -// String author = authorTextbox.getValue(); -// String authorEmail = authorEmailTextbox.getValue(); -// String maintainer = maintainerTextbox.getValue().trim(); -// String maintainerEmail = maintainerEmailTextbox.getValue().trim(); -// String chosenOrganizationTitle = organizationsListbox.getSelectedItemText(); -// Set tags = new HashSet(tagsPanel.getTags()); -// -// //we need to retrieve the organization's name from this title -// List orgs = receivedBean.getOrganizationList(); -// String chosenOrganization = null; -// for (OrganizationBeanProfile organizationBean : orgs) { -// if(chosenOrganizationTitle.equals(organizationBean.getTitle())){ -// chosenOrganization = organizationBean.getName(); -// break; -// } -// } -// -// List groups = new ArrayList(); -// List groupsToForceCreation = new ArrayList(); -// -// // get groups, if any -// int items = groupsListbox.getItemCount(); -// for (int i = 0; i < items; i++) { -// String groupTitle = groupsListbox.getItemText(i); -// String groupName = groupsListbox.getValue(i); -// if(groupsListbox.isItemSelected(i)){ -// groups.add(new OrganizationBeanProfile(groupTitle, groupName, false)); -// } -// } -// -// Map> customFieldsMap = new HashMap>(); -// -// // prepare custom fields -// for (MetaDataField metaField : listOfMetadataFields) { -// -// for (MetaDataFieldSkeleton field : metaField.getListOfMetadataFields()) { -// -// List valuesForField = field.getFieldCurrentValue(); -// if(!valuesForField.isEmpty()){ -// String key = field.getFieldNameQualified(); -// List valuesForThisField = null; -// if(customFieldsMap.containsKey(key)) -// valuesForThisField = customFieldsMap.get(key); -// else -// valuesForThisField = new ArrayList(); -// -// valuesForThisField.addAll(valuesForField); -// customFieldsMap.put(key, valuesForThisField); -// -// // get also tag/group if it is the case for this field -// List tagsField = field.getTagFromThisField(); -// if(tagsField != null) -// tags.addAll(tagsField); -// -// List groupsTitle = field.getGroupTitleFromThisGroup(); -// if(groupsTitle != null){ -// for (String groupTitle : groupsTitle) { -// if(field.isGroupToForce()) -// groupsToForceCreation.add(new OrganizationBeanProfile(groupTitle, groupTitle, false, field.isPropagateUp())); -// else -// groups.add(new OrganizationBeanProfile(groupTitle, groupTitle, false, field.isPropagateUp())); -// } -// } -// } -// } -// } -// -// for(CustomFieldEntryProfile customEntry : customFieldEntriesList){ -// String key = customEntry.getKey(); -// String value = customEntry.getValue(); -// if(value != null && !value.isEmpty()){ -// List valuesForThisField = null; -// if(customFieldsMap.containsKey(key)) -// valuesForThisField = customFieldsMap.get(key); -// else -// valuesForThisField = new ArrayList(); -// valuesForThisField.add(value); -// customFieldsMap.put(key, valuesForThisField); -// } -// -// } -// -// // fill the bean -// receivedBean.setAuthorFullName(author); -// receivedBean.setAuthorEmail(authorEmail); -// receivedBean.setDescription(description); -// receivedBean.setLicense(selectedLicense); -// receivedBean.setMaintainer(maintainer); -// receivedBean.setMaintainerEmail(maintainerEmail); -// receivedBean.setVersion(version); -// receivedBean.setVisibile(visibility.equals("Public")); -// receivedBean.setTitle(title); -// receivedBean.setTags(new ArrayList(tags)); -// receivedBean.setSelectedOrganization(chosenOrganization); -// receivedBean.setGroups(groups); -// receivedBean.setGroupsForceCreation(groupsToForceCreation); -// if(resourcesTwinPanel != null) -// receivedBean.setResourceRoot(resourcesTwinPanel.getResourcesToPublish()); -// receivedBean.setCustomFields(customFieldsMap); -// -// // alert -// alertOnCreate(TRYING_TO_CREATE_PRODUCT, AlertType.INFO, false); -// -// // invoke the create method -// createButton.setEnabled(false); -// goBackButtonSecondStep.setEnabled(false); -// -// ckanServices.createCKanDataset(receivedBean, new AsyncCallback() { -// -// @Override -// public void onSuccess(final DatasetBean createdDatasetBean) { -// -// GWT.log("Created the dataset: "+createdDatasetBean); -// -// if(createdDatasetBean != null){ -// -// final String datasetUrl = createdDatasetBean.getSource(); -// -// alertOnCreate(PRODUCT_CREATED_OK, AlertType.SUCCESS, false); -// -// try { -// // disable dataset fields -// disableDatasetFields(); -// }catch (Exception e) { -// // TODO: handle exception -// } -// -// // disable reset -// resetButton.setEnabled(false); -// -// // show the go to dataset button -// -// goToDatasetButtonPanel.setVisible(true); -// goToDatasetButton.setVisible(true); -// goToDatasetButton.setText( -// datasetUrl.length() > 100 ? -// datasetUrl.substring(0, 100) + "..." : datasetUrl -// ); -// // goToDatasetButton.setHref(datasetUrl); -// goToDatasetButton.addClickHandler(new ClickHandler() { -// -// @Override -// public void onClick(ClickEvent event) { -// Window.open(datasetUrl, "_blank", ""); -// //Window.Location.assign(datasetUrl); -// } -// }); -// -// -// // set hidden the create button -// createButton.setVisible(false); -// -// // if we are in the "general case" we need to show a form for adding resources -// if(!isWorkspaceRequest) { -// -// try { -// // show the add resources button -// addResourcesButton.setVisible(true); -// -// addResourcesButton.addClickHandler(new ClickHandler() { -// -// @Override -// public void onClick(ClickEvent event) { -// -// // remove content of the main panel -// createDatasetMainPanel.clear(); -// -// // TabPanelException -// tabPanel = new TabPanel(Tabs.ABOVE); -// tabPanel.setWidth("100%"); -// -// // add the form -// resourceForm = new AddResourceToDataset(eventBus, createdDatasetBean.getId(), createdDatasetBean.getSelectedOrganization(), owner, datasetUrl); -// -// // tab for the form -// Tab formContainer = new Tab(); -// formContainer.add(resourceForm); -// formContainer.setHeading("Add New Resource"); -// tabPanel.add(formContainer); -// -// // tab for the added resources -// Tab addedResources = new Tab(); -// addedResources.add(new AddedResourcesSummary(eventBus)); -// addedResources.setHeading("Added Resource"); -// tabPanel.add(addedResources); -// -// // add tabs to resources panel -// tabPanel.selectTab(0); -// -// // form container -// AddResourceContainer container = new AddResourceContainer(datasetUrl); -// container.add(tabPanel); -// -// // add the new content of the main panel -// createDatasetMainPanel.add(container); -// } -// }); -// }catch (Exception e2) { -// //silent -// } -// } -// -// }else{ -// -// alertOnCreate(ERROR_PRODUCT_CREATION, AlertType.ERROR, true); -// } -// -// } -// -// @Override -// public void onFailure(Throwable caught) { -// alertOnCreate(ERROR_PRODUCT_CREATION + " Error message is : " + caught.getMessage(), AlertType.ERROR, true); -// } -// }); -// } -// } -// -// /** -// * Prepare the info icons of all core metadata info -// */ -// private void prepareInfoIcons() { -// -// // tags -// tagsPanel.prepareIcon(popupOpenedIds); -// -// // licenses -// InfoIconsLabels.preparePopupPanelAndPopover( -// InfoIconsLabels.LICENSES_INFO_ID_POPUP, -// InfoIconsLabels.LICENSES_INFO_TEXT, -// InfoIconsLabels.LICENSES_INFO_CAPTION, -// infoIconLicenses, -// popoverLicenses, -// focusPanelLicenses, -// popupOpenedIds -// ); -// -// // visibility -// InfoIconsLabels.preparePopupPanelAndPopover( -// InfoIconsLabels.VISIBILITY_INFO_ID_POPUP, -// InfoIconsLabels.VISIBILITY_INFO_TEXT, -// InfoIconsLabels.VISIBILITY_INFO_CAPTION, -// infoIconVisibility, -// popoverVisibility, -// focusPanelVisibility, -// popupOpenedIds -// ); -// -// // author -// InfoIconsLabels.preparePopupPanelAndPopover( -// InfoIconsLabels.AUTHOR_INFO_ID_POPUP, -// InfoIconsLabels.AUTHOR_INFO_TEXT, -// InfoIconsLabels.AUTHOR_INFO_CAPTION, -// infoIconAuthor, -// popoverAuthor, -// focusPanelAuthor, -// popupOpenedIds -// ); -// -// // author's email -// InfoIconsLabels.preparePopupPanelAndPopover( -// InfoIconsLabels.AUTHOR_EMAIL_INFO_ID_POPUP, -// InfoIconsLabels.AUTHOR_EMAIL_INFO_TEXT, -// InfoIconsLabels.AUTHOR_EMAIL_INFO_CAPTION, -// infoIconAuthorEmail, -// popoverAuthorEmail, -// focusPanelAuthorEmail, -// popupOpenedIds -// ); -// -// // maintainer -// InfoIconsLabels.preparePopupPanelAndPopover( -// InfoIconsLabels.MAINTAINER_INFO_ID_POPUP, -// InfoIconsLabels.MAINTAINER_INFO_TEXT, -// InfoIconsLabels.MAINTAINER_INFO_CAPTION, -// infoIconMaintainer, -// popoverMaintainer, -// focusPanelMaintainer, -// popupOpenedIds -// ); -// -// // maintainer's email -// InfoIconsLabels.preparePopupPanelAndPopover( -// InfoIconsLabels.MAINTAINER_EMAIL_INFO_ID_POPUP, -// InfoIconsLabels.MAINTAINER_EMAIL_INFO_TEXT, -// InfoIconsLabels.MAINTAINER_EMAIL_INFO_CAPTION, -// infoIconMaintainerEmail, -// popoverMaintainerEmail, -// focusPanelMaintainerEmail, -// popupOpenedIds -// ); -// -// // profiles (or types) -// InfoIconsLabels.preparePopupPanelAndPopover( -// InfoIconsLabels.PROFILES_INFO_ID_POPUP, -// InfoIconsLabels.PROFILES_INFO_TEXT, -// InfoIconsLabels.PROFILES_INFO_CAPTION, -// infoIconTypes, -// popoverTypes, -// focusPanelTypes, -// popupOpenedIds -// ); -// -// // custom fields -// InfoIconsLabels.preparePopupPanelAndPopover( -// InfoIconsLabels.CUSTOM_FIELDS_INFO_ID_POPUP, -// InfoIconsLabels.CUSTOM_FIELDS_INFO_TEXT, -// InfoIconsLabels.CUSTOM_FIELDS_INFO_CAPTION, -// infoIconCustomFields, -// popoverCustomFields, -// focusPanelCustomFields, -// popupOpenedIds -// ); -// -// // resources field -// InfoIconsLabels.preparePopupPanelAndPopover( -// InfoIconsLabels.RESOURCES_INFO_ID_POPUP, -// InfoIconsLabels.RESOURCES_INFO_TEXT, -// InfoIconsLabels.RESOURCES_INFO_CAPTION, -// infoIconResources, -// popoverResources, -// focusPanelResources, -// popupOpenedIds -// ); -// -// // title -// InfoIconsLabels.preparePopupPanelAndPopover( -// InfoIconsLabels.TITLE_INFO_ID_POPUP, -// InfoIconsLabels.TITLE_INFO_TEXT, -// InfoIconsLabels.TITLE_INFO_CAPTION, -// infoIconTitle, -// popoverTitle, -// focusPanelTitle, -// popupOpenedIds -// ); -// -// // description -// InfoIconsLabels.preparePopupPanelAndPopover( -// InfoIconsLabels.DESCRIPTION_INFO_ID_POPUP, -// InfoIconsLabels.DESCRIPTION_INFO_TEXT, -// InfoIconsLabels.DESCRIPTION_INFO_CAPTION, -// infoIconDescription, -// popoverDescription, -// focusPanelDescription, -// popupOpenedIds -// ); -// -// // groups -// InfoIconsLabels.preparePopupPanelAndPopover( -// InfoIconsLabels.GROUPS_INFO_ID_POPUP, -// InfoIconsLabels.GROUPS_INFO_TEXT, -// InfoIconsLabels.GROUPS_INFO_CAPTION, -// infoIconGroups, -// popoverGroups, -// focusPanelGroups, -// popupOpenedIds -// ); -// } -// -// /** -// * Test if profile data are valid -// * @return -// */ -// private String areProfileDataValid() { -// -// for (MetaDataField metaField : listOfMetadataFields) { -// -// for (MetaDataFieldSkeleton field : metaField.getListOfMetadataFields()) { -// -// field.removeError(); -// -// String error = field.isFieldValueValid(); -// if(error != null){ -// field.showError(); -// return field.getFieldNameOriginal() + " is not valid. Suggestion: " + error; -// } -// } -// } -// -// return null; -// } -// -// /** -// * On continue show alert box and enable buttons -// * @param text -// * @param type -// */ -// private void alertOnContinue(String text, AlertType type){ -// -// onContinueAlertBlock.setText(text); -// onContinueAlertBlock.setType(type); -// onContinueAlertBlock.setVisible(true); -// continueButton.setEnabled(true); -// resetButton.setEnabled(true); -// -// // hide after some seconds -// Timer t = new Timer() { -// -// @Override -// public void run() { -// -// onContinueAlertBlock.setVisible(false); -// -// } -// }; -// -// t.schedule(4000); -// } -// -// /** -// * On continue show alert box and enable buttons -// * @param text -// * @param type -// */ -// private void alertOnCreate(String text, AlertType type, boolean hideAfterAWhile){ -// -// onCreateAlertBlock.setText(text); -// onCreateAlertBlock.setType(type); -// onCreateAlertBlock.setVisible(true); -// createButton.setEnabled(true); -// goBackButtonSecondStep.setEnabled(true); -// -// if(hideAfterAWhile){ -// // hide after some seconds -// Timer t = new Timer() { -// -// @Override -// public void run() { -// -// onCreateAlertBlock.setVisible(false); -// -// } -// }; -// t.schedule(10000); -// } -// } -// -// /** -// * Validate data -// * @return true on success, false otherwise -// */ -// private String validateDataOnContinue() { -// -// // remove errors -// productTitleGroup.setType(ControlGroupType.NONE); -// maintainerControlGroup.setType(ControlGroupType.NONE); -// versionControlGroup.setType(ControlGroupType.NONE); -// metadataTypesControlGroup.setType(ControlGroupType.NONE); -// organizationsGroup.setType(ControlGroupType.NONE); -// tagsPanel.setGroupPanelType(ControlGroupType.NONE); -// -// String title = titleTextBox.getText().trim(); -// if(title.isEmpty()){ -// productTitleGroup.setType(ControlGroupType.ERROR); -// return "Missing title"; -// } -// -// // better check for the title -// String[] splittedTitle = title.split(" "); -// -// for (String word : splittedTitle) { -// String replaced = word.replaceAll(REGEX_TITLE_PRODUCT_SUBWORD, ""); -// if(!replaced.equals(word)){ -// productTitleGroup.setType(ControlGroupType.ERROR); -// return "Please note not all characters are allowed for the title"; -// } -// } -// -// // email reg expression -// String maintainerMail = maintainerEmailTextbox.getText(); -// if(!maintainerMail.isEmpty() && !maintainerMail.matches(REGEX_MAIL)){ -// maintainerControlGroup.setType(ControlGroupType.ERROR); -// return "Not valid maintainer email"; -// } -// -// // check if version is a number -// try{ -// int number = Integer.valueOf(versionTextbox.getText().trim()); -// if(number <= 0) -// throw new Exception(); -// }catch(Exception e){ -// versionControlGroup.setType(ControlGroupType.ERROR); -// return "Version must be a natural number greater than zero"; -// } -// -// // check if metadata profile is different from none and its mandatory fields have been fulfilled -// if(checkSelectedMetaDataProfile()){ -// metadataTypesControlGroup.setType(ControlGroupType.ERROR); -// return "You must select a Type different frome none"; -// } -// -// if(organizationsListbox.getSelectedItemText() == null){ -// organizationsGroup.setType(ControlGroupType.ERROR); -// return "You must select an organization in which you want to publish"; -// } -// -// // at least one tag.. -// if(tagsPanel.getTags().isEmpty()){ -// tagsPanel.setGroupPanelType(ControlGroupType.ERROR); -// return "Please add at least one meaningful tag for the item"; -// } -// -// return null; -// } -// -// /** -// * Checks if a metadata profile has been chosen and its fields have been fulfilled -// * @return -// */ -// private boolean checkSelectedMetaDataProfile() { -// return metadataTypeListbox.getSelectedItemText().equals(NONE_PROFILE) && metadataTypeListbox.getItemCount() != 1; -// } -// -// @UiHandler("resetButton") -// void resetFormEvent(ClickEvent e){ -// -// // reset main fields -// titleTextBox.setText(""); -// descriptionTextarea.setText(""); -// versionTextbox.setText(""); -// maintainerTextbox.setText(""); -// maintainerEmailTextbox.setText(""); -// tagsPanel.removeTags(); -// -// // unselect all groups -// for(int i = 0; i < groupsListbox.getItemCount(); i++) -// groupsListbox.setItemSelected(i, false); -// -// // delete custom fields -// for (CustomFieldEntryProfile customField : customFieldEntriesList) { -// customField.removeFromParent(); -// } -// customFieldEntriesList.clear(); -// } -// -// /** -// * Disable dataset editable fields once the dataset has been successfully created. -// */ -// protected void disableDatasetFields() { -// -// titleTextBox.setEnabled(false); -// descriptionTextarea.setEnabled(false); -// versionTextbox.setEnabled(false); -// maintainerTextbox.setEnabled(false); -// maintainerEmailTextbox.setEnabled(false); -// visibilityListbox.setEnabled(false); -// tagsPanel.freeze(); -// licenseListbox.setEnabled(false); -// organizationsListbox.setEnabled(false); -// addCustomFieldButton.setEnabled(false); -// metadataTypeListbox.setEnabled(false); -// groupsListbox.setEnabled(false); -// -// for(CustomFieldEntryProfile ce: customFieldEntriesList) -// ce.freeze(); -// -// // disable profile fields -// for (MetaDataField metaField : listOfMetadataFields) { -// for (MetaDataFieldSkeleton field : metaField.getListOfMetadataFields()) { -// field.freeze(); -// } -// -// } -// -// // freeze table of resources -// if(resourcesTwinPanel != null) -// resourcesTwinPanel.freeze(); -// } -// -// /** -// * change alert block behavior. -// * @param textToShow -// * @param type -// * @param visible -// */ -// private void setAlertBlock(String textToShow, AlertType type, boolean visible){ -// -// infoBlock.setText(textToShow); -// infoBlock.setType(type); -// infoBlock.setVisible(visible); -// -// } -// -// @UiHandler("licenseListbox") -// void onSelectedLicenseChange(ChangeEvent c){ -// -// showLicenseUrl(); -// -// } -// -// /** -// * The body of the onSelectedLicenseChange -// */ -// private void showLicenseUrl(){ -// -// String selectedLicense = licenseListbox.getSelectedItemText(); -// int index = -1; -// if((index = licenseBean.indexOf(new LicenseBean(selectedLicense, null))) >= 0){ -// LicenseBean foundLicense = licenseBean.get(index); -// licenseUrlAnchor.setText(foundLicense.getUrl()); -// licenseUrlAnchor.setHref(foundLicense.getUrl()); -// licenseUrlAnchor.setVisible(true); -// unavailableUrl.setVisible(false); -// }else{ -// licenseUrlAnchor.setVisible(false); -// unavailableUrl.setVisible(true); -// } -// } -// -// -// /** -// * Hide the groups that are already listed in the profiles page -// * @param profiles -// */ -// private void hideGroupsAlreadyInProfile(List profiles) { -// -// List groupsToHide = new ArrayList(); -// for(MetaDataProfileBean profile: profiles) -// groupsToHide.add(profile.getType()); -// -// SelectElement se = groupsListbox.getElement().cast(); -// -// int hiddenElements = 0; -// for (int i = 0; i < groupsListbox.getItemCount(); i++) { -// if(groupsToHide.contains(groupsListbox.getItemText(i))){ -// se.getOptions().getItem(i).getStyle().setProperty("display", "none"); -// hiddenElements++; -// } -// } -// -// if(hiddenElements == groupsListbox.getItemCount()) -// groupsControlGroup.setVisible(false); -// else -// groupsControlGroup.setVisible(true); -// -// } -// -// /** -// * Check if resource(s) are missing -// * @return -// */ -// private boolean hideManageResources(){ -// -// return receivedBean.getResourceRoot() == null || receivedBean.getResourceRoot().isFolder() && (receivedBean.getResourceRoot().getChildren() == null || -// receivedBean.getResourceRoot().getChildren().isEmpty()); -// -// } -//} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.ui.xml b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.ui.xml deleted file mode 100644 index 2c728a6..0000000 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/catalogue/CreateDatasetForm.ui.xml +++ /dev/null @@ -1,410 +0,0 @@ - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java index b3e530e..da7457a 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java @@ -8,10 +8,10 @@ import java.util.Map; import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderService; import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync; -import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormEvent; -import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormEventHandler; -import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldEvent; -import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldEventHandler; +import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormProfileEvent; +import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormProfileEventHandler; +import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldProfileEvent; +import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldProfileEventHandler; import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField; import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.GenericFormEventsListener; import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.GenericFormEvents.HasGenericFormListenerRegistration; @@ -387,19 +387,19 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe */ private void bind() { // when a custom field is removed, remove it from the list - uiBus.addHandler(DeleteCustomFieldEvent.TYPE, new DeleteCustomFieldEventHandler() { + uiBus.addHandler(DeleteCustomFieldProfileEvent.TYPE, new DeleteCustomFieldProfileEventHandler() { @Override - public void onRemoveEntry(DeleteCustomFieldEvent event) { + public void onRemoveEntry(DeleteCustomFieldProfileEvent event) { customFieldEntriesList.remove(event.getRemovedEntry()); customFields.remove(event.getRemovedEntry()); } }); // on close form - uiBus.addHandler(CloseCreationFormEvent.TYPE, new CloseCreationFormEventHandler() { + uiBus.addHandler(CloseCreationFormProfileEvent.TYPE, new CloseCreationFormProfileEventHandler() { @Override - public void onClose(CloseCreationFormEvent event) { + public void onClose(CloseCreationFormProfileEvent event) { InfoIconsLabels.closeDialogBox(popupOpenedIds); } }); diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntryProfile.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntryProfile.java index 9799cef..55daa64 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntryProfile.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/CustomFieldEntryProfile.java @@ -1,6 +1,6 @@ package org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata; -import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldEvent; +import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteCustomFieldProfileEvent; import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.InputAddOn; @@ -91,7 +91,7 @@ public class CustomFieldEntryProfile extends Composite { void onRemoveCustomField(ClickEvent e){ // fire event - eventBus.fireEvent(new DeleteCustomFieldEvent(this)); + eventBus.fireEvent(new DeleteCustomFieldProfileEvent(this)); } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/MetaDataFieldSkeleton.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/MetaDataFieldSkeleton.java index e4f92f4..3542b48 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/MetaDataFieldSkeleton.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/metadata/MetaDataFieldSkeleton.java @@ -3,8 +3,8 @@ package org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata; import java.util.ArrayList; import java.util.List; -import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormEvent; -import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormEventHandler; +import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormProfileEvent; +import org.gcube.portlets.widgets.mpformbuilder.client.events.CloseCreationFormProfileEventHandler; import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION; import org.gcube.portlets.widgets.mpformbuilder.client.openlayerwidget.GeoJsonAreaSelectionDialog; import org.gcube.portlets.widgets.mpformbuilder.client.ui.timeandranges.DataTimeBox; @@ -546,10 +546,10 @@ public class MetaDataFieldSkeleton extends Composite { private void bind() { // on close form - eventBus.addHandler(CloseCreationFormEvent.TYPE, new CloseCreationFormEventHandler() { + eventBus.addHandler(CloseCreationFormProfileEvent.TYPE, new CloseCreationFormProfileEventHandler() { @Override - public void onClose(CloseCreationFormEvent event) { + public void onClose(CloseCreationFormProfileEvent event) { if (dialog != null) dialog.hide(); diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddResourceToDataset.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddResourceToDataset.java index 5d8e377..0cb041b 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddResourceToDataset.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddResourceToDataset.java @@ -137,7 +137,7 @@ public class AddResourceToDataset extends Composite{ if(result != null){ showAlert("Resource created correctly", AlertType.SUCCESS); - eventBus.fireEvent(new AddResourceEvent(result)); + eventBus.fireEvent(new AddResourceEventProfile(result)); // remove data resourceUrlTextBox.setText(""); diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummary.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummaryProfile.java similarity index 73% rename from src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummary.java rename to src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummaryProfile.java index 24cf5b9..cd3d56e 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummary.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummaryProfile.java @@ -3,10 +3,11 @@ package org.gcube.portlets.widgets.mpformbuilder.client.ui.resources; import java.util.ArrayList; import java.util.List; -import org.gcube.portlets.widgets.mpformbuilder.client.events.AddResourceEvent; -import org.gcube.portlets.widgets.mpformbuilder.client.events.AddResourceEventHandler; -import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteResourceEvent; -import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteResourceEventHandler; +import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync; +import org.gcube.portlets.widgets.mpformbuilder.client.events.AddResourceEventProfile; +import org.gcube.portlets.widgets.mpformbuilder.client.events.AddResourceEventProfileHandler; +import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteResourceProfileEvent; +import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteResourceProfileEventHandler; import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile; import com.github.gwtbootstrap.client.ui.Accordion; @@ -19,6 +20,8 @@ import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.Window; +import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; @@ -27,13 +30,13 @@ import com.google.gwt.user.client.ui.Widget; * A summary of the resources added by the user. * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) */ -public class AddedResourcesSummary extends Composite{ +public class AddedResourcesSummaryProfile extends Composite{ private static AddedResourcesSummaryUiBinder uiBinder = GWT .create(AddedResourcesSummaryUiBinder.class); interface AddedResourcesSummaryUiBinder extends - UiBinder { + UiBinder { } // Event bus @@ -44,15 +47,12 @@ public class AddedResourcesSummary extends Composite{ @UiField VerticalPanel addResourcesPanel; - public AddedResourcesSummary(HandlerManager eventBus) { + public AddedResourcesSummaryProfile(HandlerManager eventBus) { initWidget(uiBinder.createAndBindUi(this)); - // save bus this.eventBus = eventBus; - // bind on add resource event bind(); - // init list addedResources = new ArrayList(); } @@ -63,10 +63,11 @@ public class AddedResourcesSummary extends Composite{ private void bind() { // when a new resource is added - eventBus.addHandler(AddResourceEvent.TYPE, new AddResourceEventHandler() { + eventBus.addHandler(AddResourceEventProfile.TYPE, new AddResourceEventProfileHandler() { @Override - public void onAddedResource(AddResourceEvent addResourceEvent) { + public void onAddedResource(AddResourceEventProfile addResourceEvent) { + GWT.log("Added resource event: "+addResourceEvent); // get the resource final ResourceElementBeanProfile justAddedResource = addResourceEvent.getResource(); @@ -91,7 +92,7 @@ public class AddedResourcesSummary extends Composite{ @Override public void onClick(ClickEvent event) { - eventBus.fireEvent(new DeleteResourceEvent(justAddedResource)); + eventBus.fireEvent(new DeleteResourceProfileEvent(justAddedResource)); } }); @@ -110,29 +111,24 @@ public class AddedResourcesSummary extends Composite{ }); // when the user wants to delete a resource - eventBus.addHandler(DeleteResourceEvent.TYPE, new DeleteResourceEventHandler() { + eventBus.addHandler(DeleteResourceProfileEvent.TYPE, new DeleteResourceProfileEventHandler() { @Override - public void onDeletedResource(DeleteResourceEvent deleteResourceEvent) { + public void onDeletedResource(DeleteResourceProfileEvent deleteResourceEvent) { // to delete ResourceElementBeanProfile toDelete = deleteResourceEvent.getResource(); - - - - // find it + Window.alert("DELETE RESOURCE MUST BE IMPLEMENTED"); /* - * MUST ME MANAGED IN ANOTHER POINT - * - * for(int i = 0; i < addedResources.size(); i++){ + for(int i = 0; i < addedResources.size(); i++){ - if(addedResources.get(i).getOriginalIdInWorkspace().equals(toDelete.getOriginalIdInWorkspace())){ + if(addedResources.get(i).equals(toDelete)){ // get the associated widget and remove it final Widget widget = addResourcesPanel.getWidget(i); // remote call to remove it from the dataset - ckanServices.deleteResourceFromDataset(toDelete, new AsyncCallback() { + MetadataProfileFormBuilderServiceAsync.Util.getInstance().deleteResourceFromDataset(toDelete, new AsyncCallback() { @Override public void onSuccess(Boolean result) { @@ -149,11 +145,15 @@ public class AddedResourcesSummary extends Composite{ break; } - }*/ - + } + */ // remove from the list addedResources.remove(toDelete); } }); } + + public HandlerManager getEventBus() { + return eventBus; + } } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummary.ui.xml b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummaryProfile.ui.xml similarity index 100% rename from src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummary.ui.xml rename to src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummaryProfile.ui.xml diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/metadata/MetadataFieldWrapper.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/metadata/MetadataFieldWrapper.java index 4afcf34..152348b 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/metadata/MetadataFieldWrapper.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/metadata/MetadataFieldWrapper.java @@ -400,7 +400,7 @@ public class MetadataFieldWrapper implements UpdatableField, Serializable { builder.append(", maxOccurs="); builder.append(maxOccurs); builder.append(", currentValues="); - builder.append(currentValues); + builder.append("currentValues"); builder.append("]"); return builder.toString(); } From 4a25ddf5e4d789170d0df06ccf86b3ddf9530a36 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Wed, 14 Feb 2024 11:25:47 +0100 Subject: [PATCH 06/10] Removed unused imports --- .../client/ui/resources/AddResourceContainer.java | 4 ++-- .../client/ui/resources/AddedResourcesSummaryProfile.java | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddResourceContainer.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddResourceContainer.java index 77a0e03..34e9613 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddResourceContainer.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddResourceContainer.java @@ -1,6 +1,6 @@ package org.gcube.portlets.widgets.mpformbuilder.client.ui.resources; -import com.github.gwtbootstrap.client.ui.TabPanel; +import com.github.gwtbootstrap.client.ui.base.StackedNav; import com.google.gwt.core.client.GWT; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; @@ -31,7 +31,7 @@ public class AddResourceContainer extends Composite{ * Add the form to this panel * @param w */ - public void add(TabPanel w){ + public void add(StackedNav w){ resourcesPanel.add(w); } } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummaryProfile.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummaryProfile.java index cd3d56e..7836152 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummaryProfile.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/resources/AddedResourcesSummaryProfile.java @@ -3,7 +3,6 @@ package org.gcube.portlets.widgets.mpformbuilder.client.ui.resources; import java.util.ArrayList; import java.util.List; -import org.gcube.portlets.widgets.mpformbuilder.client.MetadataProfileFormBuilderServiceAsync; import org.gcube.portlets.widgets.mpformbuilder.client.events.AddResourceEventProfile; import org.gcube.portlets.widgets.mpformbuilder.client.events.AddResourceEventProfileHandler; import org.gcube.portlets.widgets.mpformbuilder.client.events.DeleteResourceProfileEvent; @@ -21,7 +20,6 @@ import com.google.gwt.event.shared.HandlerManager; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.VerticalPanel; import com.google.gwt.user.client.ui.Widget; From 06b8f1d8d3fb730829a7a06927eb1d0717378423 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Thu, 15 Feb 2024 16:27:39 +0100 Subject: [PATCH 07/10] removed unused code --- .../form/generic/CreateMetadataForm.java | 9 +- .../twincolumnselection/ResourceCellLeft.java | 46 -- .../ResourceCellRight.java | 65 -- .../TwinColumnSelectionMainPanel.java | 571 ------------------ .../TwinColumnSelectionMainPanel.ui.xml | 58 -- .../shared/catalogue/DatasetBean.java | 335 ---------- .../catalogue/OrganizationBeanProfile.java | 5 +- .../catalogue/ResourceElementBeanProfile.java | 107 ++-- 8 files changed, 48 insertions(+), 1148 deletions(-) delete mode 100644 src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellLeft.java delete mode 100644 src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellRight.java delete mode 100644 src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/TwinColumnSelectionMainPanel.java delete mode 100644 src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/TwinColumnSelectionMainPanel.ui.xml delete mode 100644 src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/DatasetBean.java diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java index da7457a..0a7ff7b 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java @@ -19,7 +19,6 @@ import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CategoryPanel import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CustomFieldEntryProfile; import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton; import org.gcube.portlets.widgets.mpformbuilder.client.ui.resources.AddResourceToDataset; -import org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection.TwinColumnSelectionMainPanel; import org.gcube.portlets.widgets.mpformbuilder.client.ui.upload.DialogUpload; import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.CustomLegend; import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.InfoIconsLabels; @@ -240,7 +239,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe /** The resources twin panel. */ // resource table - private TwinColumnSelectionMainPanel resourcesTwinPanel; + //private TwinColumnSelectionMainPanel resourcesTwinPanel; /** The popup opened ids. */ // List of opened popup'ids @@ -879,9 +878,9 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe } - // freeze table of resources - if (resourcesTwinPanel != null) - resourcesTwinPanel.freeze(bool); +// // freeze table of resources +// if (resourcesTwinPanel != null) +// resourcesTwinPanel.freeze(bool); // TRUE in UPDATE MODE - freeze manage of current content (means file already // uploaded) diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellLeft.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellLeft.java deleted file mode 100644 index 146de09..0000000 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellLeft.java +++ /dev/null @@ -1,46 +0,0 @@ -package org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection; - -import org.gcube.portlets.widgets.mpformbuilder.client.ui.icons.Images; -import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile; - -import com.google.gwt.cell.client.AbstractCell; -import com.google.gwt.core.client.GWT; -import com.google.gwt.safehtml.shared.SafeHtmlBuilder; -import com.google.gwt.user.client.ui.Image; -/** - * Cell that renders left side panel objects - * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) - */ -public class ResourceCellLeft extends AbstractCell{ - private static final Images image = GWT.create(Images.class); - private static final String tipFile = "Hold down the Control (ctrl) or Command button to select multiple options"; - private static final String tipFolder = "Click on the folder to navigate it"; - - @Override - public void render(com.google.gwt.cell.client.Cell.Context context, - ResourceElementBeanProfile value, SafeHtmlBuilder sb) { - - if (value == null || value.isToBeAdded()) { - return; - } - - Image file = new Image(image.fileIcon()); - Image folder = new Image(image.folderIcon()); - file.setWidth("15px"); - file.setHeight("15px"); - folder.setWidth("15px"); - folder.setHeight("15px"); - - String whichTip = value.isFolder() ? tipFolder : tipFile; - sb.appendHtmlConstant("
"); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(value.isFolder() ? folder.toString() : file.toString()); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(""); - sb.appendEscaped(value.getName()); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant("
"); - } -} diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellRight.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellRight.java deleted file mode 100644 index 407fbf1..0000000 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/ResourceCellRight.java +++ /dev/null @@ -1,65 +0,0 @@ -package org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection; - -import org.gcube.portlets.widgets.mpformbuilder.client.ui.icons.Images; -import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile; - -import com.google.gwt.cell.client.AbstractCell; -import com.google.gwt.cell.client.ValueUpdater; -import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Element; -import com.google.gwt.dom.client.NativeEvent; -import com.google.gwt.safehtml.shared.SafeHtmlBuilder; -import com.google.gwt.user.client.ui.Image; - -/** - * Cell that renders right side panel objects - * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) - */ -public class ResourceCellRight extends AbstractCell{ - - private static final Images image = GWT.create(Images.class); - private static final String tip = "Hold down the Control (CTRL) or Command button to select multiple options. Double click to access " - + "this resource information"; - - public ResourceCellRight() { - super("keydown", "dblclick"); - } - - @Override - public void render(com.google.gwt.cell.client.Cell.Context context, - ResourceElementBeanProfile value, SafeHtmlBuilder sb) { - - if (value == null || !value.isToBeAdded() || value.isFolder()) { - return; - } - - Image file = new Image(image.fileIcon()); - file.setWidth("15px"); - file.setHeight("15px"); - - sb.appendHtmlConstant("
"); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(file.toString()); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(""); - sb.appendEscaped(value.getEditableName()); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant(""); - sb.appendHtmlConstant("
"); - } - - @Override - public void onBrowserEvent(com.google.gwt.cell.client.Cell.Context context, - Element parent, ResourceElementBeanProfile value, NativeEvent event, - ValueUpdater valueUpdater) { - if(value == null || TwinColumnSelectionMainPanel.isFroozen()) - return; - super.onBrowserEvent(context, parent, value, event, valueUpdater); - ResourceInfoForm info = new ResourceInfoForm(value, valueUpdater); - if(TwinColumnSelectionMainPanel.detailContainer.getWidget() != null) - TwinColumnSelectionMainPanel.detailContainer.clear(); - TwinColumnSelectionMainPanel.detailContainer.add(info); - TwinColumnSelectionMainPanel.detailContainer.setVisible(true); - } -} diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/TwinColumnSelectionMainPanel.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/TwinColumnSelectionMainPanel.java deleted file mode 100644 index 4b68fd5..0000000 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/TwinColumnSelectionMainPanel.java +++ /dev/null @@ -1,571 +0,0 @@ -package org.gcube.portlets.widgets.mpformbuilder.client.ui.twincolumnselection; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.gcube.portlets.widgets.mpformbuilder.shared.catalogue.ResourceElementBeanProfile; - -import com.github.gwtbootstrap.client.ui.Breadcrumbs; -import com.github.gwtbootstrap.client.ui.Button; -import com.github.gwtbootstrap.client.ui.FluidContainer; -import com.github.gwtbootstrap.client.ui.NavLink; -import com.google.gwt.cell.client.ValueUpdater; -import com.google.gwt.core.client.GWT; -import com.google.gwt.dom.client.Style.BorderStyle; -import com.google.gwt.dom.client.Style.FontWeight; -import com.google.gwt.dom.client.Style.Unit; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.cellview.client.CellList; -import com.google.gwt.user.cellview.client.HasKeyboardPagingPolicy.KeyboardPagingPolicy; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.SimplePanel; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; -import com.google.gwt.view.client.ListDataProvider; -import com.google.gwt.view.client.MultiSelectionModel; -import com.google.gwt.view.client.SelectionChangeEvent; - -/** - * The twin column panels for selection of the files to attach to the catalague product. - * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) - * @author Francesco Mangiacrapa at ISTI-CNR - */ -public class TwinColumnSelectionMainPanel extends Composite{ - - @UiField - VerticalPanel leftContainer; - @UiField - VerticalPanel rightContainer; - @UiField - VerticalPanel buttonsPanel; - @UiField - Button allToRightButton; - @UiField - Button toRightButton; - @UiField - Button toLeftButton; - @UiField - Button allToLeftButton; - // @UiField - // Popover popoverResourceSelection; - // @UiField - // Button resourceInfoButton; - @UiField - Breadcrumbs breadcrumbs; - @UiField - FluidContainer mainContainerResourcesSelection; - // @UiField - // Button getResources; - @UiField - public static SimplePanel detailContainer; - - /** - * The breadcrumb subpath with the linked folder - * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) - */ - private class PathBean{ - NavLink link; - ResourceElementBeanProfile resourceFolder; - - PathBean(NavLink link, ResourceElementBeanProfile resourceFolder){ - this.link = link; - this.resourceFolder = resourceFolder; - } - } - - private static boolean frozen = false; - private List pathListBeans = new ArrayList(); - private static final String PANEL_BORDER_COLOR = "#8899a6"; - private static final String PANEL_HEIGHT = "400px"; - private ShowMorePagerPanel showMorePanelLeft = new ShowMorePagerPanel(); - private ShowMorePagerPanel showMorePanelRight = new ShowMorePagerPanel(); - private CellList cellListLeft; - private CellList cellListRight; - private ListDataProvider dataProviderLeft = new ListDataProvider(); - private ListDataProvider dataProviderRight = new ListDataProvider(); - private MultiSelectionModel selectionModelRight; - private MultiSelectionModel selectionModelLeft; - private final ResourceElementBeanProfile initialBean; - // private final static HTML aboutHeader = new HTML("Resource Manager"); - // private final static HTML aboutBody = new HTML("

Move the files you want to attach to the product on the right panel below." - // + " Please consider that any complex hierarchy structure you may have will be flatten.

"); - - // private static final short PATH_THRESHOLD = 1; // TODO - - private static TwinColumnSelectionMainPanelUiBinder uiBinder = GWT - .create(TwinColumnSelectionMainPanelUiBinder.class); - - interface TwinColumnSelectionMainPanelUiBinder extends - UiBinder { - } - - public TwinColumnSelectionMainPanel(ResourceElementBeanProfile initialBean) { - initWidget(uiBinder.createAndBindUi(this)); - frozen = false; - - GWT.log(initialBean.toString()); - - this.initialBean = initialBean; - - buttonsPanel.getElement().getStyle().setMarginTop(50, Unit.PCT); - allToRightButton.getElement().getStyle().setMarginBottom(4, Unit.PX); - toRightButton.getElement().getStyle().setMarginBottom(4, Unit.PX); - toLeftButton.getElement().getStyle().setMarginBottom(4, Unit.PX); - allToLeftButton.getElement().getStyle().setMarginBottom(4, Unit.PX); - - buttonsPanel.getElement().setAttribute("align", "center"); - // popoverResourceSelection.setPlacement(Placement.LEFT); - // popoverResourceSelection.setHeading(aboutHeader.getHTML()); - // popoverResourceSelection.setText(aboutBody.getHTML()); - // resourceInfoButton.getElement().getStyle().setFloat(Float.RIGHT); - // resourceInfoButton.getElement().getStyle().setPaddingRight(0, Unit.PX); - mainContainerResourcesSelection.getElement().getStyle().setPadding(10, Unit.PX); - - breadcrumbs.getElement().getStyle().setBackgroundColor("white"); - breadcrumbs.getElement().getStyle().setFontWeight(FontWeight.BOLD); - breadcrumbs.getElement().getStyle().setMarginLeft(0, Unit.PX); - mainContainerResourcesSelection.getElement().getStyle().setMarginLeft(10, Unit.PX); - mainContainerResourcesSelection.getElement().getStyle().setMarginBottom(20, Unit.PX); - mainContainerResourcesSelection.getElement().getStyle().setMarginTop(0, Unit.PX); - - prepareHandlers(); - initLeftSidePanel(initialBean); - initRightSidePanel(); - } - - /** - * Initialize the left side panel - */ - private void initLeftSidePanel(final ResourceElementBeanProfile initialBean) { - - // initialize the left side list - ResourceCellLeft cell = new ResourceCellLeft(); - - // Set a key provider that provides a unique key for each object. - cellListLeft = new CellList(cell, ResourceElementBeanProfile.KEY_PROVIDER); - cellListLeft.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE); - - // set page size - int size = initialBean.isFolder() ? initialBean.getChildren().size() : 1; - cellListLeft.setPageSize(size); - - // Add a selection model so we can select cells. - selectionModelLeft = new MultiSelectionModel(ResourceElementBeanProfile.KEY_PROVIDER); - cellListLeft.setSelectionModel(selectionModelLeft); - - // perform an action on selection - selectionModelLeft.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { - - public void onSelectionChange(SelectionChangeEvent event) { - - if(frozen) - return; - - Iterator selectedObjectsIterator = selectionModelLeft.getSelectedSet().iterator(); - - while (selectedObjectsIterator.hasNext()) { - ResourceElementBeanProfile selectedBean = selectedObjectsIterator.next(); - if(selectedBean.isFolder()){ - - // a single folder selected - if(selectionModelLeft.getSelectedSet().size() == 1){ - - // update path - final NavLink navElem = new NavLink(selectedBean.getName()); - navElem.getElement().getStyle().setFontWeight(FontWeight.BOLD); - final PathBean pathBean = new PathBean(navElem, selectedBean); - - navElem.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - - removeStartingFromBreadcrumbs(navElem, pathBean); - GWT.log("Clicked on element " + pathBean.resourceFolder.getName()); - //breadcrumbsUpdater(); - ResourceElementBeanProfile folder = pathBean.resourceFolder; - Collections.sort(folder.getChildren()); - dataProviderLeft.setList(folder.getChildren()); - dataProviderLeft.refresh(); - - } - }); - - pathListBeans.add(pathBean); - breadcrumbs.add(navElem); - //breadcrumbsUpdater(); - - Collections.sort(selectedBean.getChildren()); - GWT.log("Children " + selectedBean.getChildren()); - dataProviderLeft.setList(selectedBean.getChildren()); - cellListLeft.setPageSize(selectedBean.getChildren().size()); - dataProviderLeft.refresh(); - } - selectionModelLeft.setSelected(selectedBean, false); - } - } - // enable the buttons that allows to move the objects to the right - enableMoveToRightButtons(selectionModelLeft.getSelectedSet()); - } - }); - - // set the list into the provider - if(initialBean.isFolder()){ - Collections.sort(this.initialBean.getChildren()); - dataProviderLeft.setList(this.initialBean.getChildren()); - }else - dataProviderLeft.setList(Arrays.asList(this.initialBean)); - - // add root to breadcrumb - final NavLink root = new NavLink(initialBean.getName()); - final PathBean pathBean = new PathBean(root, initialBean); - root.getElement().getStyle().setFontWeight(FontWeight.BOLD); - pathListBeans.add(pathBean); - breadcrumbs.add(root); - - root.addClickHandler(new ClickHandler() { - - @Override - public void onClick(ClickEvent event) { - - removeStartingFromBreadcrumbs(root, pathBean); - //breadcrumbsUpdater(); - - // set back the root content list - dataProviderLeft.setList(initialBean.getChildren()); - cellListLeft.setPageSize(initialBean.getChildren().size()); - dataProviderLeft.refresh(); - - } - }); - - // set the cell list into the provider - dataProviderLeft.addDataDisplay(cellListLeft); - - // manage showMorePanelLeft - showMorePanelLeft.setDisplay(cellListLeft); - showMorePanelLeft.setHeight(PANEL_HEIGHT); - showMorePanelLeft.getElement().getStyle().setBorderStyle(BorderStyle.SOLID); - showMorePanelLeft.getElement().getStyle().setBorderWidth(2, Unit.PX); - showMorePanelLeft.getElement().getStyle().setBorderColor(PANEL_BORDER_COLOR); - - // add the list to the leftContainerPanel - leftContainer.add(showMorePanelLeft); - } - - /** - * Update the path - * @param navElem - * @param pathBean - */ - public void removeStartingFromBreadcrumbs(NavLink navElem, PathBean pathBean){ - - // remove data after - Iterator iteratorBreadcrumb = breadcrumbs.iterator(); - Iterator iteratorListPath = pathListBeans.iterator(); - - boolean delete = false; - while(iteratorBreadcrumb.hasNext()){ - Widget current = iteratorBreadcrumb.next(); - - if(delete){ - current.removeFromParent(); - iteratorBreadcrumb.remove(); - } - - if(!delete && navElem.equals(current)) - delete = true; - } - - delete = false; - while(iteratorListPath.hasNext()){ - PathBean current = iteratorListPath.next(); - - if(delete) - iteratorListPath.remove(); - - if(!delete && pathBean.equals(current)) - delete = true; - } - - } - - /** - * Initialize the left side panel - */ - private void initRightSidePanel() { - - // initialize the left side list - ResourceCellRight cell = new ResourceCellRight(); - - // Set a key provider that provides a unique key for each object. - cellListRight = new CellList(cell, ResourceElementBeanProfile.KEY_PROVIDER); - cellListRight.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE); - cellListRight.setValueUpdater(new ValueUpdater() { - - @Override - public void update(ResourceElementBeanProfile value) { - - // just redraw the list - cellListRight.redraw(); - - } - }); - - // Add a selection model so we can select cells. - selectionModelRight = new MultiSelectionModel(ResourceElementBeanProfile.KEY_PROVIDER); - cellListRight.setSelectionModel(selectionModelRight); - - // perform an action on selection - selectionModelRight.addSelectionChangeHandler(new SelectionChangeEvent.Handler() { - public void onSelectionChange(SelectionChangeEvent event) { - - if(frozen) - return; - - enableMoveToLeftButtons(selectionModelRight.getSelectedSet()); - } - }); - - // set the cell list into the provider - dataProviderRight.addDataDisplay(cellListRight); - - // manage showMorePanelRight - showMorePanelRight.setDisplay(cellListRight); - showMorePanelRight.setHeight(PANEL_HEIGHT); - showMorePanelRight.getElement().getStyle().setBorderStyle(BorderStyle.SOLID); - showMorePanelRight.getElement().getStyle().setBorderWidth(2, Unit.PX); - showMorePanelRight.getElement().getStyle().setBorderColor(PANEL_BORDER_COLOR); - - // add the list to the leftContainerPanel - rightContainer.add(showMorePanelRight); - - } - - /** - * Enable/disable the buttons to move objects from left to right properly. - * @param setselectedItemsLeft - */ - private void enableMoveToRightButtons(Set setselectedItemsLeft){ - - if(setselectedItemsLeft == null || setselectedItemsLeft.isEmpty()){ - allToRightButton.setEnabled(false); - toRightButton.setEnabled(false); - } - else if(setselectedItemsLeft.size() > 1){ - allToRightButton.setEnabled(true); - toRightButton.setEnabled(false); - } - else{ - allToRightButton.setEnabled(false); - toRightButton.setEnabled(true); - } - } - - /** - * Enable/disable the buttons to move objects from right to left properly. - * @param setselectedItemsRight - */ - private void enableMoveToLeftButtons(Set setselectedItemsRight){ - - if(setselectedItemsRight == null || setselectedItemsRight.isEmpty()){ - allToLeftButton.setEnabled(false); - allToLeftButton.setEnabled(false); - } - else if(setselectedItemsRight.size() > 1){ - allToLeftButton.setEnabled(true); - toLeftButton.setEnabled(false); - } - else{ - allToLeftButton.setEnabled(false); - toLeftButton.setEnabled(true); - } - } - - /** - * Prepare the buttons' handlers - */ - private void prepareHandlers() { - - allToRightButton.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - moveToRight(selectionModelLeft.getSelectedSet()); - } - }); - - toRightButton.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - moveToRight(selectionModelLeft.getSelectedSet()); - } - }); - - allToLeftButton.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - moveToLeft(selectionModelRight.getSelectedSet()); - } - }); - - toLeftButton.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - moveToLeft(selectionModelRight.getSelectedSet()); - } - }); - } - - /** - * Move to right elements - * @param set the elements to move - */ - private void moveToRight(Set setSelected){ - - if(setSelected == null || setSelected.isEmpty()) - return; - - Iterator iterator = setSelected.iterator(); - while (iterator.hasNext()) { - ResourceElementBeanProfile resourceElementBean = iterator - .next(); - resourceElementBean.setToBeAdded(true); - - int indexRight = dataProviderRight.getList().indexOf(resourceElementBean); - if(indexRight >= 0) - dataProviderRight.getList().set(indexRight, resourceElementBean); - else{ - dataProviderRight.getList().add(resourceElementBean); - Collections.sort(dataProviderRight.getList()); - dataProviderRight.refresh(); - } - - int indexLeft = dataProviderLeft.getList().indexOf(resourceElementBean); - dataProviderLeft.getList().set(indexLeft, resourceElementBean); - } - } - - /** - * Move to left elements - * @param setSelected the elements to move - */ - private void moveToLeft(Set setSelected){ - - if(setSelected == null || setSelected.isEmpty()) - return; - - Iterator iterator = setSelected.iterator(); - while (iterator.hasNext()) { - ResourceElementBeanProfile resourceElementBean = iterator.next(); - resourceElementBean.setToBeAdded(false); - } - - Collections.sort(dataProviderLeft.getList()); - dataProviderLeft.refresh(); - dataProviderRight.refresh(); - } - - /** - * Freeze the panel - */ - public void freeze(boolean bool) { - - frozen = bool; - - Iterator iteratorOverPath = breadcrumbs.iterator(); - while (iteratorOverPath.hasNext()) { - Widget widget = iteratorOverPath.next(); - if(widget instanceof NavLink) - ((NavLink)widget).setActive(!bool); - } - - allToRightButton.setEnabled(!bool); - toRightButton.setEnabled(!bool); - allToLeftButton.setEnabled(!bool); - toLeftButton.setEnabled(!bool); - } - - /** - * Returns the root parent with the children as files to save - * @return the resources to save - */ - public ResourceElementBeanProfile getResourcesToPublish(){ - - List current = dataProviderRight.getList(); - - ResourceElementBeanProfile toReturn = new ResourceElementBeanProfile(); - List children = new ArrayList(); - - for (ResourceElementBeanProfile resource : current) { - if(resource.isToBeAdded() && !resource.isFolder()){ // be sure ... - ResourceElementBeanProfile beanWithoutChildren = new ResourceElementBeanProfile(resource); - beanWithoutChildren.setName(resource.getEditableName()); - children.add(beanWithoutChildren); - } - } - - toReturn.setChildren(children); - return toReturn; - } - - - /** - * @return the freezed - */ - public static boolean isFroozen() { - - return frozen; - } - - // @UiHandler("getResources") - // void getResources(ClickEvent ce){ - // getResourcesToPublish(); - // } - // - // /** - // * Short the current path if needed - // */ - // private void breadcrumbsUpdater(){ - // - // // ignore first and last elem - // boolean reduce = (pathListBeans.size() - 2) > PATH_THRESHOLD; - // - // GWT.log("Is to reduce? " + reduce); - // - // GWT.log("Full size is " + pathListBeans.size()); - // - // if(!reduce){ - // GWT.log("Restore"); - // for(int i = 0; i < pathListBeans.size(); i++){ - // PathBean bean = pathListBeans.get(i); - // GWT.log("Elem is " + bean.resourceFolder); - // bean.link.setText(bean.resourceFolder.getName()); - // bean.link.setVisible(true); - // } - // }else{ - // for(int i = 1; i < pathListBeans.size(); i++){ - // PathBean bean = pathListBeans.get(i); - // - // if(i == (pathListBeans.size() - 1)){ - // bean.link.setText(bean.resourceFolder.getName()); - // bean.link.setVisible(true); - // }else if(i == (pathListBeans.size() - 2)){ - // GWT.log("The last to modify ****" + bean.resourceFolder.getName()); - // bean.link.setText("..."); - // bean.link.setVisible(true); - // }else{ - // bean.link.setText(bean.resourceFolder.getName()); - // bean.link.setVisible(false); - // } - // } - // } - // GWT.log("Updated list is " + pathListBeans.toString()); - // } -} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/TwinColumnSelectionMainPanel.ui.xml b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/TwinColumnSelectionMainPanel.ui.xml deleted file mode 100644 index c4ea6c1..0000000 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/twincolumnselection/TwinColumnSelectionMainPanel.ui.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/DatasetBean.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/DatasetBean.java deleted file mode 100644 index 02b8b12..0000000 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/DatasetBean.java +++ /dev/null @@ -1,335 +0,0 @@ -//package org.gcube.portlets.widgets.mpformbuilder.shared.catalogue; -// -//import java.io.Serializable; -//import java.util.List; -//import java.util.Map; -// -//import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean; -// -///** -// * This bean will contain during ckan metadata creation information related to the future build. -// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) -// */ -//@SuppressWarnings("serial") -//public class DatasetBean implements Serializable { -// -// private String id; -// private String title; -// private String description; -// private String license; // chosen by the user -// private String source; // url of the folder in the workspace -// private String authorName; // author name -// private String authorSurname; // author surname -// private String authorFullName; -// private String authorEmail; // owner's email -// private String maintainer; -// private String maintainerEmail; -// private String ownerIdentifier; // owner of the folder into the workspace (e.g., andrea.rossi) -// private String chosenType; // the name of the MetaDataType chosen -// private String selectedOrganization; -// private long version; // version 1, 2 ... -// private boolean visible; // Private (false) or Public(true) -// private List organizationList; // list of organization in which the user is present and could create the dataset -// private ResourceElementBeanProfile resourceRoot; // in case of workspace, this is the directory root or the single file information -// private List metadataList; -// private List tags; // on retrieve, they are the keys of the product -// private List tagsVocabulary; // when available -// private Map> customFields; -// private List groups; -// private List groupsForceCreation; -// -// public DatasetBean(){ -// super(); -// } -// -// /** Create a metadata bean object. -// * @param id -// * @param title -// * @param description -// * @param customFields -// * @param tags -// * @param license -// * @param visibility -// * @param source -// * @param version -// * @param author -// * @param authorEmail -// * @param maintainer -// * @param maintainerEmail -// * @param ownerIdentifier -// * @param organizationList -// * @param selectedOrganization -// * @param resourcesIds -// * @param addResources -// * @param metadataList -// */ -// public DatasetBean(String id, String title, String description, -// Map> customFields, List tags, -// String license, boolean visible, String source, long version, -// String authorName, String authorSurname, String authorEmail, String maintainer, -// String maintainerEmail, String ownerIdentifier, -// List organizationList, String selectedOrganization, -// ResourceElementBeanProfile resourceRoot, -// List metadataList, List groups, List tagsVocabulary) { -// super(); -// this.id = id; -// this.title = title; -// this.description = description; -// this.customFields = customFields; -// this.tags = tags; -// this.license = license; -// this.visible = visible; -// this.source = source; -// this.version = version; -// this.authorName = authorName; -// this.authorSurname = authorSurname; -// this.authorEmail = authorEmail; -// this.maintainer = maintainer; -// this.maintainerEmail = maintainerEmail; -// this.ownerIdentifier = ownerIdentifier; -// this.organizationList = organizationList; -// this.selectedOrganization = selectedOrganization; -// this.resourceRoot = resourceRoot; -// this.metadataList = metadataList; -// this.groups = groups; -// this.tagsVocabulary = tagsVocabulary; -// } -// -// public String getChosenType() { -// return chosenType; -// } -// -// public void setChosenType(String chosenType) { -// this.chosenType = chosenType; -// } -// -// public List getMetadataList() { -// return metadataList; -// } -// -// public void setMetadataList(List metadataListTypes) { -// this.metadataList = metadataListTypes; -// } -// -// public String getId() { -// return id; -// } -// -// public void setId(String id) { -// this.id = id; -// } -// -// public String getOwnerIdentifier() { -// return ownerIdentifier; -// } -// -// public void setOwnerIdentifier(String ownerIdentifier) { -// this.ownerIdentifier = ownerIdentifier; -// } -// -// public String getTitle() { -// return title; -// } -// -// public void setTitle(String title) { -// this.title = title; -// } -// -// public String getDescription() { -// return description; -// } -// -// public void setDescription(String description) { -// this.description = description; -// } -// -// public Map> getCustomFields() { -// return customFields; -// } -// -// public void setCustomFields(Map> customFields) { -// this.customFields = customFields; -// } -// -// public List getTags() { -// return tags; -// } -// -// public void setTags(List tags) { -// this.tags = tags; -// } -// -// public String getLicense() { -// return license; -// } -// -// public void setLicense(String license) { -// this.license = license; -// } -// -// public boolean getVisibility() { -// return visible; -// } -// -// public void setVisibile(boolean visibile) { -// this.visible = visibile; -// } -// -// public String getSource() { -// return source; -// } -// -// public void setSource(String source) { -// this.source = source; -// } -// -// public long getVersion() { -// return version; -// } -// -// public void setVersion(long version) { -// this.version = version; -// } -// -// public String getAuthorName() { -// return authorName; -// } -// -// public void setAuthorName(String authorName) { -// this.authorName = authorName; -// } -// -// public String getAuthorSurname() { -// return authorSurname; -// } -// -// public void setAuthorSurname(String authorSurname) { -// this.authorSurname = authorSurname; -// } -// -// public String getAuthorEmail() { -// return authorEmail; -// } -// -// public void setAuthorEmail(String authorEmail) { -// this.authorEmail = authorEmail; -// } -// -// public String getMaintainer() { -// return maintainer; -// } -// -// public void setMaintainer(String maintainer) { -// this.maintainer = maintainer; -// } -// -// public String getMaintainerEmail() { -// return maintainerEmail; -// } -// -// public void setMaintainerEmail(String maintainerEmail) { -// this.maintainerEmail = maintainerEmail; -// } -// -// public List getOrganizationList() { -// return organizationList; -// } -// -// public void setOrganizationList(List organizationList) { -// this.organizationList = organizationList; -// } -// -// public String getSelectedOrganization() { -// return selectedOrganization; -// } -// -// public void setSelectedOrganization(String selectedOrganization) { -// this.selectedOrganization = selectedOrganization; -// } -// -// public ResourceElementBeanProfile getResourceRoot() { -// return resourceRoot; -// } -// -// public void setResourceRoot(ResourceElementBeanProfile resourceRoot) { -// this.resourceRoot = resourceRoot; -// } -// -// public String getAuthorFullName() { -// return authorFullName; -// } -// -// public void setAuthorFullName(String authorFullName) { -// this.authorFullName = authorFullName; -// } -// -// public List getGroups() { -// return groups; -// } -// -// public void setGroups(List groups) { -// this.groups = groups; -// } -// -// public List getTagsVocabulary() { -// return tagsVocabulary; -// } -// -// public void setTagsVocabulary(List tagsVocabulary) { -// this.tagsVocabulary = tagsVocabulary; -// } -// -// public List getGroupsForceCreation() { -// return groupsForceCreation; -// } -// -// public void setGroupsForceCreation(List groupsForceCreation) { -// this.groupsForceCreation = groupsForceCreation; -// } -// -// @Override -// public String toString() { -// return "DatasetBean [" -// + (id != null ? "id=" + id + ", " : "") -// + (title != null ? "title=" + title + ", " : "") -// + (description != null ? "description=" + description + ", " -// : "") -// + (license != null ? "license=" + license + ", " : "") -// + (source != null ? "source=" + source + ", " : "") -// + (authorName != null ? "authorName=" + authorName + ", " : "") -// + (authorSurname != null ? "authorSurname=" + authorSurname -// + ", " : "") -// + (authorFullName != null ? "authorFullName=" + authorFullName -// + ", " : "") -// + (authorEmail != null ? "authorEmail=" + authorEmail + ", " -// : "") -// + (maintainer != null ? "maintainer=" + maintainer + ", " : "") -// + (maintainerEmail != null ? "maintainerEmail=" -// + maintainerEmail + ", " : "") -// + (ownerIdentifier != null ? "ownerIdentifier=" -// + ownerIdentifier + ", " : "") -// + (chosenType != null ? "chosenType=" + chosenType + ", " : "") -// + (selectedOrganization != null ? "selectedOrganization=" -// + selectedOrganization + ", " : "") -// + "version=" -// + version -// + ", visible=" -// + visible -// + ", " -// + (organizationList != null ? "organizationList=" -// + organizationList + ", " : "") -// + (resourceRoot != null ? "resourceRoot=" + resourceRoot + ", " -// : "") -// + (metadataList != null ? "metadataList=" + metadataList + ", " -// : "") -// + (tags != null ? "tags=" + tags + ", " : "") -// + (tagsVocabulary != null ? "tagsVocabulary=" + tagsVocabulary -// + ", " : "") -// + (customFields != null ? "customFields=" + customFields + ", " -// : "") -// + (groups != null ? "groups=" + groups + ", " : "") -// + (groupsForceCreation != null ? "groupsForceCreation=" -// + groupsForceCreation : "") + "]"; -// } -// -//} \ No newline at end of file diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBeanProfile.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBeanProfile.java index 0ea3f25..e9e1856 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBeanProfile.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBeanProfile.java @@ -2,11 +2,13 @@ package org.gcube.portlets.widgets.mpformbuilder.shared.catalogue; import java.io.Serializable; +import com.google.gwt.user.client.rpc.IsSerializable; + /** * A ckan organization/group (you can check its nature by looking at getIsOrganization();) like bean with name and title * @author Costantino Perciante (costantino.perciante@isti.cnr.it) */ -public class OrganizationBeanProfile implements Serializable{ +public class OrganizationBeanProfile implements Serializable, IsSerializable { private static final long serialVersionUID = -6566519399945530602L; private String title; @@ -15,7 +17,6 @@ public class OrganizationBeanProfile implements Serializable{ private boolean propagateUp; // an item linked to this group has to be added on the whole hierarchy chain public OrganizationBeanProfile(){ - super(); } public OrganizationBeanProfile(String title, String name, boolean isOrganization) { diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBeanProfile.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBeanProfile.java index a791ff4..abb87cc 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBeanProfile.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBeanProfile.java @@ -3,14 +3,15 @@ package org.gcube.portlets.widgets.mpformbuilder.shared.catalogue; import java.io.Serializable; import java.util.List; -import com.google.gwt.view.client.ProvidesKey; - +import com.google.gwt.user.client.rpc.IsSerializable; /** - * A resource element bean. Contains part of the logic used into the TwinColumn widget + * A resource element bean. Contains part of the logic used into the TwinColumn + * widget + * * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) */ -public class ResourceElementBeanProfile implements Comparable, Serializable{ +public class ResourceElementBeanProfile implements Serializable, IsSerializable { private static final long serialVersionUID = -1230871392599580669L; private String name; @@ -26,24 +27,9 @@ public class ResourceElementBeanProfile implements Comparable children; - // to generate the GWT identifiers - private static int nextId = 0; - - // identifier of this instance - private int identifierGWT; - - /** - * The key provider that provides the unique ID of a bean. - */ - public static final ProvidesKey KEY_PROVIDER = new ProvidesKey() { - @Override - public Object getKey(ResourceElementBeanProfile item) { - return item == null ? null : item.identifierGWT; - } - }; - /** * Copy constructor + * * @param another */ public ResourceElementBeanProfile(ResourceElementBeanProfile another) { @@ -61,10 +47,7 @@ public class ResourceElementBeanProfile implements Comparable children, - String fullPath) { - this.identifierGWT = nextId; - nextId++; + public ResourceElementBeanProfile(ResourceElementBeanProfile parent, String name, boolean isFolder, + List children, String fullPath) { this.parent = parent; this.name = name; this.isFolder = isFolder; @@ -102,14 +79,11 @@ public class ResourceElementBeanProfile implements Comparable children, String fullPath, - String originalIdInWorkspace, String mimeType, String url, - String description, String organizationNameDatasetParent) { + public ResourceElementBeanProfile(String name, boolean toBeAdded, boolean isFolder, + ResourceElementBeanProfile parent, List children, String fullPath, + String originalIdInWorkspace, String mimeType, String url, String description, + String organizationNameDatasetParent) { super(); - this.identifierGWT = nextId; - nextId++; this.name = name; this.toBeAdded = toBeAdded; this.isFolder = isFolder; @@ -175,8 +149,7 @@ public class ResourceElementBeanProfile implements Comparable Date: Thu, 15 Feb 2024 16:46:36 +0100 Subject: [PATCH 08/10] updated the beans --- .../catalogue/OrganizationBeanProfile.java | 92 ++++++++++++++++--- .../catalogue/ResourceElementBeanProfile.java | 12 +-- 2 files changed, 87 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBeanProfile.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBeanProfile.java index e9e1856..917acad 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBeanProfile.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/OrganizationBeanProfile.java @@ -5,72 +5,142 @@ import java.io.Serializable; import com.google.gwt.user.client.rpc.IsSerializable; /** - * A ckan organization/group (you can check its nature by looking at getIsOrganization();) like bean with name and title - * @author Costantino Perciante (costantino.perciante@isti.cnr.it) + * The Class OrganizationBeanProfile. + * + * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it + * + * Feb 15, 2024 */ public class OrganizationBeanProfile implements Serializable, IsSerializable { - private static final long serialVersionUID = -6566519399945530602L; + /** + * + */ + private static final long serialVersionUID = -2078766102599662775L; private String title; private String name; private boolean isOrganization; private boolean propagateUp; // an item linked to this group has to be added on the whole hierarchy chain - - public OrganizationBeanProfile(){ + + /** + * Instantiates a new organization bean profile. + */ + public OrganizationBeanProfile() { } + /** + * Instantiates a new organization bean profile. + * + * @param title the title + * @param name the name + * @param isOrganization the is organization + */ public OrganizationBeanProfile(String title, String name, boolean isOrganization) { - super(); this.title = title; this.name = name; this.isOrganization = isOrganization; } - + + /** + * Instantiates a new organization bean profile. + * + * @param title the title + * @param name the name + * @param isOrganization the is organization + * @param propagateUp the propagate up + */ public OrganizationBeanProfile(String title, String name, boolean isOrganization, boolean propagateUp) { - super(); this.title = title; this.name = name; this.isOrganization = isOrganization; this.propagateUp = propagateUp; } + /** + * Gets the title. + * + * @return the title + */ public String getTitle() { return title; } + /** + * Sets the title. + * + * @param title the new title + */ public void setTitle(String title) { this.title = title; } + /** + * Gets the name. + * + * @return the name + */ public String getName() { return name; } + /** + * Sets the name. + * + * @param name the new name + */ public void setName(String name) { this.name = name; } + /** + * Checks if is organization. + * + * @return true, if is organization + */ public boolean isOrganization() { return isOrganization; } + /** + * Sets the organization. + * + * @param isOrganization the new organization + */ public void setOrganization(boolean isOrganization) { this.isOrganization = isOrganization; } + /** + * Checks if is propagate up. + * + * @return true, if is propagate up + */ public boolean isPropagateUp() { return propagateUp; } + /** + * Sets the propagate up. + * + * @param propagateUp the new propagate up + */ public void setPropagateUp(boolean propagateUp) { this.propagateUp = propagateUp; } @Override public String toString() { - return "OrganizationBeanProfile [title=" + title + ", name=" + name - + ", isOrganization=" + isOrganization + ", propagateUp=" - + propagateUp + "]"; + StringBuilder builder = new StringBuilder(); + builder.append("OrganizationBeanProfile [title="); + builder.append(title); + builder.append(", name="); + builder.append(name); + builder.append(", isOrganization="); + builder.append(isOrganization); + builder.append(", propagateUp="); + builder.append(propagateUp); + builder.append("]"); + return builder.toString(); } } diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBeanProfile.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBeanProfile.java index abb87cc..8c91d5d 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBeanProfile.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/shared/catalogue/ResourceElementBeanProfile.java @@ -27,6 +27,12 @@ public class ResourceElementBeanProfile implements Serializable, IsSerializable private ResourceElementBeanProfile parent; private List children; + /** + * Default constructor + */ + public ResourceElementBeanProfile() { + } + /** * Copy constructor * @@ -44,12 +50,6 @@ public class ResourceElementBeanProfile implements Serializable, IsSerializable this.organizationNameDatasetParent = another.organizationNameDatasetParent; } - /** - * Default constructor - */ - public ResourceElementBeanProfile() { - } - /** * @param identifier * @param parentFolder From 4829f5b9598a53dd34e0db83b4985eaed5ec3780 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Fri, 16 Feb 2024 10:15:52 +0100 Subject: [PATCH 09/10] Updated LoaderIcon --- .../mpformbuilder/client/ui/utils/LoaderIcon.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/utils/LoaderIcon.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/utils/LoaderIcon.java index 4505b62..2a63e25 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/utils/LoaderIcon.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/utils/LoaderIcon.java @@ -4,11 +4,11 @@ package org.gcube.portlets.widgets.mpformbuilder.client.ui.utils; -import org.gcube.portlets.widgets.mpformbuilder.client.ui.icons.Images; - +import com.github.gwtbootstrap.client.ui.Icon; +import com.github.gwtbootstrap.client.ui.constants.IconType; +import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.Image; /** * The Class LoaderIcon. @@ -19,8 +19,10 @@ import com.google.gwt.user.client.ui.Image; public class LoaderIcon extends HorizontalPanel{ - private Image imgLoading = new Image(Images.ICONS.loading()); + //private Image imgLoading = new Image(Images.ICONS.loading()); private HTML txtLoading = new HTML(""); + private Icon iconSpinner = new Icon(IconType.SPINNER); + /** * Instantiates a new loader icon. @@ -37,8 +39,10 @@ public class LoaderIcon extends HorizontalPanel{ */ public LoaderIcon() { setStyleName("marginTop20"); - add(imgLoading); add(txtLoading); + iconSpinner.setSpin(true); + iconSpinner.getElement().getStyle().setMarginLeft(5, Unit.PX); + add(iconSpinner); } /** From 51102c195d7548a0a9bd5648de1760eb6ca6ee61 Mon Sep 17 00:00:00 2001 From: "francesco.mangiacrapa" Date: Tue, 20 Feb 2024 15:18:24 +0100 Subject: [PATCH 10/10] Added final to some properties. --- .../mpformbuilder/client/form/generic/CreateMetadataForm.java | 2 +- .../widgets/mpformbuilder/client/ui/utils/LoaderIcon.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java index 0a7ff7b..9e7335e 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/form/generic/CreateMetadataForm.java @@ -429,7 +429,7 @@ public class CreateMetadataForm extends Composite implements HasGenericFormListe * @param listFileUploaded the file uploaded */ private void prepareMetadataList(final List profiles, - List listFileUploaded) { + final List listFileUploaded) { if (profiles != null && !profiles.isEmpty()) { GWT.log("Building form/s for profile/s: " + profiles); diff --git a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/utils/LoaderIcon.java b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/utils/LoaderIcon.java index 2a63e25..e80d823 100644 --- a/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/utils/LoaderIcon.java +++ b/src/main/java/org/gcube/portlets/widgets/mpformbuilder/client/ui/utils/LoaderIcon.java @@ -41,6 +41,7 @@ public class LoaderIcon extends HorizontalPanel{ setStyleName("marginTop20"); add(txtLoading); iconSpinner.setSpin(true); + iconSpinner.getElement().getStyle().setProperty("animation", "spin 1s infinite linear"); iconSpinner.getElement().getStyle().setMarginLeft(5, Unit.PX); add(iconSpinner); }