In progress: implement the Edit facility #26640

This commit is contained in:
Francesco Mangiacrapa 2024-02-02 17:09:09 +01:00
parent f953c2edcf
commit 1f5da4f937
39 changed files with 2871 additions and 2830 deletions

View File

@ -4,11 +4,12 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.1.3-SNAPSHOT] - 2023-07-25 ## [v2.2.0-SNAPSHOT] - 2024-02-02
**Enhancement** **Enhancement**
- [#25433] Added spinner during resource creation - Implemented the Edit facility [#26640]
- Added spinner during resource creation [#25433]
## [v2.1.2] - 2023-03-10 ## [v2.1.2] - 2023-03-10

View File

@ -13,7 +13,7 @@
<groupId>org.gcube.portlets.widgets</groupId> <groupId>org.gcube.portlets.widgets</groupId>
<artifactId>ckan-metadata-publisher-widget</artifactId> <artifactId>ckan-metadata-publisher-widget</artifactId>
<version>2.1.3-SNAPSHOT</version> <version>2.2.0-SNAPSHOT</version>
<name>gCube Ckan metadata publisher widget</name> <name>gCube Ckan metadata publisher widget</name>
<description> <description>
@ -94,6 +94,11 @@
<artifactId>portal-manager</artifactId> <artifactId>portal-manager</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
<artifactId>metadata-profile-form-builder-widget</artifactId>
<version>[2.0.0-SNAPSHOT, 3.0.0-SNAPSHOT)</version>
</dependency>
<dependency> <dependency>
<groupId>org.gcube.data-catalogue</groupId> <groupId>org.gcube.data-catalogue</groupId>
<artifactId>gcubedatacatalogue-metadata-discovery</artifactId> <artifactId>gcubedatacatalogue-metadata-discovery</artifactId>

View File

@ -6,17 +6,26 @@
<!-- Other module inherits --> <!-- Other module inherits -->
<inherits name="com.github.gwtbootstrap.Bootstrap" /> <inherits name="com.github.gwtbootstrap.Bootstrap" />
<!-- Responsive design --> <!-- Responsive design -->
<set-property name="bootstrap.responsiveDesign" value="true" /> <set-property name="bootstrap.responsiveDesign"
<inherits name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' /> value="true" />
<inherits
name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
<inherits name='com.github.gwtbootstrap.datepicker.Datepicker' /> <inherits name='com.github.gwtbootstrap.datepicker.Datepicker' />
<inherits name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' /> <inherits
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' /> name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
<inherits
<inherits name='com.google.gwt.json.JSON'/> name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<inherits name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' /> <inherits name='com.google.gwt.json.JSON' />
<inherits name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' /> <inherits
name='org.gcube.portlets.widgets.openlayerbasicwidgets.olbasicwidgets' />
<inherits
name='org.gcube.portlets.widgets.wsexplorer.WorkspaceExplorer' />
<inherits
name='org.gcube.portlets.widgets.mpformbuilder.MetadataProfileFormBuilder' />
<!-- Specify the app entry point class. --> <!-- Specify the app entry point class. -->
<entry-point <entry-point

View File

@ -5,11 +5,12 @@ import java.util.List;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.openlayerwidget.GeoJsonAreaSelectionDialog; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.openlayerwidget.GeoJsonAreaSelectionDialog;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.CreateDatasetForm; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.CreateDatasetForm;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.MetaDataFieldSkeleton;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace.SelectResourceByWEMainPanel; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace.SelectResourceByWEMainPanel;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.DataTypeWrapper; import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper; import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.MetaDataFieldSkeleton;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.DataTypeWrapper;
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetadataFieldWrapper;
import org.gcube.portlets.widgets.openlayerbasicwidgets.client.widgets.GeometryType; import org.gcube.portlets.widgets.openlayerbasicwidgets.client.widgets.GeometryType;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
@ -165,10 +166,10 @@ public class CKanMetadataPublisher implements EntryPoint {
// spatial // spatial
fields.add(new MetadataFieldWrapper("GeoJson", true, DataTypeWrapper.GeoJSON, "", "", null, null, null)); fields.add(new MetadataFieldWrapper("FieldId", "GeoJson", true, DataTypeWrapper.GeoJSON, "", "", null, null, null));
// number // number
fields.add(new MetadataFieldWrapper("Number", true, DataTypeWrapper.Number, "52", "Number example", null, null, null)); fields.add(new MetadataFieldWrapper(null, "Number", true, DataTypeWrapper.Number, "52", "Number example", null, null, null));
// other number // other number
//fields.add(new MetadataFieldWrapper("Number2", true, DataType.Number, null, "Number example 2", null, "[0-9]+")); //fields.add(new MetadataFieldWrapper("Number2", true, DataType.Number, null, "Number example 2", null, "[0-9]+"));
@ -207,7 +208,7 @@ public class CKanMetadataPublisher implements EntryPoint {
for (MetadataFieldWrapper metadataFieldWrapper : fields) { for (MetadataFieldWrapper metadataFieldWrapper : fields) {
MetaDataFieldSkeleton widget; MetaDataFieldSkeleton widget;
try { try {
widget = new MetaDataFieldSkeleton(metadataFieldWrapper, eventBus); widget = new MetaDataFieldSkeleton(metadataFieldWrapper, eventBus, OPERATION.NEW);
widgetsList.add(widget); widgetsList.add(widget);
panel.add(widget); panel.add(widget);
} catch (Exception e) { } catch (Exception e) {
@ -242,7 +243,7 @@ public class CKanMetadataPublisher implements EntryPoint {
@Override @Override
public void onClick(ClickEvent event) { public void onClick(ClickEvent event) {
for (MetaDataFieldSkeleton field : widgetsList) for (MetaDataFieldSkeleton field : widgetsList)
field.freeze(); field.freeze(true);
} }
}); });

View File

@ -5,8 +5,8 @@ import java.util.List;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses.LicenseBean; import org.gcube.portlets.widgets.mpformbuilder.shared.license.LicenseBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetaDataProfileBean; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
import com.google.gwt.user.client.rpc.RemoteService; import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath; import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;

View File

@ -5,8 +5,8 @@ import java.util.List;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses.LicenseBean; import org.gcube.portlets.widgets.mpformbuilder.shared.license.LicenseBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetaDataProfileBean; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;

View File

@ -17,22 +17,24 @@ import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCre
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEventHandler; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEventHandler;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteCustomFieldEvent; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteCustomFieldEvent;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteCustomFieldEventHandler; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteCustomFieldEventHandler;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.CategoryPanel;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.CustomFieldEntry; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.CustomFieldEntry;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.MetaDataFieldSkeleton;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources.AddResourceContainer;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources.AddResourceToDataset; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources.AddResourceToDataset;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources.AddedResourcesSummary;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.tags.TagsPanel;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.InfoIconsLabels; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.InfoIconsLabels;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.WizardCreator; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.WizardCreator;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace.SelectResourceByWEMainPanel; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace.SelectResourceByWEMainPanel;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses.LicenseBean; import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.CategoryWrapper; import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetaDataProfileBean; import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CategoryPanel;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper; 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.AddedResourcesSummary;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.tags.TagsPanel;
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.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;
@ -312,7 +314,16 @@ public class CreateDatasetForm extends Composite {
* @param eventBus the event bus * @param eventBus the event bus
*/ */
public CreateDatasetForm(HandlerManager eventBus) { public CreateDatasetForm(HandlerManager eventBus) {
createDatasetFormBody(false, null, eventBus); createDatasetFormBody(false, null, eventBus, OPERATION.NEW);
}
/**
* Invoked in the most general case
*
* @param eventBus the event bus
*/
public CreateDatasetForm(HandlerManager eventBus, OPERATION operation) {
createDatasetFormBody(false, null, eventBus, operation);
} }
/** /**
@ -322,7 +333,7 @@ public class CreateDatasetForm extends Composite {
* @param eventBus the event bus * @param eventBus the event bus
*/ */
public CreateDatasetForm(String idFolderOrFileWorkspace, HandlerManager eventBus) { public CreateDatasetForm(String idFolderOrFileWorkspace, HandlerManager eventBus) {
createDatasetFormBody(true, idFolderOrFileWorkspace, eventBus); createDatasetFormBody(true, idFolderOrFileWorkspace, eventBus, OPERATION.NEW);
} }
/** /**
@ -357,7 +368,7 @@ public class CreateDatasetForm extends Composite {
* @param eventBus * @param eventBus
*/ */
private void createDatasetFormBody(final boolean isWorkspaceRequest, final String idFolderOrFileWorkspace, private void createDatasetFormBody(final boolean isWorkspaceRequest, final String idFolderOrFileWorkspace,
final HandlerManager eventBus) { final HandlerManager eventBus, final OPERATION operation) {
initWidget(uiBinder.createAndBindUi(this)); initWidget(uiBinder.createAndBindUi(this));
this.eventBus = eventBus; this.eventBus = eventBus;
@ -499,7 +510,7 @@ public class CreateDatasetForm extends Composite {
@Override @Override
public void onChange(ChangeEvent event) { public void onChange(ChangeEvent event) {
event.preventDefault(); event.preventDefault();
organizationsListboxChangeHandlerBody(); organizationsListboxChangeHandlerBody(operation);
} }
}); });
@ -557,7 +568,7 @@ public class CreateDatasetForm extends Composite {
} }
receivedBean.setMetadataList(profiles); receivedBean.setMetadataList(profiles);
prepareMetadataList(receivedBean); prepareMetadataList(receivedBean, operation);
organizationsListbox.setEnabled(true); organizationsListbox.setEnabled(true);
metadataTypeListbox.setEnabled(true); metadataTypeListbox.setEnabled(true);
@ -658,7 +669,7 @@ public class CreateDatasetForm extends Composite {
* When the organization name is changed we need to retrieve the list of * When the organization name is changed we need to retrieve the list of
* profiles and groups * profiles and groups
*/ */
private void organizationsListboxChangeHandlerBody() { private void organizationsListboxChangeHandlerBody(OPERATION operation) {
// remove any other product profiles // remove any other product profiles
metadataTypeListbox.clear(); metadataTypeListbox.clear();
@ -693,7 +704,7 @@ public class CreateDatasetForm extends Composite {
if (profiles != null) { if (profiles != null) {
receivedBean.setMetadataList(profiles); receivedBean.setMetadataList(profiles);
prepareMetadataList(receivedBean); prepareMetadataList(receivedBean, operation);
organizationsListbox.setEnabled(true); organizationsListbox.setEnabled(true);
metadataTypeListbox.setEnabled(true); metadataTypeListbox.setEnabled(true);
@ -775,7 +786,7 @@ public class CreateDatasetForm extends Composite {
* *
* @param receivedBean * @param receivedBean
*/ */
private void prepareMetadataList(final DatasetBean receivedBean) { private void prepareMetadataList(final DatasetBean receivedBean, OPERATION operation) {
List<MetaDataProfileBean> profiles = receivedBean.getMetadataList(); List<MetaDataProfileBean> profiles = receivedBean.getMetadataList();
@ -797,7 +808,7 @@ public class CreateDatasetForm extends Composite {
receivedBean.setChosenType(null); receivedBean.setChosenType(null);
} else { } else {
receivedBean.setChosenType(selectedItemText); receivedBean.setChosenType(selectedItemText);
addFields(selectedItemText); addFields(selectedItemText, operation);
} }
} }
}); });
@ -835,7 +846,7 @@ public class CreateDatasetForm extends Composite {
* *
* @param selectedItem * @param selectedItem
*/ */
protected void addFields(String selectedItem) { protected void addFields(String selectedItem, OPERATION operation) {
for (MetaDataProfileBean bean : receivedBean.getMetadataList()) { for (MetaDataProfileBean bean : receivedBean.getMetadataList()) {
if (bean.getType().equals(selectedItem)) { if (bean.getType().equals(selectedItem)) {
@ -860,7 +871,7 @@ public class CreateDatasetForm extends Composite {
MetaDataField fieldWidget; MetaDataField fieldWidget;
try { try {
fieldWidget = new MetaDataField(field, eventBus); fieldWidget = new MetaDataField(field, eventBus, operation);
metadataFieldsPanel.add(fieldWidget); metadataFieldsPanel.add(fieldWidget);
listOfMetadataFields.add(fieldWidget); listOfMetadataFields.add(fieldWidget);
} catch (Exception e) { } catch (Exception e) {
@ -891,7 +902,7 @@ public class CreateDatasetForm extends Composite {
MetaDataField fieldWidget; MetaDataField fieldWidget;
try { try {
fieldWidget = new MetaDataField(metadataFieldWrapper, eventBus); fieldWidget = new MetaDataField(metadataFieldWrapper, eventBus, operation);
cp.addField(fieldWidget); cp.addField(fieldWidget);
listOfMetadataFields.add(fieldWidget); listOfMetadataFields.add(fieldWidget);
} catch (Exception e) { } catch (Exception e) {
@ -915,7 +926,7 @@ public class CreateDatasetForm extends Composite {
MetaDataField fieldWidget; MetaDataField fieldWidget;
try { try {
fieldWidget = new MetaDataField(field, eventBus); fieldWidget = new MetaDataField(field, eventBus, operation);
extrasCategory.addField(fieldWidget); extrasCategory.addField(fieldWidget);
listOfMetadataFields.add(fieldWidget); listOfMetadataFields.add(fieldWidget);
} catch (Exception e) { } catch (Exception e) {
@ -1273,6 +1284,7 @@ public class CreateDatasetForm extends Composite {
tabPanel.setWidth("100%"); tabPanel.setWidth("100%");
// add the form // add the form
resourceForm = new AddResourceToDataset(eventBus, createdDatasetBean.getId(), resourceForm = new AddResourceToDataset(eventBus, createdDatasetBean.getId(),
createdDatasetBean.getTitle(), createdDatasetBean.getTitle(),
createdDatasetBean.getSelectedOrganization(), owner, datasetUrl); createdDatasetBean.getSelectedOrganization(), owner, datasetUrl);
@ -1615,7 +1627,7 @@ public class CreateDatasetForm extends Composite {
// disable profile fields // disable profile fields
for (MetaDataField metaField : listOfMetadataFields) { for (MetaDataField metaField : listOfMetadataFields) {
for (MetaDataFieldSkeleton field : metaField.getListOfMetadataFields()) { for (MetaDataFieldSkeleton field : metaField.getListOfMetadataFields()) {
field.freeze(); field.freeze(true);
} }
} }

View File

@ -1,162 +1,162 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form; //package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
//
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.MetaDataFieldSkeleton; //import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.MetaDataFieldSkeleton;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper; //import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper;
//
import com.github.gwtbootstrap.client.ui.Button; //import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Label; //import com.github.gwtbootstrap.client.ui.Label;
import com.github.gwtbootstrap.client.ui.constants.LabelType; //import com.github.gwtbootstrap.client.ui.constants.LabelType;
import com.google.gwt.core.client.GWT; //import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent; //import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; //import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager; //import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder; //import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField; //import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite; //import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel; //import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget; //import com.google.gwt.user.client.ui.Widget;
//
//
/** ///**
* The Class MetaDataField. // * The Class MetaDataField.
* // *
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) // * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* // *
* Jun 10, 2019 // * Jun 10, 2019
*/ // */
public class MetaDataField extends Composite { //public class MetaDataField extends Composite {
//
private static MetaDataFieldUiBinder uiBinder = GWT.create(MetaDataFieldUiBinder.class); // private static MetaDataFieldUiBinder uiBinder = GWT.create(MetaDataFieldUiBinder.class);
//
@UiField VerticalPanel panelMetaDataFieldsSkeleton; // @UiField VerticalPanel panelMetaDataFieldsSkeleton;
//
@UiField Label repeatabilityLabel; // @UiField Label repeatabilityLabel;
//
//@UiField ControlGroup cgMetaDataFieldSkeletonFields; // //@UiField ControlGroup cgMetaDataFieldSkeletonFields;
//
@UiField Button addFieldButton; // @UiField Button addFieldButton;
//
@UiField Button removeFieldButton; // @UiField Button removeFieldButton;
//
private List<MetaDataFieldSkeleton> listOfMetadataFields = new ArrayList<MetaDataFieldSkeleton>(); // private List<MetaDataFieldSkeleton> listOfMetadataFields = new ArrayList<MetaDataFieldSkeleton>();
//
private MetadataFieldWrapper fieldWrapper; // private MetadataFieldWrapper fieldWrapper;
//
private HandlerManager eventBus; // private HandlerManager eventBus;
//
/** // /**
* The Interface MetaDataFieldUiBinder. // * The Interface MetaDataFieldUiBinder.
* // *
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) // * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
* // *
* Jun 10, 2019 // * Jun 10, 2019
*/ // */
interface MetaDataFieldUiBinder extends UiBinder<Widget, MetaDataField> { // interface MetaDataFieldUiBinder extends UiBinder<Widget, MetaDataField> {
} // }
//
//
/** // /**
* Instantiates a new meta data field. // * Instantiates a new meta data field.
* // *
* @param field the field // * @param field the field
* @param eventBus the event bus // * @param eventBus the event bus
* @throws Exception the exception // * @throws Exception the exception
*/ // */
public MetaDataField(final MetadataFieldWrapper field, HandlerManager eventBus) throws Exception { // public MetaDataField(final MetadataFieldWrapper field, HandlerManager eventBus) throws Exception {
initWidget(uiBinder.createAndBindUi(this)); // initWidget(uiBinder.createAndBindUi(this));
this.fieldWrapper = field; // this.fieldWrapper = field;
this.eventBus = eventBus; // this.eventBus = eventBus;
addNewOccurrenceOfField(); // addNewOccurrenceOfField();
checkAllowedAddField(); // checkAllowedAddField();
checkAllowedRemoveField(); // checkAllowedRemoveField();
//
addFieldButton.addClickHandler(new ClickHandler() { // addFieldButton.addClickHandler(new ClickHandler() {
//
@Override // @Override
public void onClick(ClickEvent event) { // public void onClick(ClickEvent event) {
addNewOccurrenceOfField(); // addNewOccurrenceOfField();
checkAllowedAddField(); // checkAllowedAddField();
checkAllowedRemoveField(); // checkAllowedRemoveField();
} // }
}); // });
//
removeFieldButton.addClickHandler(new ClickHandler() { // removeFieldButton.addClickHandler(new ClickHandler() {
//
@Override // @Override
public void onClick(ClickEvent event) { // public void onClick(ClickEvent event) {
removeLatestOccurrenceOfFiled(); // removeLatestOccurrenceOfFiled();
checkAllowedAddField(); // checkAllowedAddField();
checkAllowedRemoveField(); // checkAllowedRemoveField();
} // }
}); // });
//
//The field is repeatable // //The field is repeatable
if(field.getMaxOccurs()>1) { // if(field.getMaxOccurs()>1) {
repeatabilityLabel.setVisible(true); // repeatabilityLabel.setVisible(true);
repeatabilityLabel.setType(LabelType.INFO); // repeatabilityLabel.setType(LabelType.INFO);
addFieldButton.setTitle("Add another "+field.getFieldName()); // addFieldButton.setTitle("Add another "+field.getFieldName());
removeFieldButton.setTitle("Remove latest "+field.getFieldName()); // removeFieldButton.setTitle("Remove latest "+field.getFieldName());
// String maxTxt = field.getMaxOccurs()==Integer.MAX_VALUE?"":"(max occurs declared are "+field.getMaxOccurs()+" times)"; //// String maxTxt = field.getMaxOccurs()==Integer.MAX_VALUE?"":"(max occurs declared are "+field.getMaxOccurs()+" times)";
} // }
} // }
//
//
/** // /**
* Check allowed remove field. // * Check allowed remove field.
*/ // */
private void checkAllowedRemoveField() { // private void checkAllowedRemoveField() {
boolean removeCond = fieldWrapper.getMaxOccurs()>1 && listOfMetadataFields.size()>1; // boolean removeCond = fieldWrapper.getMaxOccurs()>1 && listOfMetadataFields.size()>1;
removeFieldButton.setVisible(removeCond); // removeFieldButton.setVisible(removeCond);
} // }
//
/** // /**
* Checks if is allowed add occurrence. // * Checks if is allowed add occurrence.
*/ // */
private void checkAllowedAddField() { // private void checkAllowedAddField() {
//
boolean repeatibilityCond = fieldWrapper.getMaxOccurs()>1 && listOfMetadataFields.size()<fieldWrapper.getMaxOccurs(); // boolean repeatibilityCond = fieldWrapper.getMaxOccurs()>1 && listOfMetadataFields.size()<fieldWrapper.getMaxOccurs();
addFieldButton.setVisible(repeatibilityCond); // addFieldButton.setVisible(repeatibilityCond);
//
} // }
//
//
/** // /**
* Removes the latest occurrence of filed. // * Removes the latest occurrence of filed.
*/ // */
private void removeLatestOccurrenceOfFiled() { // private void removeLatestOccurrenceOfFiled() {
int size = listOfMetadataFields.size(); // int size = listOfMetadataFields.size();
MetaDataFieldSkeleton skeleton = listOfMetadataFields.get(size-1); // MetaDataFieldSkeleton skeleton = listOfMetadataFields.get(size-1);
try { // try {
panelMetaDataFieldsSkeleton.remove(skeleton); // panelMetaDataFieldsSkeleton.remove(skeleton);
listOfMetadataFields.remove(size-1); // listOfMetadataFields.remove(size-1);
}catch (Exception e) { // }catch (Exception e) {
GWT.log("Error: ",e); // GWT.log("Error: ",e);
} // }
} // }
//
/** // /**
* Adds the new occurrence of field. // * Adds the new occurrence of field.
*/ // */
private void addNewOccurrenceOfField() { // private void addNewOccurrenceOfField() {
try { // try {
MetaDataFieldSkeleton fieldWidget = new MetaDataFieldSkeleton(fieldWrapper, eventBus); // MetaDataFieldSkeleton fieldWidget = new MetaDataFieldSkeleton(fieldWrapper, eventBus);
listOfMetadataFields.add(fieldWidget); // listOfMetadataFields.add(fieldWidget);
panelMetaDataFieldsSkeleton.add(fieldWidget); // panelMetaDataFieldsSkeleton.add(fieldWidget);
} catch (Exception e) { // } catch (Exception e) {
GWT.log("Error: ",e); // GWT.log("Error: ",e);
} // }
} // }
//
/** // /**
* Gets the list of metadata fields. // * Gets the list of metadata fields.
* // *
* @return the list of metadata fields // * @return the list of metadata fields
*/ // */
public List<MetaDataFieldSkeleton> getListOfMetadataFields() { // public List<MetaDataFieldSkeleton> getListOfMetadataFields() {
return listOfMetadataFields; // return listOfMetadataFields;
} // }
//
} //}

View File

@ -1,80 +1,80 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata; //package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
//
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.MetaDataField; //import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.MetaDataField;
//
import com.github.gwtbootstrap.client.ui.PageHeader; //import com.github.gwtbootstrap.client.ui.PageHeader;
import com.google.gwt.core.client.GWT; //import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Float; //import com.google.gwt.dom.client.Style.Float;
import com.google.gwt.uibinder.client.UiBinder; //import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField; //import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite; //import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel; //import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget; //import com.google.gwt.user.client.ui.Widget;
//
public class CategoryPanel extends Composite{ //public class CategoryPanel extends Composite{
//
private static CategoryPanelUiBinder uiBinder = GWT // private static CategoryPanelUiBinder uiBinder = GWT
.create(CategoryPanelUiBinder.class); // .create(CategoryPanelUiBinder.class);
//
interface CategoryPanelUiBinder extends UiBinder<Widget, CategoryPanel> { // interface CategoryPanelUiBinder extends UiBinder<Widget, CategoryPanel> {
} // }
//
@UiField VerticalPanel fieldsPanel; // @UiField VerticalPanel fieldsPanel;
@UiField PageHeader categoryHeader; // @UiField PageHeader categoryHeader;
//private List<MetaDataFieldSkeleton> fieldsForThisCategory; // //private List<MetaDataFieldSkeleton> fieldsForThisCategory;
//
private List<MetaDataField> fieldsForThisCategory; // private List<MetaDataField> fieldsForThisCategory;
//
public CategoryPanel() { // public CategoryPanel() {
initWidget(uiBinder.createAndBindUi(this)); // initWidget(uiBinder.createAndBindUi(this));
} // }
//
/** // /**
* // *
* @param fieldsForThisCategory // * @param fieldsForThisCategory
* @param title // * @param title
* @param description // * @param description
*/ // */
public CategoryPanel(String title, String description) { // public CategoryPanel(String title, String description) {
initWidget(uiBinder.createAndBindUi(this)); // initWidget(uiBinder.createAndBindUi(this));
title = title == null ? "" : title; // title = title == null ? "" : title;
description = description == null ? "" : description; // description = description == null ? "" : description;
categoryHeader.setTitle(title); // categoryHeader.setTitle(title);
categoryHeader.setText(title); // categoryHeader.setText(title);
categoryHeader.setSubtext(description); // categoryHeader.setSubtext(description);
categoryHeader.getElement().getStyle().setFloat(Float.LEFT); // categoryHeader.getElement().getStyle().setFloat(Float.LEFT);
} // }
//
/** // /**
* Add a field to this widget // * Add a field to this widget
* @param fieldWidget // * @param fieldWidget
*/ // */
/*public void addField(MetaDataFieldSkeleton fieldWidget) { // /*public void addField(MetaDataFieldSkeleton fieldWidget) {
if(fieldsForThisCategory == null){ // if(fieldsForThisCategory == null){
fieldsForThisCategory = new ArrayList<MetaDataFieldSkeleton>(); // fieldsForThisCategory = new ArrayList<MetaDataFieldSkeleton>();
fieldWidget.setVisible(true); // fieldWidget.setVisible(true);
fieldsPanel.setVisible(true); // fieldsPanel.setVisible(true);
} // }
fieldsForThisCategory.add(fieldWidget); // fieldsForThisCategory.add(fieldWidget);
fieldsPanel.add(fieldWidget); // fieldsPanel.add(fieldWidget);
}*/ // }*/
//
//
/** // /**
* Add a field to this widget // * Add a field to this widget
* @param fieldWidget // * @param fieldWidget
*/ // */
public void addField(MetaDataField fieldWidget) { // public void addField(MetaDataField fieldWidget) {
if(fieldsForThisCategory == null){ // if(fieldsForThisCategory == null){
fieldsForThisCategory = new ArrayList<MetaDataField>(); // fieldsForThisCategory = new ArrayList<MetaDataField>();
fieldWidget.setVisible(true); // fieldWidget.setVisible(true);
fieldsPanel.setVisible(true); // fieldsPanel.setVisible(true);
} // }
fieldsForThisCategory.add(fieldWidget); // fieldsForThisCategory.add(fieldWidget);
fieldsPanel.add(fieldWidget); // fieldsPanel.add(fieldWidget);
} // }
//
} //}

View File

@ -1,12 +1,12 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!-- <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"> xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<g:HTMLPanel> <g:HTMLPanel>
<g:VerticalPanel width="100%"> <g:VerticalPanel width="100%">
<b:PageHeader ui:field="categoryHeader"></b:PageHeader> <b:PageHeader ui:field="categoryHeader"></b:PageHeader>
<!-- Here will be placed the metadata fields formats --> Here will be placed the metadata fields formats
<g:VerticalPanel ui:field="fieldsPanel" visible="false" <g:VerticalPanel ui:field="fieldsPanel" visible="false"
width="100%"></g:VerticalPanel> width="100%"></g:VerticalPanel>
</g:VerticalPanel> </g:VerticalPanel>
</g:HTMLPanel> </g:HTMLPanel>
</ui:UiBinder> </ui:UiBinder> -->

View File

@ -1,4 +1,4 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!-- <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"> xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<b:Controls> <b:Controls>
@ -10,4 +10,4 @@
</b:InputAddOn> </b:InputAddOn>
<b:Button icon="REMOVE_SIGN" title="Remove field" ui:field="removeCustomField"></b:Button> <b:Button icon="REMOVE_SIGN" title="Remove field" ui:field="removeCustomField"></b:Button>
</b:Controls> </b:Controls>
</ui:UiBinder> </ui:UiBinder> -->

View File

@ -1,4 +1,4 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!-- <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui" xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
xmlns:b2="urn:import:com.github.gwtbootstrap.datetimepicker.client.ui" xmlns:b2="urn:import:com.github.gwtbootstrap.datetimepicker.client.ui"
@ -33,7 +33,7 @@
<g:FlowPanel width="95%"> <g:FlowPanel width="95%">
<g:SimplePanel ui:field="elementPanel" styleName="{style.element-panel}" <g:SimplePanel ui:field="elementPanel" styleName="{style.element-panel}"
width="95%"> width="95%">
<!-- Listbox, Checkbox, Textbox, Calendar etc --> Listbox, Checkbox, Textbox, Calendar etc
</g:SimplePanel> </g:SimplePanel>
<g:FlowPanel ui:field="noteFieldContainer" styleName="{style.note-container}"> <g:FlowPanel ui:field="noteFieldContainer" styleName="{style.note-container}">
<b:Popover ui:field="noteFieldPopover" html="true" <b:Popover ui:field="noteFieldPopover" html="true"
@ -47,4 +47,4 @@
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
</g:HTMLPanel> </g:HTMLPanel>
</ui:UiBinder> </ui:UiBinder> -->

View File

@ -1,138 +1,138 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.timeandreanges; //package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.timeandreanges;
//
import java.util.Date; //import java.util.Date;
//
import com.github.gwtbootstrap.datepicker.client.ui.DateBox; //import com.github.gwtbootstrap.datepicker.client.ui.DateBox;
import com.github.gwtbootstrap.datetimepicker.client.ui.DateTimeBox; //import com.github.gwtbootstrap.datetimepicker.client.ui.DateTimeBox;
import com.google.gwt.core.client.GWT; //import com.google.gwt.core.client.GWT;
import com.google.gwt.i18n.client.DateTimeFormat; //import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.uibinder.client.UiBinder; //import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField; //import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite; //import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel; //import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.Widget; //import com.google.gwt.user.client.ui.Widget;
//
/** ///**
* Widget for handling date-like fields. // * Widget for handling date-like fields.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/ // */
public class DataTimeBox extends Composite{ //public class DataTimeBox extends Composite{
//
private static DataTimeBoxUiBinder uiBinder = GWT // private static DataTimeBoxUiBinder uiBinder = GWT
.create(DataTimeBoxUiBinder.class); // .create(DataTimeBoxUiBinder.class);
//
interface DataTimeBoxUiBinder extends UiBinder<Widget, DataTimeBox> { // interface DataTimeBoxUiBinder extends UiBinder<Widget, DataTimeBox> {
} // }
//
public static final String RANGE_SEPARATOR_START_END = "/"; // public static final String RANGE_SEPARATOR_START_END = "/";
public static final String MISSING_RANGE_VALUE_START = "MISSING_RANGE_PART_START"; // public static final String MISSING_RANGE_VALUE_START = "MISSING_RANGE_PART_START";
public static final String MISSING_RANGE_VALUE_END = "MISSING_RANGE_PART_END"; // public static final String MISSING_RANGE_VALUE_END = "MISSING_RANGE_PART_END";
private static final String COLON = ":"; // private static final String COLON = ":";
private static final String INSERT_DATE_INSTANT_LABEL = "Insert a date"; // private static final String INSERT_DATE_INSTANT_LABEL = "Insert a date";
private static final String INSERT_TIME_INSTANT_LABEL = "Hour and minutes"; // private static final String INSERT_TIME_INSTANT_LABEL = "Hour and minutes";
private static final String INSERT_DATE_START_LABEL = "Insert a start date"; // private static final String INSERT_DATE_START_LABEL = "Insert a start date";
private static final String INSERT_DATE_END_LABEL = "Insert an end date"; // private static final String INSERT_DATE_END_LABEL = "Insert an end date";
private static final DateTimeFormat formatDate = DateTimeFormat.getFormat("yyyy-MM-dd"); // private static final DateTimeFormat formatDate = DateTimeFormat.getFormat("yyyy-MM-dd");
private static final DateTimeFormat formatTime = DateTimeFormat.getFormat("HH:mm"); // private static final DateTimeFormat formatTime = DateTimeFormat.getFormat("HH:mm");
//
private boolean isRange; // private boolean isRange;
//
@UiField // @UiField
DateBox startRangeDate; // DateBox startRangeDate;
@UiField // @UiField
DateTimeBox startRangeTime; // DateTimeBox startRangeTime;
@UiField // @UiField
DateBox endRangeDate; // DateBox endRangeDate;
@UiField // @UiField
DateTimeBox endRangeTime; // DateTimeBox endRangeTime;
@UiField // @UiField
FlowPanel singleDataEnd; // FlowPanel singleDataEnd;
@UiField // @UiField
FlowPanel singleDataStart; // FlowPanel singleDataStart;
//
public DataTimeBox(boolean isRange) { // public DataTimeBox(boolean isRange) {
initWidget(uiBinder.createAndBindUi(this)); // initWidget(uiBinder.createAndBindUi(this));
this.isRange = isRange; // this.isRange = isRange;
startRangeDate.setPlaceholder(INSERT_DATE_INSTANT_LABEL); // startRangeDate.setPlaceholder(INSERT_DATE_INSTANT_LABEL);
startRangeTime.setPlaceholder(INSERT_TIME_INSTANT_LABEL); // startRangeTime.setPlaceholder(INSERT_TIME_INSTANT_LABEL);
if(isRange){ // if(isRange){
singleDataEnd.setVisible(true); // singleDataEnd.setVisible(true);
singleDataEnd.setWidth("50%"); // singleDataEnd.setWidth("50%");
singleDataStart.setWidth("50%"); // singleDataStart.setWidth("50%");
//
startRangeTime.setWidth("30%"); // startRangeTime.setWidth("30%");
endRangeTime.setWidth("30%"); // endRangeTime.setWidth("30%");
startRangeDate.setWidth("60%"); // startRangeDate.setWidth("60%");
endRangeDate.setWidth("60%"); // endRangeDate.setWidth("60%");
//
startRangeDate.setPlaceholder(INSERT_DATE_START_LABEL); // startRangeDate.setPlaceholder(INSERT_DATE_START_LABEL);
endRangeDate.setPlaceholder(INSERT_DATE_END_LABEL); // endRangeDate.setPlaceholder(INSERT_DATE_END_LABEL);
endRangeTime.setPlaceholder(INSERT_TIME_INSTANT_LABEL); // endRangeTime.setPlaceholder(INSERT_TIME_INSTANT_LABEL);
} // }
startRangeDate.setValue(null); // startRangeDate.setValue(null);
startRangeTime.setValue(null); // startRangeTime.setValue(null);
endRangeDate.setValue(null); // endRangeDate.setValue(null);
endRangeTime.setValue(null); // endRangeTime.setValue(null);
} // }
//
public boolean getIsRange(){ // public boolean getIsRange(){
return isRange; // return isRange;
} // }
//
public void setStartDate(String date, String time){ // public void setStartDate(String date, String time){
GWT.log("Date is " + date + " and time is " + time); // GWT.log("Date is " + date + " and time is " + time);
startRangeDate.setValue(new Date(date)); // startRangeDate.setValue(new Date(date));
if(time != null && !time.isEmpty()){ // if(time != null && !time.isEmpty()){
Date completeDate = new Date(); // Date completeDate = new Date();
completeDate.setHours(Integer.parseInt(time.split(COLON)[0])); // completeDate.setHours(Integer.parseInt(time.split(COLON)[0]));
completeDate.setMinutes(Integer.parseInt(time.split(COLON)[1])); // completeDate.setMinutes(Integer.parseInt(time.split(COLON)[1]));
startRangeTime.setValue(completeDate); // startRangeTime.setValue(completeDate);
} // }
} // }
//
public void setEndDate(String date, String time){ // public void setEndDate(String date, String time){
GWT.log("Date is " + date + " and time is " + time); // GWT.log("Date is " + date + " and time is " + time);
endRangeDate.setValue(new Date(date)); // endRangeDate.setValue(new Date(date));
if(time != null && !time.isEmpty()){ // if(time != null && !time.isEmpty()){
Date completeDate = new Date(); // Date completeDate = new Date();
completeDate.setHours(Integer.parseInt(time.split(COLON)[0])); // completeDate.setHours(Integer.parseInt(time.split(COLON)[0]));
completeDate.setMinutes(Integer.parseInt(time.split(COLON)[1])); // completeDate.setMinutes(Integer.parseInt(time.split(COLON)[1]));
endRangeTime.setValue(completeDate); // endRangeTime.setValue(completeDate);
} // }
} // }
//
/** // /**
* Return the current value, with MISSING_RANGE_VALUE in case of missing entry // * Return the current value, with MISSING_RANGE_VALUE in case of missing entry
* @return // * @return
*/ // */
public String getCurrentValue(){ // public String getCurrentValue(){
//
String firstRange = MISSING_RANGE_VALUE_START; // String firstRange = MISSING_RANGE_VALUE_START;
String secondRange = MISSING_RANGE_VALUE_END; // String secondRange = MISSING_RANGE_VALUE_END;
//
if(startRangeDate.getValue() != null){ // if(startRangeDate.getValue() != null){
firstRange = formatDate.format(startRangeDate.getValue()) + " " + (startRangeTime.getValue() != null ? formatTime.format(startRangeTime.getValue()) : "");; // firstRange = formatDate.format(startRangeDate.getValue()) + " " + (startRangeTime.getValue() != null ? formatTime.format(startRangeTime.getValue()) : "");;
} // }
if(isRange && endRangeDate.getValue() != null){ // if(isRange && endRangeDate.getValue() != null){
secondRange = formatDate.format(endRangeDate.getValue()) + " " + (endRangeTime.getValue() != null ? formatTime.format(endRangeTime.getValue()) : ""); // secondRange = formatDate.format(endRangeDate.getValue()) + " " + (endRangeTime.getValue() != null ? formatTime.format(endRangeTime.getValue()) : "");
} // }
//
if(isRange){ // if(isRange){
GWT.log("Returning " + firstRange + RANGE_SEPARATOR_START_END + secondRange); // GWT.log("Returning " + firstRange + RANGE_SEPARATOR_START_END + secondRange);
return firstRange + RANGE_SEPARATOR_START_END + secondRange; // return firstRange + RANGE_SEPARATOR_START_END + secondRange;
}else { // }else {
GWT.log("Returning " + firstRange); // GWT.log("Returning " + firstRange);
return firstRange; // return firstRange;
} // }
} // }
//
/** // /**
* Freeze the inputs // * Freeze the inputs
*/ // */
public void freeze(){ // public void freeze(){
startRangeDate.setEnabled(false); // startRangeDate.setEnabled(false);
startRangeTime.setEnabled(false); // startRangeTime.setEnabled(false);
endRangeDate.setEnabled(false); // endRangeDate.setEnabled(false);
endRangeTime.setEnabled(false); // endRangeTime.setEnabled(false);
} // }
} //}

View File

@ -1,4 +1,4 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!-- <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b2="urn:import:com.github.gwtbootstrap.datetimepicker.client.ui" xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b2="urn:import:com.github.gwtbootstrap.datetimepicker.client.ui"
xmlns:b3="urn:import:com.github.gwtbootstrap.datepicker.client.ui"> xmlns:b3="urn:import:com.github.gwtbootstrap.datepicker.client.ui">
@ -27,4 +27,4 @@
</g:FlowPanel> </g:FlowPanel>
</g:FlowPanel> </g:FlowPanel>
</g:HTMLPanel> </g:HTMLPanel>
</ui:UiBinder> </ui:UiBinder> -->

View File

@ -1,37 +1,37 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources; //package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources;
//
import com.github.gwtbootstrap.client.ui.TabPanel; //import com.github.gwtbootstrap.client.ui.TabPanel;
import com.google.gwt.core.client.GWT; //import com.google.gwt.core.client.GWT;
import com.google.gwt.uibinder.client.UiBinder; //import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField; //import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Composite; //import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel; //import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget; //import com.google.gwt.user.client.ui.Widget;
//
/** ///**
* Container for the third phase (add resource to dataset) // * Container for the third phase (add resource to dataset)
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/ // */
public class AddResourceContainer extends Composite{ //public class AddResourceContainer extends Composite{
//
private static AddResourceContainerUiBinder uiBinder = GWT // private static AddResourceContainerUiBinder uiBinder = GWT
.create(AddResourceContainerUiBinder.class); // .create(AddResourceContainerUiBinder.class);
//
interface AddResourceContainerUiBinder extends // interface AddResourceContainerUiBinder extends
UiBinder<Widget, AddResourceContainer> { // UiBinder<Widget, AddResourceContainer> {
} // }
//
@UiField VerticalPanel resourcesPanel; // @UiField VerticalPanel resourcesPanel;
//
public AddResourceContainer(final String datasetUrl) { // public AddResourceContainer(final String datasetUrl) {
initWidget(uiBinder.createAndBindUi(this)); // initWidget(uiBinder.createAndBindUi(this));
} // }
//
/** // /**
* Add the form to this panel // * Add the form to this panel
* @param w // * @param w
*/ // */
public void add(TabPanel w){ // public void add(TabPanel w){
resourcesPanel.add(w); // resourcesPanel.add(w);
} // }
} //}

View File

@ -1,8 +1,8 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!-- <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"> xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<g:HTMLPanel> <g:HTMLPanel>
<!-- Here will be placed the form for the resources --> Here will be placed the form for the resources
<g:VerticalPanel ui:field="resourcesPanel" width="100%"></g:VerticalPanel> <g:VerticalPanel ui:field="resourcesPanel" width="100%"></g:VerticalPanel>
</g:HTMLPanel> </g:HTMLPanel>
</ui:UiBinder> </ui:UiBinder> -->

View File

@ -3,8 +3,8 @@ package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherServiceAsync; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherServiceAsync;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.AddResourceEvent; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.AddResourceEvent;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.LoaderIcon;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.LoaderIcon;
import com.github.gwtbootstrap.client.ui.AlertBlock; import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button; import com.github.gwtbootstrap.client.ui.Button;

View File

@ -1,4 +1,4 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!-- <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
xmlns:g="urn:import:com.google.gwt.user.client.ui"> xmlns:g="urn:import:com.google.gwt.user.client.ui">
@ -101,12 +101,12 @@
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
<!-- Alert blocks for info/errors --> Alert blocks for info/errors
<b:AlertBlock type="INFO" animation="true" <b:AlertBlock type="INFO" animation="true"
visible="false" close="false" ui:field="infoBlock" visible="false" close="false" ui:field="infoBlock"
styleName="{style.block-alert-style}"></b:AlertBlock> styleName="{style.block-alert-style}"></b:AlertBlock>
<!-- Add resource button --> Add resource button
<b:Button title="Add resource" ui:field="addResourceButton" <b:Button title="Add resource" ui:field="addResourceButton"
type="PRIMARY">Add</b:Button> type="PRIMARY">Add</b:Button>
@ -122,4 +122,4 @@
type="LINK" visible="true"></b:Button> type="LINK" visible="true"></b:Button>
</g:FlowPanel> </g:FlowPanel>
</g:HTMLPanel> </g:HTMLPanel>
</ui:UiBinder> </ui:UiBinder> -->

View File

@ -1,160 +1,160 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources; //package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources;
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
//
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService; //import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherServiceAsync; //import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherServiceAsync;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.AddResourceEvent; //import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.AddResourceEvent;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.AddResourceEventHandler; //import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.AddResourceEventHandler;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteResourceEvent; //import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteResourceEvent;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteResourceEventHandler; //import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteResourceEventHandler;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean; //import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
//
import com.github.gwtbootstrap.client.ui.Accordion; //import com.github.gwtbootstrap.client.ui.Accordion;
import com.github.gwtbootstrap.client.ui.AccordionGroup; //import com.github.gwtbootstrap.client.ui.AccordionGroup;
import com.github.gwtbootstrap.client.ui.Button; //import com.github.gwtbootstrap.client.ui.Button;
import com.github.gwtbootstrap.client.ui.Paragraph; //import com.github.gwtbootstrap.client.ui.Paragraph;
import com.google.gwt.core.client.GWT; //import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent; //import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; //import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.HandlerManager; //import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.uibinder.client.UiBinder; //import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField; //import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.rpc.AsyncCallback; //import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Composite; //import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.VerticalPanel; //import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget; //import com.google.gwt.user.client.ui.Widget;
//
/** ///**
* A summary of the resources added by the user. // * A summary of the resources added by the user.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/ // */
public class AddedResourcesSummary extends Composite{ //public class AddedResourcesSummary extends Composite{
//
private static AddedResourcesSummaryUiBinder uiBinder = GWT // private static AddedResourcesSummaryUiBinder uiBinder = GWT
.create(AddedResourcesSummaryUiBinder.class); // .create(AddedResourcesSummaryUiBinder.class);
//
interface AddedResourcesSummaryUiBinder extends // interface AddedResourcesSummaryUiBinder extends
UiBinder<Widget, AddedResourcesSummary> { // UiBinder<Widget, AddedResourcesSummary> {
} // }
//
//Create a remote service proxy to talk to the server-side ckan service. // //Create a remote service proxy to talk to the server-side ckan service.
private final CKanPublisherServiceAsync ckanServices = GWT.create(CKanPublisherService.class); // private final CKanPublisherServiceAsync ckanServices = GWT.create(CKanPublisherService.class);
//
// Event bus // // Event bus
private HandlerManager eventBus; // private HandlerManager eventBus;
//
// list of added resources (beans) // // list of added resources (beans)
List<ResourceElementBean> addedResources; // List<ResourceElementBean> addedResources;
//
@UiField VerticalPanel addResourcesPanel; // @UiField VerticalPanel addResourcesPanel;
//
public AddedResourcesSummary(HandlerManager eventBus) { // public AddedResourcesSummary(HandlerManager eventBus) {
initWidget(uiBinder.createAndBindUi(this)); // initWidget(uiBinder.createAndBindUi(this));
//
// save bus // // save bus
this.eventBus = eventBus; // this.eventBus = eventBus;
//
// bind on add resource event // // bind on add resource event
bind(); // bind();
//
// init list // // init list
addedResources = new ArrayList<ResourceElementBean>(); // addedResources = new ArrayList<ResourceElementBean>();
} // }
//
/** // /**
* Bind on add/delete resource event // * Bind on add/delete resource event
*/ // */
private void bind() { // private void bind() {
//
// when a new resource is added // // when a new resource is added
eventBus.addHandler(AddResourceEvent.TYPE, new AddResourceEventHandler() { // eventBus.addHandler(AddResourceEvent.TYPE, new AddResourceEventHandler() {
//
@Override // @Override
public void onAddedResource(AddResourceEvent addResourceEvent) { // public void onAddedResource(AddResourceEvent addResourceEvent) {
//
// get the resource // // get the resource
final ResourceElementBean justAddedResource = addResourceEvent.getResource(); // final ResourceElementBean justAddedResource = addResourceEvent.getResource();
//
// Build an accordion to show resource info // // Build an accordion to show resource info
Accordion accordion = new Accordion(); // Accordion accordion = new Accordion();
AccordionGroup accordionGroup = new AccordionGroup(); // AccordionGroup accordionGroup = new AccordionGroup();
accordionGroup.setHeading("- " + justAddedResource.getName()); // accordionGroup.setHeading("- " + justAddedResource.getName());
accordion.add(accordionGroup); // accordion.add(accordionGroup);
//
// add sub-info such as url and description // // add sub-info such as url and description
Paragraph pUrl = new Paragraph(); // Paragraph pUrl = new Paragraph();
pUrl.setText("Url : " + justAddedResource.getUrl()); // pUrl.setText("Url : " + justAddedResource.getUrl());
Paragraph pDescription = new Paragraph(); // Paragraph pDescription = new Paragraph();
pDescription.setText("Description : " + justAddedResource.getDescription()); // pDescription.setText("Description : " + justAddedResource.getDescription());
//
// button to delete the resource // // button to delete the resource
Button deleteButton = new Button(); // Button deleteButton = new Button();
deleteButton.setText("Delete"); // deleteButton.setText("Delete");
deleteButton.addClickHandler(new ClickHandler() { // deleteButton.addClickHandler(new ClickHandler() {
//
@Override // @Override
public void onClick(ClickEvent event) { // public void onClick(ClickEvent event) {
//
eventBus.fireEvent(new DeleteResourceEvent(justAddedResource)); // eventBus.fireEvent(new DeleteResourceEvent(justAddedResource));
//
} // }
}); // });
//
// fill accordion // // fill accordion
accordionGroup.add(pUrl); // accordionGroup.add(pUrl);
accordionGroup.add(pDescription); // accordionGroup.add(pDescription);
accordionGroup.add(deleteButton); // accordionGroup.add(deleteButton);
//
// add to the list // // add to the list
addedResources.add(justAddedResource); // addedResources.add(justAddedResource);
//
// add to the panel // // add to the panel
addResourcesPanel.add(accordion); // addResourcesPanel.add(accordion);
} // }
}); // });
//
// when the user wants to delete a resource // // when the user wants to delete a resource
eventBus.addHandler(DeleteResourceEvent.TYPE, new DeleteResourceEventHandler() { // eventBus.addHandler(DeleteResourceEvent.TYPE, new DeleteResourceEventHandler() {
//
@Override // @Override
public void onDeletedResource(DeleteResourceEvent deleteResourceEvent) { // public void onDeletedResource(DeleteResourceEvent deleteResourceEvent) {
//
// to delete // // to delete
ResourceElementBean toDelete = deleteResourceEvent.getResource(); // ResourceElementBean toDelete = deleteResourceEvent.getResource();
//
// find it // // find it
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).getOriginalIdInWorkspace().equals(toDelete.getOriginalIdInWorkspace())){
//
// get the associated widget and remove it // // get the associated widget and remove it
final Widget widget = addResourcesPanel.getWidget(i); // final Widget widget = addResourcesPanel.getWidget(i);
//
// remote call to remove it from the dataset // // remote call to remove it from the dataset
ckanServices.deleteResourceFromDataset(toDelete, new AsyncCallback<Boolean>() { // ckanServices.deleteResourceFromDataset(toDelete, new AsyncCallback<Boolean>() {
//
@Override // @Override
public void onSuccess(Boolean result) { // public void onSuccess(Boolean result) {
//
if(result) // if(result)
widget.removeFromParent(); // widget.removeFromParent();
} // }
//
@Override // @Override
public void onFailure(Throwable caught) { // public void onFailure(Throwable caught) {
//
} // }
}); // });
//
break; // break;
} // }
} // }
//
// remove from the list // // remove from the list
addedResources.remove(toDelete); // addedResources.remove(toDelete);
} // }
}); // });
} // }
} //}

View File

@ -1,8 +1,8 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!-- <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui"> xmlns:g="urn:import:com.google.gwt.user.client.ui">
<g:HTMLPanel> <g:HTMLPanel>
<h3>Added Resources</h3> <h3>Added Resources</h3>
<g:VerticalPanel ui:field="addResourcesPanel" width="100%"></g:VerticalPanel> <g:VerticalPanel ui:field="addResourcesPanel" width="100%"></g:VerticalPanel>
</g:HTMLPanel> </g:HTMLPanel>
</ui:UiBinder> </ui:UiBinder> -->

View File

@ -1,279 +1,279 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.tags; //package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.tags;
//
//
import java.util.ArrayList; //import java.util.ArrayList;
import java.util.List; //import java.util.List;
//
import org.gcube.portlets.user.gcubewidgets.client.elements.Span; //import org.gcube.portlets.user.gcubewidgets.client.elements.Span;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.InfoIconsLabels; //import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.InfoIconsLabels;
//
import com.github.gwtbootstrap.client.ui.ControlGroup; //import com.github.gwtbootstrap.client.ui.ControlGroup;
import com.github.gwtbootstrap.client.ui.Icon; //import com.github.gwtbootstrap.client.ui.Icon;
import com.github.gwtbootstrap.client.ui.ListBox; //import com.github.gwtbootstrap.client.ui.ListBox;
import com.github.gwtbootstrap.client.ui.Popover; //import com.github.gwtbootstrap.client.ui.Popover;
import com.github.gwtbootstrap.client.ui.TextBox; //import com.github.gwtbootstrap.client.ui.TextBox;
import com.github.gwtbootstrap.client.ui.base.ListItem; //import com.github.gwtbootstrap.client.ui.base.ListItem;
import com.github.gwtbootstrap.client.ui.constants.ControlGroupType; //import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
import com.google.gwt.core.client.GWT; //import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent; //import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; //import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes; //import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyDownEvent; //import com.google.gwt.event.dom.client.KeyDownEvent;
import com.google.gwt.uibinder.client.UiBinder; //import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField; //import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler; //import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.ui.Composite; //import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel; //import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.FocusPanel; //import com.google.gwt.user.client.ui.FocusPanel;
import com.google.gwt.user.client.ui.Widget; //import com.google.gwt.user.client.ui.Widget;
//
/** ///**
* Panel for tags. // * Panel for tags.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/ // */
public class TagsPanel extends Composite{ //public class TagsPanel extends Composite{
//
private static TagsPanelUiBinder uiBinder = GWT // private static TagsPanelUiBinder uiBinder = GWT
.create(TagsPanelUiBinder.class); // .create(TagsPanelUiBinder.class);
//
interface TagsPanelUiBinder extends UiBinder<Widget, TagsPanel> { // interface TagsPanelUiBinder extends UiBinder<Widget, TagsPanel> {
} // }
//
@UiField TextBox tagsEnterTextBox; // @UiField TextBox tagsEnterTextBox;
@UiField FlowPanel tagsPanel; // @UiField FlowPanel tagsPanel;
@UiField Icon infoIconTags; // @UiField Icon infoIconTags;
@UiField FocusPanel focusPanelTags; // @UiField FocusPanel focusPanelTags;
@UiField Popover popoverTags; // @UiField Popover popoverTags;
@UiField ControlGroup tagsInsertGroup; // @UiField ControlGroup tagsInsertGroup;
@UiField ListBox tagsEnterListBox; // @UiField ListBox tagsEnterListBox;
//
// regular expression for tags // // regular expression for tags
private static final String REGEX_TAG = "^[a-zA-Z0-9._-]*$"; // private static final String REGEX_TAG = "^[a-zA-Z0-9._-]*$";
//
// tags list // // tags list
private List<String> tagsList = new ArrayList<String>(); // private List<String> tagsList = new ArrayList<String>();
//
// vocabulary // // vocabulary
private List<String> vocabulary; // private List<String> vocabulary;
//
public TagsPanel() { // public TagsPanel() {
initWidget(uiBinder.createAndBindUi(this)); // initWidget(uiBinder.createAndBindUi(this));
tagsEnterListBox.setVisible(false); // tagsEnterListBox.setVisible(false);
tagsList.clear(); // tagsList.clear();
tagsPanel.clear(); // tagsPanel.clear();
} // }
//
//
/** // /**
* Since we have a controlled vocabulary, we swap to a listbox with multiple selection // * Since we have a controlled vocabulary, we swap to a listbox with multiple selection
* @param vocabularyTags // * @param vocabularyTags
*/ // */
public void setVocabulary(List<String> vocabularyTags) { // public void setVocabulary(List<String> vocabularyTags) {
//
GWT.log("Vocabulary of tags is " + vocabularyTags); // GWT.log("Vocabulary of tags is " + vocabularyTags);
//
if(vocabularyTags == null || vocabularyTags.isEmpty()){ // if(vocabularyTags == null || vocabularyTags.isEmpty()){
vocabulary = null; // vocabulary = null;
tagsEnterListBox.setVisible(false); // tagsEnterListBox.setVisible(false);
tagsPanel.setVisible(true); // tagsPanel.setVisible(true);
tagsEnterTextBox.setVisible(true); // tagsEnterTextBox.setVisible(true);
}else{ // }else{
vocabulary = vocabularyTags; // vocabulary = vocabularyTags;
tagsEnterListBox.clear(); // tagsEnterListBox.clear();
tagsPanel.clear(); // tagsPanel.clear();
tagsList.clear(); // tagsList.clear();
for (String vocabularyTag : vocabularyTags) { // for (String vocabularyTag : vocabularyTags) {
tagsEnterListBox.addItem(vocabularyTag, vocabularyTag); // tagsEnterListBox.addItem(vocabularyTag, vocabularyTag);
} // }
tagsPanel.setVisible(false); // tagsPanel.setVisible(false);
tagsEnterTextBox.setVisible(false); // tagsEnterTextBox.setVisible(false);
tagsEnterListBox.setVisible(true); // tagsEnterListBox.setVisible(true);
} // }
} // }
//
/** // /**
* Prepare icons // * Prepare icons
* @param popupOpenedIds // * @param popupOpenedIds
*/ // */
public void prepareIcon(List<String> popupOpenedIds) { // public void prepareIcon(List<String> popupOpenedIds) {
InfoIconsLabels.preparePopupPanelAndPopover( // InfoIconsLabels.preparePopupPanelAndPopover(
InfoIconsLabels.TAGS_INFO_ID_POPUP, // InfoIconsLabels.TAGS_INFO_ID_POPUP,
InfoIconsLabels.TAGS_INFO_TEXT, // InfoIconsLabels.TAGS_INFO_TEXT,
InfoIconsLabels.TAGS_INFO_CAPTION, // InfoIconsLabels.TAGS_INFO_CAPTION,
infoIconTags, // infoIconTags,
popoverTags, // popoverTags,
focusPanelTags, // focusPanelTags,
popupOpenedIds // popupOpenedIds
); // );
} // }
//
@UiHandler("tagsEnterTextBox") // @UiHandler("tagsEnterTextBox")
void onAddTag(KeyDownEvent event){ // void onAddTag(KeyDownEvent event){
//
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { // if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
if (!tagsEnterTextBox.getValue().trim().isEmpty()) { // if (!tagsEnterTextBox.getValue().trim().isEmpty()) {
//
addTagElement(tagsEnterTextBox); // addTagElement(tagsEnterTextBox);
//
} // }
} // }
} // }
//
/** // /**
* Add the tag as an element (inserted by the user) // * Add the tag as an element (inserted by the user)
*/ // */
private void addTagElement(TextBox itemBox){ // private void addTagElement(TextBox itemBox){
//
if (itemBox.getValue() != null && !itemBox.getValue().trim().isEmpty()) { // if (itemBox.getValue() != null && !itemBox.getValue().trim().isEmpty()) {
//
if(tagsList.contains(itemBox.getValue().trim())){ // if(tagsList.contains(itemBox.getValue().trim())){
itemBox.setValue(""); // itemBox.setValue("");
return; // return;
} // }
//
// ckan accepts only alphanumeric values // // ckan accepts only alphanumeric values
String[] subTags = itemBox.getValue().trim().split(" "); // String[] subTags = itemBox.getValue().trim().split(" ");
if(subTags.length == 1){ // if(subTags.length == 1){
if(!subTags[0].matches(REGEX_TAG)) // if(!subTags[0].matches(REGEX_TAG))
return; // return;
if(subTags[0].length() <= 1) // if(subTags[0].length() <= 1)
return; // return;
}else{ // }else{
for (int i = 0; i < subTags.length; i++) { // for (int i = 0; i < subTags.length; i++) {
String subTag = subTags[i]; // String subTag = subTags[i];
if(!subTag.matches(REGEX_TAG)) // if(!subTag.matches(REGEX_TAG))
return; // return;
} // }
} // }
//
final String value = itemBox.getValue().trim(); // final String value = itemBox.getValue().trim();
final ListItem displayItem = new ListItem(); // final ListItem displayItem = new ListItem();
displayItem.setStyleName("tag-style"); // displayItem.setStyleName("tag-style");
Span tagText = new Span(itemBox.getValue()); // Span tagText = new Span(itemBox.getValue());
//
Span tagRemove = new Span("x"); // Span tagRemove = new Span("x");
tagRemove.setTitle("Remove this tag"); // tagRemove.setTitle("Remove this tag");
tagRemove.addClickHandler(new ClickHandler() { // tagRemove.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) { // public void onClick(ClickEvent clickEvent) {
removeTag(displayItem, value); // removeTag(displayItem, value);
} // }
}); // });
//
tagRemove.setStyleName("tag-style-x"); // tagRemove.setStyleName("tag-style-x");
displayItem.add(tagText); // displayItem.add(tagText);
displayItem.add(tagRemove); // displayItem.add(tagRemove);
itemBox.setValue(""); // itemBox.setValue("");
itemBox.setFocus(true); // itemBox.setFocus(true);
tagsPanel.add(displayItem); // tagsPanel.add(displayItem);
tagsList.add(value); // tagsList.add(value);
} // }
} // }
//
/** // /**
* Add the tag as an element (when publishing from workspace) // * Add the tag as an element (when publishing from workspace)
*/ // */
public void addTagElement(final String tag){ // public void addTagElement(final String tag){
//
if(tagsList.contains(tag)) // if(tagsList.contains(tag))
return; // return;
//
// ckan accepts only alphanumeric values // // ckan accepts only alphanumeric values
String[] subTags = tag.trim().split(" "); // String[] subTags = tag.trim().split(" ");
if(subTags.length == 1){ // if(subTags.length == 1){
if(!subTags[0].matches(REGEX_TAG)) // if(!subTags[0].matches(REGEX_TAG))
return; // return;
if(subTags[0].length() <= 1) // if(subTags[0].length() <= 1)
return; // return;
}else{ // }else{
for (int i = 0; i < subTags.length; i++) { // for (int i = 0; i < subTags.length; i++) {
String subTag = subTags[i]; // String subTag = subTags[i];
if(!subTag.matches(REGEX_TAG)) // if(!subTag.matches(REGEX_TAG))
return; // return;
} // }
} // }
//
final ListItem displayItem = new ListItem(); // final ListItem displayItem = new ListItem();
displayItem.setStyleName("tag-style"); // displayItem.setStyleName("tag-style");
Span p = new Span(tag); // Span p = new Span(tag);
//
Span span = new Span("x"); // Span span = new Span("x");
span.setTitle("Remove this tag"); // span.setTitle("Remove this tag");
span.addClickHandler(new ClickHandler() { // span.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) { // public void onClick(ClickEvent clickEvent) {
removeTag(displayItem, tag); // removeTag(displayItem, tag);
} // }
}); // });
//
span.setStyleName("tag-style-x"); // span.setStyleName("tag-style-x");
displayItem.add(p); // displayItem.add(p);
displayItem.add(span); // displayItem.add(span);
tagsPanel.add(displayItem); // tagsPanel.add(displayItem);
tagsList.add(tag); // tagsList.add(tag);
} // }
//
/** // /**
* Remove a tag from the list // * Remove a tag from the list
* @param displayItem // * @param displayItem
*/ // */
private void removeTag(ListItem displayItem, String value) { // private void removeTag(ListItem displayItem, String value) {
//
tagsList.remove(value.trim()); // tagsList.remove(value.trim());
tagsPanel.remove(displayItem); // tagsPanel.remove(displayItem);
//
} // }
//
/** // /**
* Remove all inserted tags // * Remove all inserted tags
*/ // */
public void removeTags(){ // public void removeTags(){
//
tagsList.clear(); // tagsList.clear();
tagsPanel.clear(); // tagsPanel.clear();
//
} // }
//
/** // /**
* Return the tag list // * Return the tag list
* @return // * @return
*/ // */
public List<String> getTags() { // public List<String> getTags() {
//
if(vocabulary == null){ // if(vocabulary == null){
return tagsList; // return tagsList;
}else{ // }else{
//
List<String> selected = new ArrayList<String>(); // List<String> selected = new ArrayList<String>();
for(int i = 0; i < tagsEnterListBox.getItemCount(); i++){ // for(int i = 0; i < tagsEnterListBox.getItemCount(); i++){
if(tagsEnterListBox.isItemSelected(i)) // if(tagsEnterListBox.isItemSelected(i))
selected.add(tagsEnterListBox.getItemText(i)); // selected.add(tagsEnterListBox.getItemText(i));
} // }
return selected; // return selected;
} // }
//
} // }
//
/** // /**
* Freeze tags // * Freeze tags
*/ // */
public void freeze() { // public void freeze() {
tagsEnterTextBox.setEnabled(false); // tagsEnterTextBox.setEnabled(false);
tagsEnterListBox.setEnabled(false); // tagsEnterListBox.setEnabled(false);
for(int i = 0; i < tagsList.size(); i++){ // for(int i = 0; i < tagsList.size(); i++){
//
// get tag widget // // get tag widget
ListItem tagWidget = (ListItem)tagsPanel.getWidget(i); // ListItem tagWidget = (ListItem)tagsPanel.getWidget(i);
//
// get the "x" span // // get the "x" span
tagWidget.getWidget(1).removeFromParent(); // tagWidget.getWidget(1).removeFromParent();
//
} // }
} // }
//
/** // /**
* Set the tag group panel type // * Set the tag group panel type
* @param none // * @param none
*/ // */
public void setGroupPanelType(ControlGroupType type) { // public void setGroupPanelType(ControlGroupType type) {
tagsInsertGroup.setType(type); // tagsInsertGroup.setType(type);
} // }
} //}

View File

@ -1,4 +1,4 @@
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent"> <!-- <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder" <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"> xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
<ui:style> <ui:style>
@ -33,4 +33,4 @@
</b:Controls> </b:Controls>
</b:ControlGroup> </b:ControlGroup>
</g:HTMLPanel> </g:HTMLPanel>
</ui:UiBinder> </ui:UiBinder> -->

View File

@ -1,155 +1,155 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils; //package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils;
//
import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog; //import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace.ResourceInfoForm; //import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace.ResourceInfoForm;
//
import com.github.gwtbootstrap.client.ui.Paragraph; //import com.github.gwtbootstrap.client.ui.Paragraph;
import com.google.gwt.core.shared.GWT; //import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.Element; //import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.EventTarget; //import com.google.gwt.dom.client.EventTarget;
import com.google.gwt.dom.client.Style.Cursor; //import com.google.gwt.dom.client.Style.Cursor;
import com.google.gwt.event.dom.client.ClickEvent; //import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler; //import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.DoubleClickEvent; //import com.google.gwt.event.dom.client.DoubleClickEvent;
import com.google.gwt.event.dom.client.DoubleClickHandler; //import com.google.gwt.event.dom.client.DoubleClickHandler;
import com.google.gwt.user.client.ui.Anchor; //import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.FlexTable; //import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML; //import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HasHorizontalAlignment; //import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.Widget; //import com.google.gwt.user.client.ui.Widget;
//
/** ///**
* Extended version of the GcubeDialog with close symbol on the caption // * Extended version of the GcubeDialog with close symbol on the caption
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/ // */
public class GcubeDialogExtended extends GCubeDialog { //public class GcubeDialogExtended extends GCubeDialog {
//
/** // /**
* For simple information // * For simple information
* @param captionText // * @param captionText
* @param text // * @param text
*/ // */
public GcubeDialogExtended(String captionText, String text){ // public GcubeDialogExtended(String captionText, String text){
//
// add custom style // // add custom style
addStyleName("metadata-popup-panel"); // addStyleName("metadata-popup-panel");
//
// create an anchor to close the dialogbox // // create an anchor to close the dialogbox
final Anchor closeAnchor = new Anchor("x"); // final Anchor closeAnchor = new Anchor("x");
closeAnchor.setTitle("Close"); // closeAnchor.setTitle("Close");
//
// create a panel that will be put into the caption // // create a panel that will be put into the caption
FlexTable captionLayoutTable = new FlexTable(); // FlexTable captionLayoutTable = new FlexTable();
captionLayoutTable.setText(0, 0, captionText); // captionLayoutTable.setText(0, 0, captionText);
captionLayoutTable.setWidget(0, 3, closeAnchor); // captionLayoutTable.setWidget(0, 3, closeAnchor);
captionLayoutTable.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT); // captionLayoutTable.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);
captionLayoutTable.setWidth("100%"); // captionLayoutTable.setWidth("100%");
HTML caption = (HTML) getCaption(); // HTML caption = (HTML) getCaption();
caption.getElement().getStyle().setCursor(Cursor.MOVE); // caption.getElement().getStyle().setCursor(Cursor.MOVE);
caption.getElement().appendChild(captionLayoutTable.getElement()); // caption.getElement().appendChild(captionLayoutTable.getElement());
caption.addClickHandler(new ClickHandler() { // caption.addClickHandler(new ClickHandler() {
@Override // @Override
public void onClick(ClickEvent event) { // public void onClick(ClickEvent event) {
// get the event // // get the event
EventTarget target = event.getNativeEvent().getEventTarget(); // EventTarget target = event.getNativeEvent().getEventTarget();
Element targetElement = (Element) target.cast(); // Element targetElement = (Element) target.cast();
//
// fire the event to the anchor // // fire the event to the anchor
if (targetElement == closeAnchor.getElement()) { // if (targetElement == closeAnchor.getElement()) {
closeAnchor.fireEvent(event); // closeAnchor.fireEvent(event);
} // }
} // }
}); // });
closeAnchor.addClickHandler(new ClickHandler() { // closeAnchor.addClickHandler(new ClickHandler() {
//
@Override // @Override
public void onClick(ClickEvent event) { // public void onClick(ClickEvent event) {
hide(); // hide();
} // }
}); // });
add(new Paragraph(text)); // add(new Paragraph(text));
} // }
//
/** // /**
* For simple information // * For simple information
* @param captionText // * @param captionText
* @param text // * @param text
*/ // */
public GcubeDialogExtended(final ResourceInfoForm form){ // public GcubeDialogExtended(final ResourceInfoForm form){
//
// add custom style // // add custom style
addStyleName("metadata-popup-panel"); // addStyleName("metadata-popup-panel");
//
// create an anchor to close the dialogbox // // create an anchor to close the dialogbox
final Anchor closeAnchor = new Anchor("x"); // final Anchor closeAnchor = new Anchor("x");
closeAnchor.setTitle("Close"); // closeAnchor.setTitle("Close");
closeAnchor.addClickHandler(new ClickHandler() { // closeAnchor.addClickHandler(new ClickHandler() {
@Override // @Override
public void onClick(ClickEvent event) { // public void onClick(ClickEvent event) {
hide(); // hide();
} // }
}); // });
//
// create a panel that will be put into the caption // // create a panel that will be put into the caption
FlexTable captionLayoutTable = new FlexTable(); // FlexTable captionLayoutTable = new FlexTable();
captionLayoutTable.setText(0, 0, "About Resource"); // captionLayoutTable.setText(0, 0, "About Resource");
captionLayoutTable.setWidget(0, 3, closeAnchor); // captionLayoutTable.setWidget(0, 3, closeAnchor);
captionLayoutTable.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT); // captionLayoutTable.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);
captionLayoutTable.setWidth("100%"); // captionLayoutTable.setWidth("100%");
HTML caption = (HTML) getCaption(); // HTML caption = (HTML) getCaption();
caption.getElement().getStyle().setCursor(Cursor.MOVE); // caption.getElement().getStyle().setCursor(Cursor.MOVE);
caption.getElement().appendChild(captionLayoutTable.getElement()); // caption.getElement().appendChild(captionLayoutTable.getElement());
caption.addClickHandler(new ClickHandler() { // caption.addClickHandler(new ClickHandler() {
@Override // @Override
public void onClick(ClickEvent event) { // public void onClick(ClickEvent event) {
EventTarget target = event.getNativeEvent().getEventTarget(); // EventTarget target = event.getNativeEvent().getEventTarget();
Element targetElement = (Element) target.cast(); // Element targetElement = (Element) target.cast();
if (targetElement == closeAnchor.getElement()) { // if (targetElement == closeAnchor.getElement()) {
closeAnchor.fireEvent(event); // closeAnchor.fireEvent(event);
} // }
} // }
}); // });
//
setWidget(form); // setWidget(form);
Widget widget = getWidget(); // Widget widget = getWidget();
//
ClickHandler click = new ClickHandler() { // ClickHandler click = new ClickHandler() {
@Override // @Override
public void onClick(ClickEvent event) { // public void onClick(ClickEvent event) {
EventTarget target = event.getNativeEvent().getEventTarget(); // EventTarget target = event.getNativeEvent().getEventTarget();
Element targetElement = (Element) target.cast(); // Element targetElement = (Element) target.cast();
GWT.log("Target elem is " + targetElement); // GWT.log("Target elem is " + targetElement);
if (targetElement == form.resourceDescription.getElement()) { // if (targetElement == form.resourceDescription.getElement()) {
GWT.log("Fired click"); // GWT.log("Fired click");
form.resourceDescription.fireEvent(event); // form.resourceDescription.fireEvent(event);
}else if (targetElement == form.resourceName.getElement()) { // }else if (targetElement == form.resourceName.getElement()) {
GWT.log("Fired click"); // GWT.log("Fired click");
form.resourceName.fireEvent(event); // form.resourceName.fireEvent(event);
}else if(targetElement == form.getElement()){ // }else if(targetElement == form.getElement()){
form.fireEvent(event); // form.fireEvent(event);
} // }
} // }
}; // };
widget.addDomHandler(click, ClickEvent.getType()); // widget.addDomHandler(click, ClickEvent.getType());
//
widget.addDomHandler(new DoubleClickHandler() { // widget.addDomHandler(new DoubleClickHandler() {
//
@Override // @Override
public void onDoubleClick(DoubleClickEvent event) { // public void onDoubleClick(DoubleClickEvent event) {
EventTarget target = event.getNativeEvent().getEventTarget(); // EventTarget target = event.getNativeEvent().getEventTarget();
Element targetElement = (Element) target.cast(); // Element targetElement = (Element) target.cast();
GWT.log("Target elem is " + targetElement); // GWT.log("Target elem is " + targetElement);
if (targetElement == form.resourceDescription.getElement()) { // if (targetElement == form.resourceDescription.getElement()) {
GWT.log("Fired click"); // GWT.log("Fired click");
form.resourceDescription.fireEvent(event); // form.resourceDescription.fireEvent(event);
}else if (targetElement == form.resourceName.getElement()) { // }else if (targetElement == form.resourceName.getElement()) {
GWT.log("Fired click"); // GWT.log("Fired click");
form.resourceName.fireEvent(event); // form.resourceName.fireEvent(event);
}else if(targetElement == form.getElement()){ // }else if(targetElement == form.getElement()){
form.fireEvent(event); // form.fireEvent(event);
} // }
} // }
}, DoubleClickEvent.getType()); // }, DoubleClickEvent.getType());
} // }
//
} //}

View File

@ -2,6 +2,8 @@ package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils;
import java.util.List; import java.util.List;
import org.gcube.portlets.widgets.mpformbuilder.client.ui.utils.GcubeDialogExtended;
import com.github.gwtbootstrap.client.ui.Icon; import com.github.gwtbootstrap.client.ui.Icon;
import com.github.gwtbootstrap.client.ui.Popover; import com.github.gwtbootstrap.client.ui.Popover;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;

View File

@ -1,62 +1,62 @@
/** ///**
* // *
*/ // */
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils; //package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils;
//
//
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.icons.Images; //import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.icons.Images;
//
import com.google.gwt.user.client.ui.HTML; //import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel; //import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Image; //import com.google.gwt.user.client.ui.Image;
//
/** ///**
* The Class LoaderIcon. // * The Class LoaderIcon.
* // *
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it // * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
* Feb 19, 2015 // * Feb 19, 2015
*/ // */
public class LoaderIcon extends HorizontalPanel{ //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 HTML txtLoading = new HTML("");
//
/** // /**
* Instantiates a new loader icon. // * Instantiates a new loader icon.
* // *
* @param txtHTML the txt html // * @param txtHTML the txt html
*/ // */
public LoaderIcon(String txtHTML) { // public LoaderIcon(String txtHTML) {
this(); // this();
setText(txtHTML); // setText(txtHTML);
} // }
//
/** // /**
* Instantiates a new loader icon. // * Instantiates a new loader icon.
*/ // */
public LoaderIcon() { // public LoaderIcon() {
setStyleName("marginTop20"); // setStyleName("marginTop20");
add(imgLoading); // add(imgLoading);
add(txtLoading); // add(txtLoading);
} // }
//
/** // /**
* Sets the text. // * Sets the text.
* // *
* @param txtHTML the new text // * @param txtHTML the new text
*/ // */
public void setText(String txtHTML){ // public void setText(String txtHTML){
txtLoading.setHTML("<span style=\"margin-left:5px; vertical-align:middle;\">"+txtHTML+"</span>"); // txtLoading.setHTML("<span style=\"margin-left:5px; vertical-align:middle;\">"+txtHTML+"</span>");
} // }
//
/** // /**
* Show. // * Show.
* // *
* @param bool the bool // * @param bool the bool
*/ // */
public void show(boolean bool){ // public void show(boolean bool){
this.setVisible(bool); // this.setVisible(bool);
} // }
//
} //}

View File

@ -33,8 +33,8 @@ import org.gcube.portlets.widgets.ckandatapublisherwidget.server.utils.Workspace
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses.LicenseBean; import org.gcube.portlets.widgets.mpformbuilder.shared.license.LicenseBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetaDataProfileBean; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
import org.gcube.vomanagement.usermanagement.GroupManager; import org.gcube.vomanagement.usermanagement.GroupManager;
import org.gcube.vomanagement.usermanagement.UserManager; import org.gcube.vomanagement.usermanagement.UserManager;
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault; import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;

View File

@ -21,13 +21,13 @@ import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataVocabulary;
import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.NamespaceCategory; import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.NamespaceCategory;
import org.gcube.datacatalogue.utillibrary.server.utils.CatalogueUtilMethods; import org.gcube.datacatalogue.utillibrary.server.utils.CatalogueUtilMethods;
import org.gcube.datacatalogue.utillibrary.server.utils.SessionCatalogueAttributes; import org.gcube.datacatalogue.utillibrary.server.utils.SessionCatalogueAttributes;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.CategoryWrapper; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.CategoryWrapper;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.DataTypeWrapper; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.DataTypeWrapper;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.FieldAsGroup; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.FieldAsGroup;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.FieldAsTag; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.FieldAsTag;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetaDataProfileBean; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetadataFieldWrapper;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.TaggingGroupingValue; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.TaggingGroupingValue;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@ -4,7 +4,7 @@ import java.io.Serializable;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetaDataProfileBean; import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
import com.google.gwt.user.client.rpc.IsSerializable; import com.google.gwt.user.client.rpc.IsSerializable;

View File

@ -1,52 +1,52 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses; //package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses;
//
import java.io.Serializable; //import java.io.Serializable;
//
import com.google.gwt.user.client.rpc.IsSerializable; //import com.google.gwt.user.client.rpc.IsSerializable;
//
/** ///**
* A license bean like the ckan's one. // * A license bean like the ckan's one.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/ // */
public class LicenseBean implements Serializable, IsSerializable{ //public class LicenseBean implements Serializable, IsSerializable{
//
private static final long serialVersionUID = -2079275598877326206L; // private static final long serialVersionUID = -2079275598877326206L;
private String title; // private String title;
private String url; // private String url;
//
public LicenseBean() { // public LicenseBean() {
super(); // super();
} // }
//
public LicenseBean(String title, String url) { // public LicenseBean(String title, String url) {
super(); // super();
this.title = title; // this.title = title;
this.url = url; // this.url = url;
} // }
//
public String getTitle() { // public String getTitle() {
return title; // return title;
} // }
//
public void setTitle(String title) { // public void setTitle(String title) {
this.title = title; // this.title = title;
} // }
//
public String getUrl() { // public String getUrl() {
return url; // return url;
} // }
//
public void setUrl(String url) { // public void setUrl(String url) {
this.url = url; // this.url = url;
} // }
//
@Override // @Override
public boolean equals(Object obj) { // public boolean equals(Object obj) {
return obj.getClass().equals(this.getClass()) && ((LicenseBean)obj).getTitle().equals(this.title); // return obj.getClass().equals(this.getClass()) && ((LicenseBean)obj).getTitle().equals(this.title);
} // }
//
@Override // @Override
public String toString() { // public String toString() {
return "LicenseBean [title=" + title + ", url=" + url + "]"; // return "LicenseBean [title=" + title + ", url=" + url + "]";
} // }
} //}

View File

@ -1,77 +1,77 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata; //package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
//
import java.io.Serializable; //import java.io.Serializable;
import java.util.List; //import java.util.List;
//
import com.google.gwt.user.client.rpc.IsSerializable; //import com.google.gwt.user.client.rpc.IsSerializable;
//
/** ///**
* A wrapper for the MetadataCategory class. // * A wrapper for the MetadataCategory class.
* @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataCategory // * @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataCategory
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/ // */
public class CategoryWrapper implements Serializable, IsSerializable{ //public class CategoryWrapper implements Serializable, IsSerializable{
//
private static final long serialVersionUID = -1949961285656672831L; // private static final long serialVersionUID = -1949961285656672831L;
private String id; // private String id;
private String title; // private String title;
private String description; // private String description;
private List<MetadataFieldWrapper> fieldsForThisCategory; // private List<MetadataFieldWrapper> fieldsForThisCategory;
//
public CategoryWrapper() { // public CategoryWrapper() {
super(); // super();
} // }
//
public CategoryWrapper(String id, String title, String description) { // public CategoryWrapper(String id, String title, String description) {
super(); // super();
this.id = id; // this.id = id;
this.title = title; // this.title = title;
this.description = description; // this.description = description;
} // }
//
public String getId() { // public String getId() {
return id; // return id;
} // }
//
public void setId(String id) { // public void setId(String id) {
this.id = id; // this.id = id;
} // }
//
public String getTitle() { // public String getTitle() {
return title; // return title;
} // }
//
public void setTitle(String title) { // public void setTitle(String title) {
this.title = title; // this.title = title;
} // }
//
public String getDescription() { // public String getDescription() {
return description; // return description;
} // }
//
public void setDescription(String description) { // public void setDescription(String description) {
this.description = description; // this.description = description;
} // }
//
public List<MetadataFieldWrapper> getFieldsForThisCategory() { // public List<MetadataFieldWrapper> getFieldsForThisCategory() {
return fieldsForThisCategory; // return fieldsForThisCategory;
} // }
//
public void setFieldsForThisCategory( // public void setFieldsForThisCategory(
List<MetadataFieldWrapper> fieldsForThisCategory) { // List<MetadataFieldWrapper> fieldsForThisCategory) {
this.fieldsForThisCategory = fieldsForThisCategory; // this.fieldsForThisCategory = fieldsForThisCategory;
} // }
//
@Override // @Override
public String toString() { // public String toString() {
return "CategoryWrapper [" // return "CategoryWrapper ["
+ (id != null ? "id=" + id + ", " : "") // + (id != null ? "id=" + id + ", " : "")
+ (title != null ? "title=" + title + ", " : "") // + (title != null ? "title=" + title + ", " : "")
+ (description != null ? "description=" + description + ", " // + (description != null ? "description=" + description + ", "
: "") // : "")
+ (fieldsForThisCategory != null ? "fieldsForThisCategory=" // + (fieldsForThisCategory != null ? "fieldsForThisCategory="
+ fieldsForThisCategory.size() : "") + "]"; // + fieldsForThisCategory.size() : "") + "]";
} // }
//
//
} //}

View File

@ -1,26 +1,26 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata; //package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
//
/** ///**
* Data type. // * Data type.
* @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.DataType // * @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.DataType
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/ // */
public enum DataTypeWrapper { //public enum DataTypeWrapper {
//
String, // String,
Time, // Time,
Time_Interval, // Time_Interval,
Times_ListOf, // Times_ListOf,
Text, // Text,
Boolean, // Boolean,
Number, // Number,
GeoJSON; // GeoJSON;
//
/** // /**
* Value as String. // * Value as String.
* @return the string // * @return the string
*/ // */
public String value() { // public String value() {
return name(); // return name();
} // }
} //}

View File

@ -1,62 +1,62 @@
/** ///**
* // *
*/ // */
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata; //package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
//
import java.io.Serializable; //import java.io.Serializable;
//
import com.google.gwt.user.client.rpc.IsSerializable; //import com.google.gwt.user.client.rpc.IsSerializable;
//
/** ///**
* To be used when a field must be used to create a group. // * To be used when a field must be used to create a group.
* @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataGrouping // * @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataGrouping
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/ // */
public class FieldAsGroup implements Serializable, IsSerializable{ //public class FieldAsGroup implements Serializable, IsSerializable{
//
private static final long serialVersionUID = 8096886403417944385L; // private static final long serialVersionUID = 8096886403417944385L;
private boolean create; // private boolean create;
private boolean isPropagateUp; // private boolean isPropagateUp;
private TaggingGroupingValue groupingValue; // private TaggingGroupingValue groupingValue;
//
public FieldAsGroup() { // public FieldAsGroup() {
super(); // super();
} // }
//
public FieldAsGroup(boolean create, TaggingGroupingValue groupingValue, boolean isPropagateUp) { // public FieldAsGroup(boolean create, TaggingGroupingValue groupingValue, boolean isPropagateUp) {
this.isPropagateUp = isPropagateUp; // this.isPropagateUp = isPropagateUp;
this.create = create; // this.create = create;
this.groupingValue = groupingValue; // this.groupingValue = groupingValue;
} // }
//
public boolean getCreate() { // public boolean getCreate() {
return create; // return create;
} // }
//
public void setCreate(Boolean create) { // public void setCreate(Boolean create) {
this.create = create; // this.create = create;
} // }
//
public TaggingGroupingValue getGroupingValue() { // public TaggingGroupingValue getGroupingValue() {
return groupingValue; // return groupingValue;
} // }
//
public void setGroupingValue(TaggingGroupingValue groupingValue) { // public void setGroupingValue(TaggingGroupingValue groupingValue) {
this.groupingValue = groupingValue; // this.groupingValue = groupingValue;
} // }
//
public boolean isPropagateUp() { // public boolean isPropagateUp() {
return isPropagateUp; // return isPropagateUp;
} // }
//
public void setPropagateUp(boolean isPropagateUp) { // public void setPropagateUp(boolean isPropagateUp) {
this.isPropagateUp = isPropagateUp; // this.isPropagateUp = isPropagateUp;
} // }
//
@Override // @Override
public String toString() { // public String toString() {
return "FieldAsGroup [create=" + create + ", isPropagateUp=" // return "FieldAsGroup [create=" + create + ", isPropagateUp="
+ isPropagateUp + ", groupingValue=" + groupingValue + "]"; // + isPropagateUp + ", groupingValue=" + groupingValue + "]";
} // }
//
} //}

View File

@ -1,62 +1,62 @@
//
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata; //package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
//
import java.io.Serializable; //import java.io.Serializable;
//
import com.google.gwt.user.client.rpc.IsSerializable; //import com.google.gwt.user.client.rpc.IsSerializable;
//
/** ///**
* To be used when a field must be used to create a tag. // * To be used when a field must be used to create a tag.
* @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataTagging // * @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataTagging
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/ // */
public class FieldAsTag implements Serializable, IsSerializable{ //public class FieldAsTag implements Serializable, IsSerializable{
//
private static final long serialVersionUID = 5414077853964288094L; // private static final long serialVersionUID = 5414077853964288094L;
public static final String DEFAULT_SEPARATOR = "-"; // public static final String DEFAULT_SEPARATOR = "-";
private boolean create; // private boolean create;
private String separator = DEFAULT_SEPARATOR; // private String separator = DEFAULT_SEPARATOR;
private TaggingGroupingValue taggingValue; // private TaggingGroupingValue taggingValue;
//
public FieldAsTag() { // public FieldAsTag() {
super(); // super();
} // }
//
public FieldAsTag(Boolean create, String separator, TaggingGroupingValue taggingValue) { // public FieldAsTag(Boolean create, String separator, TaggingGroupingValue taggingValue) {
super(); // super();
this.create = create; // this.create = create;
this.separator = separator; // this.separator = separator;
this.taggingValue = taggingValue; // this.taggingValue = taggingValue;
} // }
//
public boolean isCreate() { // public boolean isCreate() {
return create; // return create;
} // }
//
public void setCreate(boolean create) { // public void setCreate(boolean create) {
this.create = create; // this.create = create;
} // }
//
public String getSeparator() { // public String getSeparator() {
return separator; // return separator;
} // }
//
public void setSeparator(String separator) { // public void setSeparator(String separator) {
this.separator = separator; // this.separator = separator;
} // }
//
public TaggingGroupingValue getTaggingValue() { // public TaggingGroupingValue getTaggingValue() {
return taggingValue; // return taggingValue;
} // }
//
public void setTaggingValue(TaggingGroupingValue taggingValue) { // public void setTaggingValue(TaggingGroupingValue taggingValue) {
this.taggingValue = taggingValue; // this.taggingValue = taggingValue;
} // }
//
@Override // @Override
public String toString() { // public String toString() {
return "FieldAsTag [create=" + create + ", separator=" + separator // return "FieldAsTag [create=" + create + ", separator=" + separator
+ ", taggingValue=" + taggingValue + "]"; // + ", taggingValue=" + taggingValue + "]";
} // }
//
} //}

View File

@ -1,88 +1,88 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata; //package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
//
import java.io.Serializable; //import java.io.Serializable;
import java.util.List; //import java.util.List;
//
import com.google.gwt.user.client.rpc.IsSerializable; //import com.google.gwt.user.client.rpc.IsSerializable;
//
/** ///**
* A MetaDataProfileBean with its children (MetaDataType, MetaDataFields, Categories) // * A MetaDataProfileBean with its children (MetaDataType, MetaDataFields, Categories)
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/ // */
public class MetaDataProfileBean implements Serializable, IsSerializable{ //public class MetaDataProfileBean implements Serializable, IsSerializable{
//
private static final long serialVersionUID = -7377022025375553568L; // private static final long serialVersionUID = -7377022025375553568L;
//
private String type; // private String type;
private String title; // private String title;
private List<CategoryWrapper> categories; // private List<CategoryWrapper> categories;
private List<MetadataFieldWrapper> metadataFields; // private List<MetadataFieldWrapper> metadataFields;
//
public MetaDataProfileBean(){ // public MetaDataProfileBean(){
super(); // super();
} // }
public MetaDataProfileBean(String type, // public MetaDataProfileBean(String type,
String title, // String title,
List<MetadataFieldWrapper> metadataFields, // List<MetadataFieldWrapper> metadataFields,
List<CategoryWrapper> categories) { // List<CategoryWrapper> categories) {
super(); // super();
this.type = type; // this.type = type;
this.title = title; // this.title = title;
this.categories = categories; // this.categories = categories;
this.metadataFields = metadataFields; // this.metadataFields = metadataFields;
} // }
//
/** // /**
* @return the type // * @return the type
*/ // */
public String getType() { // public String getType() {
return type; // return type;
} // }
/** // /**
* @param type the type to set // * @param type the type to set
*/ // */
public void setType(String type) { // public void setType(String type) {
this.type = type; // this.type = type;
} // }
/** // /**
* @return the metadataFields // * @return the metadataFields
*/ // */
public List<MetadataFieldWrapper> getMetadataFields() { // public List<MetadataFieldWrapper> getMetadataFields() {
return metadataFields; // return metadataFields;
} // }
/** // /**
* @param metadataFields the metadataFields to set // * @param metadataFields the metadataFields to set
*/ // */
public void setMetadataFields(List<MetadataFieldWrapper> metadataFields) { // public void setMetadataFields(List<MetadataFieldWrapper> metadataFields) {
this.metadataFields = metadataFields; // this.metadataFields = metadataFields;
} // }
//
public List<CategoryWrapper> getCategories() { // public List<CategoryWrapper> getCategories() {
return categories; // return categories;
} // }
//
public void setCategories(List<CategoryWrapper> categories) { // public void setCategories(List<CategoryWrapper> categories) {
this.categories = categories; // this.categories = categories;
} // }
public String getTitle() { // public String getTitle() {
return title; // return title;
} // }
public void setTitle(String title) { // public void setTitle(String title) {
this.title = title; // this.title = title;
} // }
@Override // @Override
public String toString() { // public String toString() {
final int maxLen = 10; // final int maxLen = 10;
return "MetaDataProfileBean [type=" // return "MetaDataProfileBean [type="
+ type // + type
+ ", title=" // + ", title="
+ title // + title
+ ", categories=" // + ", categories="
+ (categories != null ? categories.subList(0, // + (categories != null ? categories.subList(0,
Math.min(categories.size(), maxLen)) : null) // Math.min(categories.size(), maxLen)) : null)
+ ", metadataFields=" // + ", metadataFields="
+ (metadataFields != null ? metadataFields.subList(0, // + (metadataFields != null ? metadataFields.subList(0,
Math.min(metadataFields.size(), maxLen)) : null) + "]"; // Math.min(metadataFields.size(), maxLen)) : null) + "]";
} // }
//
} //}

View File

@ -1,341 +1,341 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata; //package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
//
//
import java.io.Serializable; //import java.io.Serializable;
import java.util.List; //import java.util.List;
//
import com.google.gwt.user.client.rpc.IsSerializable; //import com.google.gwt.user.client.rpc.IsSerializable;
//
/** ///**
* The Class MetadataFieldWrapper. // * The Class MetadataFieldWrapper.
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
* // *
* @author francesco-mangiacrapa at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author francesco-mangiacrapa at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/ // */
public class MetadataFieldWrapper implements Serializable, IsSerializable{ //public class MetadataFieldWrapper implements Serializable, IsSerializable{
//
private static final long serialVersionUID = -8476731365884466698L; // private static final long serialVersionUID = -8476731365884466698L;
private String fieldName; // private String fieldName;
private String fieldNameFromCategory; // private String fieldNameFromCategory;
private Boolean mandatory = false; // private Boolean mandatory = false;
private DataTypeWrapper type; // private DataTypeWrapper type;
private String defaultValue; // private String defaultValue;
private String note; // private String note;
private List<String> vocabulary; // private List<String> vocabulary;
private boolean multiSelection; // private boolean multiSelection;
private String validator; // private String validator;
private CategoryWrapper ownerCategory; // private CategoryWrapper ownerCategory;
private FieldAsGroup asGroup; // private FieldAsGroup asGroup;
private FieldAsTag asTag; // private FieldAsTag asTag;
//
private Integer maxOccurs = 1; // private Integer maxOccurs = 1;
//
/** // /**
* Instantiates a new metadata field. // * Instantiates a new metadata field.
*/ // */
public MetadataFieldWrapper() { // public MetadataFieldWrapper() {
super(); // super();
} // }
//
/** // /**
* Instantiates a new metadata field. // * Instantiates a new metadata field.
* // *
* @param fieldName the field name // * @param fieldName the field name
* @param mandatory the mandatory // * @param mandatory the mandatory
* @param type the type // * @param type the type
* @param defaultValue the default value // * @param defaultValue the default value
* @param note the note // * @param note the note
* @param vocabulary the vocabulary // * @param vocabulary the vocabulary
* @param validator the validator // * @param validator the validator
* @param category the category // * @param category the category
*/ // */
public MetadataFieldWrapper( // public MetadataFieldWrapper(
String fieldName, Boolean mandatory, DataTypeWrapper type, // String fieldName, Boolean mandatory, DataTypeWrapper type,
String defaultValue, String note, List<String> vocabulary, // String defaultValue, String note, List<String> vocabulary,
String validator, CategoryWrapper category) { // String validator, CategoryWrapper category) {
super(); // super();
this.fieldName = fieldName; // this.fieldName = fieldName;
this.mandatory = mandatory; // this.mandatory = mandatory;
this.type = type; // this.type = type;
this.defaultValue = defaultValue; // this.defaultValue = defaultValue;
this.note = note; // this.note = note;
this.vocabulary = vocabulary; // this.vocabulary = vocabulary;
this.validator = validator; // this.validator = validator;
this.ownerCategory = category; // this.ownerCategory = category;
} // }
//
//
//
/** // /**
* Gets the max occurs. // * Gets the max occurs.
* // *
* @return the max occurs // * @return the max occurs
*/ // */
public Integer getMaxOccurs() { // public Integer getMaxOccurs() {
return maxOccurs; // return maxOccurs;
} // }
//
/** // /**
* Sets the max occurs. // * Sets the max occurs.
* // *
* @param maxOccurs the new max occurs // * @param maxOccurs the new max occurs
*/ // */
public void setMaxOccurs(Integer maxOccurs) { // public void setMaxOccurs(Integer maxOccurs) {
this.maxOccurs = maxOccurs; // this.maxOccurs = maxOccurs;
} // }
//
/** // /**
* Gets the field name. // * Gets the field name.
* // *
* @return the fieldName // * @return the fieldName
*/ // */
public String getFieldName() { // public String getFieldName() {
//
return fieldName; // return fieldName;
} // }
//
/** // /**
* Gets the mandatory. // * Gets the mandatory.
* // *
* @return the mandatory // * @return the mandatory
*/ // */
public Boolean getMandatory() { // public Boolean getMandatory() {
//
return mandatory; // return mandatory;
} // }
//
/** // /**
* Gets the defaul value. // * Gets the defaul value.
* // *
* @return the defaulValue // * @return the defaulValue
*/ // */
public String getDefaultValue() { // public String getDefaultValue() {
//
return defaultValue; // return defaultValue;
} // }
//
/** // /**
* Gets the note. // * Gets the note.
* // *
* @return the note // * @return the note
*/ // */
public String getNote() { // public String getNote() {
//
return note; // return note;
} // }
//
/** // /**
* Gets the vocabulary. // * Gets the vocabulary.
* // *
* @return the vocabulary // * @return the vocabulary
*/ // */
public List<String> getVocabulary() { // public List<String> getVocabulary() {
//
return vocabulary; // return vocabulary;
} // }
//
/** // /**
* Gets the validator. // * Gets the validator.
* // *
* @return the validator // * @return the validator
*/ // */
public String getValidator() { // public String getValidator() {
//
return validator; // return validator;
} // }
//
/** // /**
* Sets the field name. // * Sets the field name.
* // *
* @param fieldName the fieldName to set // * @param fieldName the fieldName to set
*/ // */
public void setFieldName(String fieldName) { // public void setFieldName(String fieldName) {
//
this.fieldName = fieldName; // this.fieldName = fieldName;
} // }
//
/** // /**
* Sets the mandatory. // * Sets the mandatory.
* // *
* @param mandatory the mandatory to set // * @param mandatory the mandatory to set
*/ // */
public void setMandatory(Boolean mandatory) { // public void setMandatory(Boolean mandatory) {
//
this.mandatory = mandatory; // this.mandatory = mandatory;
} // }
//
/** // /**
* Sets the defaul value. // * Sets the defaul value.
* // *
* @param defaultValue the new default value // * @param defaultValue the new default value
*/ // */
public void setDefaultValue(String defaultValue) { // public void setDefaultValue(String defaultValue) {
//
this.defaultValue = defaultValue; // this.defaultValue = defaultValue;
} // }
//
/** // /**
* Sets the note. // * Sets the note.
* // *
* @param note the note to set // * @param note the note to set
*/ // */
public void setNote(String note) { // public void setNote(String note) {
//
this.note = note; // this.note = note;
} // }
//
/** // /**
* Sets the vocabulary. // * Sets the vocabulary.
* // *
* @param vocabulary the vocabulary to set // * @param vocabulary the vocabulary to set
*/ // */
public void setVocabulary(List<String> vocabulary) { // public void setVocabulary(List<String> vocabulary) {
//
this.vocabulary = vocabulary; // this.vocabulary = vocabulary;
} // }
//
/** // /**
* Sets the validator. // * Sets the validator.
* // *
* @param validator the validator to set // * @param validator the validator to set
*/ // */
public void setValidator(String validator) { // public void setValidator(String validator) {
//
this.validator = validator; // this.validator = validator;
} // }
//
/** // /**
* Gets the type. // * Gets the type.
* // *
* @return the type // * @return the type
*/ // */
public DataTypeWrapper getType() { // public DataTypeWrapper getType() {
return type; // return type;
} // }
//
/** // /**
* Sets the type. // * Sets the type.
* // *
* @param type the new type // * @param type the new type
*/ // */
public void setType(DataTypeWrapper type) { // public void setType(DataTypeWrapper type) {
this.type = type; // this.type = type;
} // }
//
/** // /**
* Checks if is multi selection. // * Checks if is multi selection.
* // *
* @return true, if is multi selection // * @return true, if is multi selection
*/ // */
public boolean isMultiSelection() { // public boolean isMultiSelection() {
return multiSelection; // return multiSelection;
} // }
//
/** // /**
* Sets the multi selection. // * Sets the multi selection.
* // *
* @param multiSelection the new multi selection // * @param multiSelection the new multi selection
*/ // */
public void setMultiSelection(boolean multiSelection) { // public void setMultiSelection(boolean multiSelection) {
this.multiSelection = multiSelection; // this.multiSelection = multiSelection;
} // }
//
/** // /**
* Gets the owner category. // * Gets the owner category.
* // *
* @return the owner category // * @return the owner category
*/ // */
public CategoryWrapper getOwnerCategory() { // public CategoryWrapper getOwnerCategory() {
return ownerCategory; // return ownerCategory;
} // }
//
/** // /**
* Sets the owner category. // * Sets the owner category.
* // *
* @param ownerCategory the new owner category // * @param ownerCategory the new owner category
*/ // */
public void setOwnerCategory(CategoryWrapper ownerCategory) { // public void setOwnerCategory(CategoryWrapper ownerCategory) {
this.ownerCategory = ownerCategory; // this.ownerCategory = ownerCategory;
} // }
//
/** // /**
* Gets the field name from category. // * Gets the field name from category.
* // *
* @return the field name from category // * @return the field name from category
*/ // */
public String getFieldNameFromCategory() { // public String getFieldNameFromCategory() {
return fieldNameFromCategory; // return fieldNameFromCategory;
} // }
//
/** // /**
* Sets the field name from category. // * Sets the field name from category.
* // *
* @param fieldNameFromCategory the new field name from category // * @param fieldNameFromCategory the new field name from category
*/ // */
public void setFieldNameFromCategory(String fieldNameFromCategory) { // public void setFieldNameFromCategory(String fieldNameFromCategory) {
this.fieldNameFromCategory = fieldNameFromCategory; // this.fieldNameFromCategory = fieldNameFromCategory;
} // }
//
/** // /**
* Gets the as group. // * Gets the as group.
* // *
* @return the as group // * @return the as group
*/ // */
public FieldAsGroup getAsGroup() { // public FieldAsGroup getAsGroup() {
return asGroup; // return asGroup;
} // }
//
/** // /**
* Sets the as group. // * Sets the as group.
* // *
* @param asGroup the new as group // * @param asGroup the new as group
*/ // */
public void setAsGroup(FieldAsGroup asGroup) { // public void setAsGroup(FieldAsGroup asGroup) {
this.asGroup = asGroup; // this.asGroup = asGroup;
} // }
//
/** // /**
* Gets the as tag. // * Gets the as tag.
* // *
* @return the as tag // * @return the as tag
*/ // */
public FieldAsTag getAsTag() { // public FieldAsTag getAsTag() {
return asTag; // return asTag;
} // }
//
/** // /**
* Sets the as tag. // * Sets the as tag.
* // *
* @param asTag the new as tag // * @param asTag the new as tag
*/ // */
public void setAsTag(FieldAsTag asTag) { // public void setAsTag(FieldAsTag asTag) {
this.asTag = asTag; // this.asTag = asTag;
} // }
//
/* (non-Javadoc) // /* (non-Javadoc)
* @see java.lang.Object#toString() // * @see java.lang.Object#toString()
*/ // */
@Override // @Override
public String toString() { // public String toString() {
return "MetadataFieldWrapper [" // return "MetadataFieldWrapper ["
+ (fieldName != null ? "fieldName=" + fieldName + ", " : "") // + (fieldName != null ? "fieldName=" + fieldName + ", " : "")
+ (fieldNameFromCategory != null ? "fieldNameFromCategory=" // + (fieldNameFromCategory != null ? "fieldNameFromCategory="
+ fieldNameFromCategory + ", " : "") // + fieldNameFromCategory + ", " : "")
+ (mandatory != null ? "mandatory=" + mandatory + ", " : "") // + (mandatory != null ? "mandatory=" + mandatory + ", " : "")
+ (maxOccurs != null ? "maxOccurs=" + maxOccurs + ", " : "") // + (maxOccurs != null ? "maxOccurs=" + maxOccurs + ", " : "")
+ (type != null ? "type=" + type + ", " : "") // + (type != null ? "type=" + type + ", " : "")
+ (defaultValue != null ? "defaultValue=" + defaultValue + ", " // + (defaultValue != null ? "defaultValue=" + defaultValue + ", "
: "") // : "")
+ (note != null ? "note=" + note + ", " : "") // + (note != null ? "note=" + note + ", " : "")
+ (vocabulary != null ? "vocabulary=" + vocabulary + ", " : "") // + (vocabulary != null ? "vocabulary=" + vocabulary + ", " : "")
+ "multiSelection=" // + "multiSelection="
+ multiSelection // + multiSelection
+ ", " // + ", "
+ (validator != null ? "validator=" + validator + ", " : "") // + (validator != null ? "validator=" + validator + ", " : "")
+ (ownerCategory != null ? "ownerCategory=" + ownerCategory.getId() // + (ownerCategory != null ? "ownerCategory=" + ownerCategory.getId()
+ ", " : "") // + ", " : "")
+ (asGroup != null ? "asGroup=" + asGroup + ", " : "") // + (asGroup != null ? "asGroup=" + asGroup + ", " : "")
+ (asTag != null ? "asTag=" + asTag : "") + "]"; // + (asTag != null ? "asTag=" + asTag : "") + "]";
} // }
//
} //}

View File

@ -1,66 +1,66 @@
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata; //package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
//
import java.util.Arrays; //import java.util.Arrays;
import java.util.List; //import java.util.List;
//
//
/** ///**
* Specifies the action to take when a tag or a group must be created from a field. // * Specifies the action to take when a tag or a group must be created from a field.
* @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.TaggingGroupingValue // * @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.TaggingGroupingValue
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) // * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/ // */
public enum TaggingGroupingValue { //public enum TaggingGroupingValue {
//
onFieldName, // onFieldName,
onValue, // onValue,
onFieldName_onValue, // onFieldName_onValue,
onValue_onFieldName; // onValue_onFieldName;
//
/** // /**
* Returns the composed value in case of tag // * Returns the composed value in case of tag
* @param name // * @param name
* @param value // * @param value
* @param separator // * @param separator
* @param action // * @param action
* @return // * @return
*/ // */
public static String getComposedValueTag(String name, String value, String separator, TaggingGroupingValue action){ // public static String getComposedValueTag(String name, String value, String separator, TaggingGroupingValue action){
//
switch(action){ // switch(action){
case onFieldName: // case onFieldName:
return name; // return name;
case onValue: // case onValue:
return value; // return value;
case onFieldName_onValue: // case onFieldName_onValue:
return name + separator + value; // return name + separator + value;
case onValue_onFieldName: // case onValue_onFieldName:
return value + separator + name; // return value + separator + name;
default: return null; // default: return null;
} // }
//
} // }
//
/** // /**
* Returns the composed value in case of group // * Returns the composed value in case of group
* @param name // * @param name
* @param value // * @param value
* @param separator // * @param separator
* @param action // * @param action
* @return a list of group names // * @return a list of group names
*/ // */
public static List<String> getComposedValueGroup(String name, String value, TaggingGroupingValue action){ // public static List<String> getComposedValueGroup(String name, String value, TaggingGroupingValue action){
//
switch(action){ // switch(action){
case onFieldName: // case onFieldName:
return Arrays.asList(name); // return Arrays.asList(name);
case onValue: // case onValue:
return Arrays.asList(value); // return Arrays.asList(value);
case onFieldName_onValue: // case onFieldName_onValue:
case onValue_onFieldName: // case onValue_onFieldName:
return Arrays.asList(value, name); // return Arrays.asList(value, name);
default: return null; // default: return null;
} // }
//
} // }
//
} //}

View File

@ -16,6 +16,12 @@
<servlet-class>org.gcube.portlets.widgets.wsexplorer.server.WorkspaceExplorerServiceImpl</servlet-class> <servlet-class>org.gcube.portlets.widgets.wsexplorer.server.WorkspaceExplorerServiceImpl</servlet-class>
</servlet> </servlet>
<servlet>
<servlet-name>metadataProfileFormBuilderUploadServlet</servlet-name>
<servlet-class>org.gcube.portlets.widgets.mpformbuilder.server.MetadataProfileFormBuilderUploadServlet</servlet-class>
</servlet>
<servlet-mapping> <servlet-mapping>
<servlet-name>ckanpublisherservices</servlet-name> <servlet-name>ckanpublisherservices</servlet-name>
<url-pattern>/CKanMetadataPublisher/ckanservices</url-pattern> <url-pattern>/CKanMetadataPublisher/ckanservices</url-pattern>
@ -27,6 +33,12 @@
</servlet-mapping> </servlet-mapping>
<servlet-mapping>
<servlet-name>metadataProfileFormBuilderUploadServlet</servlet-name>
<url-pattern>/CKanMetadataPublisher/metadataProfileFormBuilderUploadServlet</url-pattern>
</servlet-mapping>
<!-- Default page to serve --> <!-- Default page to serve -->
<welcome-file-list> <welcome-file-list>
<welcome-file>CKanMetadataPublisher.html</welcome-file> <welcome-file>CKanMetadataPublisher.html</welcome-file>

View File

@ -10,7 +10,6 @@ import org.gcube.datacatalogue.utillibrary.server.DataCatalogueFactory;
import org.gcube.portlets.widgets.ckandatapublisherwidget.server.utils.WorkspaceUtils; import org.gcube.portlets.widgets.ckandatapublisherwidget.server.utils.WorkspaceUtils;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean;
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean;
import org.junit.Test;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;