edit_facility_26115 #3
|
@ -4,11 +4,12 @@
|
|||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [v2.1.3-SNAPSHOT] - 2023-07-25
|
||||
## [v2.2.0-SNAPSHOT] - 2024-02-02
|
||||
|
||||
**Enhancement**
|
||||
|
||||
- [#25433] Added spinner during resource creation
|
||||
- Implemented the Edit facility [#26640]
|
||||
- Added spinner during resource creation [#25433]
|
||||
|
||||
## [v2.1.2] - 2023-03-10
|
||||
|
||||
|
|
7
pom.xml
7
pom.xml
|
@ -13,7 +13,7 @@
|
|||
|
||||
<groupId>org.gcube.portlets.widgets</groupId>
|
||||
<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>
|
||||
|
||||
<description>
|
||||
|
@ -94,6 +94,11 @@
|
|||
<artifactId>portal-manager</artifactId>
|
||||
<scope>provided</scope>
|
||||
</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>
|
||||
<groupId>org.gcube.data-catalogue</groupId>
|
||||
<artifactId>gcubedatacatalogue-metadata-discovery</artifactId>
|
||||
|
|
|
@ -6,17 +6,26 @@
|
|||
<!-- Other module inherits -->
|
||||
<inherits name="com.github.gwtbootstrap.Bootstrap" />
|
||||
<!-- Responsive design -->
|
||||
<set-property name="bootstrap.responsiveDesign" value="true" />
|
||||
<inherits name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
|
||||
<set-property name="bootstrap.responsiveDesign"
|
||||
value="true" />
|
||||
<inherits
|
||||
name='com.github.gwtbootstrap.datetimepicker.Datetimepicker' />
|
||||
<inherits name='com.github.gwtbootstrap.datepicker.Datepicker' />
|
||||
<inherits name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
|
||||
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
|
||||
|
||||
<inherits name='com.google.gwt.json.JSON'/>
|
||||
<inherits
|
||||
name='org.gcube.datacatalogue.utillibrary.CkanUtilLibrary' />
|
||||
<inherits
|
||||
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. -->
|
||||
<entry-point
|
||||
|
|
|
@ -5,11 +5,12 @@ import java.util.List;
|
|||
|
||||
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.metadata.MetaDataFieldSkeleton;
|
||||
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.metadata.DataTypeWrapper;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION;
|
||||
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 com.github.gwtbootstrap.client.ui.Button;
|
||||
|
@ -165,10 +166,10 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
|
||||
|
||||
// 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
|
||||
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
|
||||
//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) {
|
||||
MetaDataFieldSkeleton widget;
|
||||
try {
|
||||
widget = new MetaDataFieldSkeleton(metadataFieldWrapper, eventBus);
|
||||
widget = new MetaDataFieldSkeleton(metadataFieldWrapper, eventBus, OPERATION.NEW);
|
||||
widgetsList.add(widget);
|
||||
panel.add(widget);
|
||||
} catch (Exception e) {
|
||||
|
@ -242,7 +243,7 @@ public class CKanMetadataPublisher implements EntryPoint {
|
|||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
for (MetaDataFieldSkeleton field : widgetsList)
|
||||
field.freeze();
|
||||
field.freeze(true);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import java.util.List;
|
|||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses.LicenseBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetaDataProfileBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.license.LicenseBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||
|
||||
import com.google.gwt.user.client.rpc.RemoteService;
|
||||
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
|
||||
|
|
|
@ -5,8 +5,8 @@ import java.util.List;
|
|||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses.LicenseBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetaDataProfileBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.license.LicenseBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
|
||||
|
|
|
@ -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.DeleteCustomFieldEvent;
|
||||
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.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.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.WizardCreator;
|
||||
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.OrganizationBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses.LicenseBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.CategoryWrapper;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetaDataProfileBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.MetaDataField;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.form.generic.CreateMetadataForm.OPERATION;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.client.ui.metadata.CategoryPanel;
|
||||
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.Button;
|
||||
|
@ -312,7 +314,16 @@ public class CreateDatasetForm extends Composite {
|
|||
* @param eventBus the event bus
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
private void createDatasetFormBody(final boolean isWorkspaceRequest, final String idFolderOrFileWorkspace,
|
||||
final HandlerManager eventBus) {
|
||||
final HandlerManager eventBus, final OPERATION operation) {
|
||||
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.eventBus = eventBus;
|
||||
|
@ -499,7 +510,7 @@ public class CreateDatasetForm extends Composite {
|
|||
@Override
|
||||
public void onChange(ChangeEvent event) {
|
||||
event.preventDefault();
|
||||
organizationsListboxChangeHandlerBody();
|
||||
organizationsListboxChangeHandlerBody(operation);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -557,7 +568,7 @@ public class CreateDatasetForm extends Composite {
|
|||
}
|
||||
|
||||
receivedBean.setMetadataList(profiles);
|
||||
prepareMetadataList(receivedBean);
|
||||
prepareMetadataList(receivedBean, operation);
|
||||
organizationsListbox.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
|
||||
* profiles and groups
|
||||
*/
|
||||
private void organizationsListboxChangeHandlerBody() {
|
||||
private void organizationsListboxChangeHandlerBody(OPERATION operation) {
|
||||
|
||||
// remove any other product profiles
|
||||
metadataTypeListbox.clear();
|
||||
|
@ -693,7 +704,7 @@ public class CreateDatasetForm extends Composite {
|
|||
if (profiles != null) {
|
||||
|
||||
receivedBean.setMetadataList(profiles);
|
||||
prepareMetadataList(receivedBean);
|
||||
prepareMetadataList(receivedBean, operation);
|
||||
organizationsListbox.setEnabled(true);
|
||||
metadataTypeListbox.setEnabled(true);
|
||||
|
||||
|
@ -775,7 +786,7 @@ public class CreateDatasetForm extends Composite {
|
|||
*
|
||||
* @param receivedBean
|
||||
*/
|
||||
private void prepareMetadataList(final DatasetBean receivedBean) {
|
||||
private void prepareMetadataList(final DatasetBean receivedBean, OPERATION operation) {
|
||||
|
||||
List<MetaDataProfileBean> profiles = receivedBean.getMetadataList();
|
||||
|
||||
|
@ -797,7 +808,7 @@ public class CreateDatasetForm extends Composite {
|
|||
receivedBean.setChosenType(null);
|
||||
} else {
|
||||
receivedBean.setChosenType(selectedItemText);
|
||||
addFields(selectedItemText);
|
||||
addFields(selectedItemText, operation);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -835,7 +846,7 @@ public class CreateDatasetForm extends Composite {
|
|||
*
|
||||
* @param selectedItem
|
||||
*/
|
||||
protected void addFields(String selectedItem) {
|
||||
protected void addFields(String selectedItem, OPERATION operation) {
|
||||
|
||||
for (MetaDataProfileBean bean : receivedBean.getMetadataList()) {
|
||||
if (bean.getType().equals(selectedItem)) {
|
||||
|
@ -860,7 +871,7 @@ public class CreateDatasetForm extends Composite {
|
|||
|
||||
MetaDataField fieldWidget;
|
||||
try {
|
||||
fieldWidget = new MetaDataField(field, eventBus);
|
||||
fieldWidget = new MetaDataField(field, eventBus, operation);
|
||||
metadataFieldsPanel.add(fieldWidget);
|
||||
listOfMetadataFields.add(fieldWidget);
|
||||
} catch (Exception e) {
|
||||
|
@ -891,7 +902,7 @@ public class CreateDatasetForm extends Composite {
|
|||
|
||||
MetaDataField fieldWidget;
|
||||
try {
|
||||
fieldWidget = new MetaDataField(metadataFieldWrapper, eventBus);
|
||||
fieldWidget = new MetaDataField(metadataFieldWrapper, eventBus, operation);
|
||||
cp.addField(fieldWidget);
|
||||
listOfMetadataFields.add(fieldWidget);
|
||||
} catch (Exception e) {
|
||||
|
@ -915,7 +926,7 @@ public class CreateDatasetForm extends Composite {
|
|||
|
||||
MetaDataField fieldWidget;
|
||||
try {
|
||||
fieldWidget = new MetaDataField(field, eventBus);
|
||||
fieldWidget = new MetaDataField(field, eventBus, operation);
|
||||
extrasCategory.addField(fieldWidget);
|
||||
listOfMetadataFields.add(fieldWidget);
|
||||
} catch (Exception e) {
|
||||
|
@ -1273,6 +1284,7 @@ public class CreateDatasetForm extends Composite {
|
|||
tabPanel.setWidth("100%");
|
||||
|
||||
// add the form
|
||||
|
||||
resourceForm = new AddResourceToDataset(eventBus, createdDatasetBean.getId(),
|
||||
createdDatasetBean.getTitle(),
|
||||
createdDatasetBean.getSelectedOrganization(), owner, datasetUrl);
|
||||
|
@ -1615,7 +1627,7 @@ public class CreateDatasetForm extends Composite {
|
|||
// disable profile fields
|
||||
for (MetaDataField metaField : listOfMetadataFields) {
|
||||
for (MetaDataFieldSkeleton field : metaField.getListOfMetadataFields()) {
|
||||
field.freeze();
|
||||
field.freeze(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,162 +1,162 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.MetaDataFieldSkeleton;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Label;
|
||||
import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
|
||||
/**
|
||||
* The Class MetaDataField.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Jun 10, 2019
|
||||
*/
|
||||
public class MetaDataField extends Composite {
|
||||
|
||||
private static MetaDataFieldUiBinder uiBinder = GWT.create(MetaDataFieldUiBinder.class);
|
||||
|
||||
@UiField VerticalPanel panelMetaDataFieldsSkeleton;
|
||||
|
||||
@UiField Label repeatabilityLabel;
|
||||
|
||||
//@UiField ControlGroup cgMetaDataFieldSkeletonFields;
|
||||
|
||||
@UiField Button addFieldButton;
|
||||
|
||||
@UiField Button removeFieldButton;
|
||||
|
||||
private List<MetaDataFieldSkeleton> listOfMetadataFields = new ArrayList<MetaDataFieldSkeleton>();
|
||||
|
||||
private MetadataFieldWrapper fieldWrapper;
|
||||
|
||||
private HandlerManager eventBus;
|
||||
|
||||
/**
|
||||
* The Interface MetaDataFieldUiBinder.
|
||||
*
|
||||
* @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
*
|
||||
* Jun 10, 2019
|
||||
*/
|
||||
interface MetaDataFieldUiBinder extends UiBinder<Widget, MetaDataField> {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a new meta data field.
|
||||
*
|
||||
* @param field the field
|
||||
* @param eventBus the event bus
|
||||
* @throws Exception the exception
|
||||
*/
|
||||
public MetaDataField(final MetadataFieldWrapper field, HandlerManager eventBus) throws Exception {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.fieldWrapper = field;
|
||||
this.eventBus = eventBus;
|
||||
addNewOccurrenceOfField();
|
||||
checkAllowedAddField();
|
||||
checkAllowedRemoveField();
|
||||
|
||||
addFieldButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
addNewOccurrenceOfField();
|
||||
checkAllowedAddField();
|
||||
checkAllowedRemoveField();
|
||||
}
|
||||
});
|
||||
|
||||
removeFieldButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
removeLatestOccurrenceOfFiled();
|
||||
checkAllowedAddField();
|
||||
checkAllowedRemoveField();
|
||||
}
|
||||
});
|
||||
|
||||
//The field is repeatable
|
||||
if(field.getMaxOccurs()>1) {
|
||||
repeatabilityLabel.setVisible(true);
|
||||
repeatabilityLabel.setType(LabelType.INFO);
|
||||
addFieldButton.setTitle("Add another "+field.getFieldName());
|
||||
removeFieldButton.setTitle("Remove latest "+field.getFieldName());
|
||||
// String maxTxt = field.getMaxOccurs()==Integer.MAX_VALUE?"":"(max occurs declared are "+field.getMaxOccurs()+" times)";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check allowed remove field.
|
||||
*/
|
||||
private void checkAllowedRemoveField() {
|
||||
boolean removeCond = fieldWrapper.getMaxOccurs()>1 && listOfMetadataFields.size()>1;
|
||||
removeFieldButton.setVisible(removeCond);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is allowed add occurrence.
|
||||
*/
|
||||
private void checkAllowedAddField() {
|
||||
|
||||
boolean repeatibilityCond = fieldWrapper.getMaxOccurs()>1 && listOfMetadataFields.size()<fieldWrapper.getMaxOccurs();
|
||||
addFieldButton.setVisible(repeatibilityCond);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Removes the latest occurrence of filed.
|
||||
*/
|
||||
private void removeLatestOccurrenceOfFiled() {
|
||||
int size = listOfMetadataFields.size();
|
||||
MetaDataFieldSkeleton skeleton = listOfMetadataFields.get(size-1);
|
||||
try {
|
||||
panelMetaDataFieldsSkeleton.remove(skeleton);
|
||||
listOfMetadataFields.remove(size-1);
|
||||
}catch (Exception e) {
|
||||
GWT.log("Error: ",e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the new occurrence of field.
|
||||
*/
|
||||
private void addNewOccurrenceOfField() {
|
||||
try {
|
||||
MetaDataFieldSkeleton fieldWidget = new MetaDataFieldSkeleton(fieldWrapper, eventBus);
|
||||
listOfMetadataFields.add(fieldWidget);
|
||||
panelMetaDataFieldsSkeleton.add(fieldWidget);
|
||||
} catch (Exception e) {
|
||||
GWT.log("Error: ",e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the list of metadata fields.
|
||||
*
|
||||
* @return the list of metadata fields
|
||||
*/
|
||||
public List<MetaDataFieldSkeleton> getListOfMetadataFields() {
|
||||
return listOfMetadataFields;
|
||||
}
|
||||
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.MetaDataFieldSkeleton;
|
||||
//import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper;
|
||||
//
|
||||
//import com.github.gwtbootstrap.client.ui.Button;
|
||||
//import com.github.gwtbootstrap.client.ui.Label;
|
||||
//import com.github.gwtbootstrap.client.ui.constants.LabelType;
|
||||
//import com.google.gwt.core.client.GWT;
|
||||
//import com.google.gwt.event.dom.client.ClickEvent;
|
||||
//import com.google.gwt.event.dom.client.ClickHandler;
|
||||
//import com.google.gwt.event.shared.HandlerManager;
|
||||
//import com.google.gwt.uibinder.client.UiBinder;
|
||||
//import com.google.gwt.uibinder.client.UiField;
|
||||
//import com.google.gwt.user.client.ui.Composite;
|
||||
//import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
//import com.google.gwt.user.client.ui.Widget;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * The Class MetaDataField.
|
||||
// *
|
||||
// * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
// *
|
||||
// * Jun 10, 2019
|
||||
// */
|
||||
//public class MetaDataField extends Composite {
|
||||
//
|
||||
// private static MetaDataFieldUiBinder uiBinder = GWT.create(MetaDataFieldUiBinder.class);
|
||||
//
|
||||
// @UiField VerticalPanel panelMetaDataFieldsSkeleton;
|
||||
//
|
||||
// @UiField Label repeatabilityLabel;
|
||||
//
|
||||
// //@UiField ControlGroup cgMetaDataFieldSkeletonFields;
|
||||
//
|
||||
// @UiField Button addFieldButton;
|
||||
//
|
||||
// @UiField Button removeFieldButton;
|
||||
//
|
||||
// private List<MetaDataFieldSkeleton> listOfMetadataFields = new ArrayList<MetaDataFieldSkeleton>();
|
||||
//
|
||||
// private MetadataFieldWrapper fieldWrapper;
|
||||
//
|
||||
// private HandlerManager eventBus;
|
||||
//
|
||||
// /**
|
||||
// * The Interface MetaDataFieldUiBinder.
|
||||
// *
|
||||
// * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it)
|
||||
// *
|
||||
// * Jun 10, 2019
|
||||
// */
|
||||
// interface MetaDataFieldUiBinder extends UiBinder<Widget, MetaDataField> {
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Instantiates a new meta data field.
|
||||
// *
|
||||
// * @param field the field
|
||||
// * @param eventBus the event bus
|
||||
// * @throws Exception the exception
|
||||
// */
|
||||
// public MetaDataField(final MetadataFieldWrapper field, HandlerManager eventBus) throws Exception {
|
||||
// initWidget(uiBinder.createAndBindUi(this));
|
||||
// this.fieldWrapper = field;
|
||||
// this.eventBus = eventBus;
|
||||
// addNewOccurrenceOfField();
|
||||
// checkAllowedAddField();
|
||||
// checkAllowedRemoveField();
|
||||
//
|
||||
// addFieldButton.addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// addNewOccurrenceOfField();
|
||||
// checkAllowedAddField();
|
||||
// checkAllowedRemoveField();
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// removeFieldButton.addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// removeLatestOccurrenceOfFiled();
|
||||
// checkAllowedAddField();
|
||||
// checkAllowedRemoveField();
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// //The field is repeatable
|
||||
// if(field.getMaxOccurs()>1) {
|
||||
// repeatabilityLabel.setVisible(true);
|
||||
// repeatabilityLabel.setType(LabelType.INFO);
|
||||
// addFieldButton.setTitle("Add another "+field.getFieldName());
|
||||
// removeFieldButton.setTitle("Remove latest "+field.getFieldName());
|
||||
//// String maxTxt = field.getMaxOccurs()==Integer.MAX_VALUE?"":"(max occurs declared are "+field.getMaxOccurs()+" times)";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Check allowed remove field.
|
||||
// */
|
||||
// private void checkAllowedRemoveField() {
|
||||
// boolean removeCond = fieldWrapper.getMaxOccurs()>1 && listOfMetadataFields.size()>1;
|
||||
// removeFieldButton.setVisible(removeCond);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Checks if is allowed add occurrence.
|
||||
// */
|
||||
// private void checkAllowedAddField() {
|
||||
//
|
||||
// boolean repeatibilityCond = fieldWrapper.getMaxOccurs()>1 && listOfMetadataFields.size()<fieldWrapper.getMaxOccurs();
|
||||
// addFieldButton.setVisible(repeatibilityCond);
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Removes the latest occurrence of filed.
|
||||
// */
|
||||
// private void removeLatestOccurrenceOfFiled() {
|
||||
// int size = listOfMetadataFields.size();
|
||||
// MetaDataFieldSkeleton skeleton = listOfMetadataFields.get(size-1);
|
||||
// try {
|
||||
// panelMetaDataFieldsSkeleton.remove(skeleton);
|
||||
// listOfMetadataFields.remove(size-1);
|
||||
// }catch (Exception e) {
|
||||
// GWT.log("Error: ",e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Adds the new occurrence of field.
|
||||
// */
|
||||
// private void addNewOccurrenceOfField() {
|
||||
// try {
|
||||
// MetaDataFieldSkeleton fieldWidget = new MetaDataFieldSkeleton(fieldWrapper, eventBus);
|
||||
// listOfMetadataFields.add(fieldWidget);
|
||||
// panelMetaDataFieldsSkeleton.add(fieldWidget);
|
||||
// } catch (Exception e) {
|
||||
// GWT.log("Error: ",e);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the list of metadata fields.
|
||||
// *
|
||||
// * @return the list of metadata fields
|
||||
// */
|
||||
// public List<MetaDataFieldSkeleton> getListOfMetadataFields() {
|
||||
// return listOfMetadataFields;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,80 +1,80 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.MetaDataField;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.PageHeader;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.dom.client.Style.Float;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
public class CategoryPanel extends Composite{
|
||||
|
||||
private static CategoryPanelUiBinder uiBinder = GWT
|
||||
.create(CategoryPanelUiBinder.class);
|
||||
|
||||
interface CategoryPanelUiBinder extends UiBinder<Widget, CategoryPanel> {
|
||||
}
|
||||
|
||||
@UiField VerticalPanel fieldsPanel;
|
||||
@UiField PageHeader categoryHeader;
|
||||
//private List<MetaDataFieldSkeleton> fieldsForThisCategory;
|
||||
|
||||
private List<MetaDataField> fieldsForThisCategory;
|
||||
|
||||
public CategoryPanel() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param fieldsForThisCategory
|
||||
* @param title
|
||||
* @param description
|
||||
*/
|
||||
public CategoryPanel(String title, String description) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
title = title == null ? "" : title;
|
||||
description = description == null ? "" : description;
|
||||
categoryHeader.setTitle(title);
|
||||
categoryHeader.setText(title);
|
||||
categoryHeader.setSubtext(description);
|
||||
categoryHeader.getElement().getStyle().setFloat(Float.LEFT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a field to this widget
|
||||
* @param fieldWidget
|
||||
*/
|
||||
/*public void addField(MetaDataFieldSkeleton fieldWidget) {
|
||||
if(fieldsForThisCategory == null){
|
||||
fieldsForThisCategory = new ArrayList<MetaDataFieldSkeleton>();
|
||||
fieldWidget.setVisible(true);
|
||||
fieldsPanel.setVisible(true);
|
||||
}
|
||||
fieldsForThisCategory.add(fieldWidget);
|
||||
fieldsPanel.add(fieldWidget);
|
||||
}*/
|
||||
|
||||
|
||||
/**
|
||||
* Add a field to this widget
|
||||
* @param fieldWidget
|
||||
*/
|
||||
public void addField(MetaDataField fieldWidget) {
|
||||
if(fieldsForThisCategory == null){
|
||||
fieldsForThisCategory = new ArrayList<MetaDataField>();
|
||||
fieldWidget.setVisible(true);
|
||||
fieldsPanel.setVisible(true);
|
||||
}
|
||||
fieldsForThisCategory.add(fieldWidget);
|
||||
fieldsPanel.add(fieldWidget);
|
||||
}
|
||||
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.MetaDataField;
|
||||
//
|
||||
//import com.github.gwtbootstrap.client.ui.PageHeader;
|
||||
//import com.google.gwt.core.client.GWT;
|
||||
//import com.google.gwt.dom.client.Style.Float;
|
||||
//import com.google.gwt.uibinder.client.UiBinder;
|
||||
//import com.google.gwt.uibinder.client.UiField;
|
||||
//import com.google.gwt.user.client.ui.Composite;
|
||||
//import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
//import com.google.gwt.user.client.ui.Widget;
|
||||
//
|
||||
//public class CategoryPanel extends Composite{
|
||||
//
|
||||
// private static CategoryPanelUiBinder uiBinder = GWT
|
||||
// .create(CategoryPanelUiBinder.class);
|
||||
//
|
||||
// interface CategoryPanelUiBinder extends UiBinder<Widget, CategoryPanel> {
|
||||
// }
|
||||
//
|
||||
// @UiField VerticalPanel fieldsPanel;
|
||||
// @UiField PageHeader categoryHeader;
|
||||
// //private List<MetaDataFieldSkeleton> fieldsForThisCategory;
|
||||
//
|
||||
// private List<MetaDataField> fieldsForThisCategory;
|
||||
//
|
||||
// public CategoryPanel() {
|
||||
// initWidget(uiBinder.createAndBindUi(this));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// *
|
||||
// * @param fieldsForThisCategory
|
||||
// * @param title
|
||||
// * @param description
|
||||
// */
|
||||
// public CategoryPanel(String title, String description) {
|
||||
// initWidget(uiBinder.createAndBindUi(this));
|
||||
// title = title == null ? "" : title;
|
||||
// description = description == null ? "" : description;
|
||||
// categoryHeader.setTitle(title);
|
||||
// categoryHeader.setText(title);
|
||||
// categoryHeader.setSubtext(description);
|
||||
// categoryHeader.getElement().getStyle().setFloat(Float.LEFT);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Add a field to this widget
|
||||
// * @param fieldWidget
|
||||
// */
|
||||
// /*public void addField(MetaDataFieldSkeleton fieldWidget) {
|
||||
// if(fieldsForThisCategory == null){
|
||||
// fieldsForThisCategory = new ArrayList<MetaDataFieldSkeleton>();
|
||||
// fieldWidget.setVisible(true);
|
||||
// fieldsPanel.setVisible(true);
|
||||
// }
|
||||
// fieldsForThisCategory.add(fieldWidget);
|
||||
// fieldsPanel.add(fieldWidget);
|
||||
// }*/
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Add a field to this widget
|
||||
// * @param fieldWidget
|
||||
// */
|
||||
// public void addField(MetaDataField fieldWidget) {
|
||||
// if(fieldsForThisCategory == null){
|
||||
// fieldsForThisCategory = new ArrayList<MetaDataField>();
|
||||
// fieldWidget.setVisible(true);
|
||||
// fieldsPanel.setVisible(true);
|
||||
// }
|
||||
// fieldsForThisCategory.add(fieldWidget);
|
||||
// fieldsPanel.add(fieldWidget);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -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"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<g:HTMLPanel>
|
||||
<g:VerticalPanel width="100%">
|
||||
<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"
|
||||
width="100%"></g:VerticalPanel>
|
||||
</g:VerticalPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
</ui:UiBinder> -->
|
|
@ -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"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<b:Controls>
|
||||
|
@ -10,4 +10,4 @@
|
|||
</b:InputAddOn>
|
||||
<b:Button icon="REMOVE_SIGN" title="Remove field" ui:field="removeCustomField"></b:Button>
|
||||
</b:Controls>
|
||||
</ui:UiBinder>
|
||||
</ui:UiBinder> -->
|
File diff suppressed because it is too large
Load Diff
|
@ -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"
|
||||
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"
|
||||
|
@ -33,7 +33,7 @@
|
|||
<g:FlowPanel width="95%">
|
||||
<g:SimplePanel ui:field="elementPanel" styleName="{style.element-panel}"
|
||||
width="95%">
|
||||
<!-- Listbox, Checkbox, Textbox, Calendar etc -->
|
||||
Listbox, Checkbox, Textbox, Calendar etc
|
||||
</g:SimplePanel>
|
||||
<g:FlowPanel ui:field="noteFieldContainer" styleName="{style.note-container}">
|
||||
<b:Popover ui:field="noteFieldPopover" html="true"
|
||||
|
@ -47,4 +47,4 @@
|
|||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
</ui:UiBinder> -->
|
|
@ -1,138 +1,138 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.timeandreanges;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.github.gwtbootstrap.datepicker.client.ui.DateBox;
|
||||
import com.github.gwtbootstrap.datetimepicker.client.ui.DateTimeBox;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* Widget for handling date-like fields.
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class DataTimeBox extends Composite{
|
||||
|
||||
private static DataTimeBoxUiBinder uiBinder = GWT
|
||||
.create(DataTimeBoxUiBinder.class);
|
||||
|
||||
interface DataTimeBoxUiBinder extends UiBinder<Widget, DataTimeBox> {
|
||||
}
|
||||
|
||||
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_END = "MISSING_RANGE_PART_END";
|
||||
private static final String COLON = ":";
|
||||
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_DATE_START_LABEL = "Insert a start 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 formatTime = DateTimeFormat.getFormat("HH:mm");
|
||||
|
||||
private boolean isRange;
|
||||
|
||||
@UiField
|
||||
DateBox startRangeDate;
|
||||
@UiField
|
||||
DateTimeBox startRangeTime;
|
||||
@UiField
|
||||
DateBox endRangeDate;
|
||||
@UiField
|
||||
DateTimeBox endRangeTime;
|
||||
@UiField
|
||||
FlowPanel singleDataEnd;
|
||||
@UiField
|
||||
FlowPanel singleDataStart;
|
||||
|
||||
public DataTimeBox(boolean isRange) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
this.isRange = isRange;
|
||||
startRangeDate.setPlaceholder(INSERT_DATE_INSTANT_LABEL);
|
||||
startRangeTime.setPlaceholder(INSERT_TIME_INSTANT_LABEL);
|
||||
if(isRange){
|
||||
singleDataEnd.setVisible(true);
|
||||
singleDataEnd.setWidth("50%");
|
||||
singleDataStart.setWidth("50%");
|
||||
|
||||
startRangeTime.setWidth("30%");
|
||||
endRangeTime.setWidth("30%");
|
||||
startRangeDate.setWidth("60%");
|
||||
endRangeDate.setWidth("60%");
|
||||
|
||||
startRangeDate.setPlaceholder(INSERT_DATE_START_LABEL);
|
||||
endRangeDate.setPlaceholder(INSERT_DATE_END_LABEL);
|
||||
endRangeTime.setPlaceholder(INSERT_TIME_INSTANT_LABEL);
|
||||
}
|
||||
startRangeDate.setValue(null);
|
||||
startRangeTime.setValue(null);
|
||||
endRangeDate.setValue(null);
|
||||
endRangeTime.setValue(null);
|
||||
}
|
||||
|
||||
public boolean getIsRange(){
|
||||
return isRange;
|
||||
}
|
||||
|
||||
public void setStartDate(String date, String time){
|
||||
GWT.log("Date is " + date + " and time is " + time);
|
||||
startRangeDate.setValue(new Date(date));
|
||||
if(time != null && !time.isEmpty()){
|
||||
Date completeDate = new Date();
|
||||
completeDate.setHours(Integer.parseInt(time.split(COLON)[0]));
|
||||
completeDate.setMinutes(Integer.parseInt(time.split(COLON)[1]));
|
||||
startRangeTime.setValue(completeDate);
|
||||
}
|
||||
}
|
||||
|
||||
public void setEndDate(String date, String time){
|
||||
GWT.log("Date is " + date + " and time is " + time);
|
||||
endRangeDate.setValue(new Date(date));
|
||||
if(time != null && !time.isEmpty()){
|
||||
Date completeDate = new Date();
|
||||
completeDate.setHours(Integer.parseInt(time.split(COLON)[0]));
|
||||
completeDate.setMinutes(Integer.parseInt(time.split(COLON)[1]));
|
||||
endRangeTime.setValue(completeDate);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current value, with MISSING_RANGE_VALUE in case of missing entry
|
||||
* @return
|
||||
*/
|
||||
public String getCurrentValue(){
|
||||
|
||||
String firstRange = MISSING_RANGE_VALUE_START;
|
||||
String secondRange = MISSING_RANGE_VALUE_END;
|
||||
|
||||
if(startRangeDate.getValue() != null){
|
||||
firstRange = formatDate.format(startRangeDate.getValue()) + " " + (startRangeTime.getValue() != null ? formatTime.format(startRangeTime.getValue()) : "");;
|
||||
}
|
||||
if(isRange && endRangeDate.getValue() != null){
|
||||
secondRange = formatDate.format(endRangeDate.getValue()) + " " + (endRangeTime.getValue() != null ? formatTime.format(endRangeTime.getValue()) : "");
|
||||
}
|
||||
|
||||
if(isRange){
|
||||
GWT.log("Returning " + firstRange + RANGE_SEPARATOR_START_END + secondRange);
|
||||
return firstRange + RANGE_SEPARATOR_START_END + secondRange;
|
||||
}else {
|
||||
GWT.log("Returning " + firstRange);
|
||||
return firstRange;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Freeze the inputs
|
||||
*/
|
||||
public void freeze(){
|
||||
startRangeDate.setEnabled(false);
|
||||
startRangeTime.setEnabled(false);
|
||||
endRangeDate.setEnabled(false);
|
||||
endRangeTime.setEnabled(false);
|
||||
}
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.timeandreanges;
|
||||
//
|
||||
//import java.util.Date;
|
||||
//
|
||||
//import com.github.gwtbootstrap.datepicker.client.ui.DateBox;
|
||||
//import com.github.gwtbootstrap.datetimepicker.client.ui.DateTimeBox;
|
||||
//import com.google.gwt.core.client.GWT;
|
||||
//import com.google.gwt.i18n.client.DateTimeFormat;
|
||||
//import com.google.gwt.uibinder.client.UiBinder;
|
||||
//import com.google.gwt.uibinder.client.UiField;
|
||||
//import com.google.gwt.user.client.ui.Composite;
|
||||
//import com.google.gwt.user.client.ui.FlowPanel;
|
||||
//import com.google.gwt.user.client.ui.Widget;
|
||||
//
|
||||
///**
|
||||
// * Widget for handling date-like fields.
|
||||
// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
// */
|
||||
//public class DataTimeBox extends Composite{
|
||||
//
|
||||
// private static DataTimeBoxUiBinder uiBinder = GWT
|
||||
// .create(DataTimeBoxUiBinder.class);
|
||||
//
|
||||
// interface DataTimeBoxUiBinder extends UiBinder<Widget, DataTimeBox> {
|
||||
// }
|
||||
//
|
||||
// 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_END = "MISSING_RANGE_PART_END";
|
||||
// private static final String COLON = ":";
|
||||
// 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_DATE_START_LABEL = "Insert a start 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 formatTime = DateTimeFormat.getFormat("HH:mm");
|
||||
//
|
||||
// private boolean isRange;
|
||||
//
|
||||
// @UiField
|
||||
// DateBox startRangeDate;
|
||||
// @UiField
|
||||
// DateTimeBox startRangeTime;
|
||||
// @UiField
|
||||
// DateBox endRangeDate;
|
||||
// @UiField
|
||||
// DateTimeBox endRangeTime;
|
||||
// @UiField
|
||||
// FlowPanel singleDataEnd;
|
||||
// @UiField
|
||||
// FlowPanel singleDataStart;
|
||||
//
|
||||
// public DataTimeBox(boolean isRange) {
|
||||
// initWidget(uiBinder.createAndBindUi(this));
|
||||
// this.isRange = isRange;
|
||||
// startRangeDate.setPlaceholder(INSERT_DATE_INSTANT_LABEL);
|
||||
// startRangeTime.setPlaceholder(INSERT_TIME_INSTANT_LABEL);
|
||||
// if(isRange){
|
||||
// singleDataEnd.setVisible(true);
|
||||
// singleDataEnd.setWidth("50%");
|
||||
// singleDataStart.setWidth("50%");
|
||||
//
|
||||
// startRangeTime.setWidth("30%");
|
||||
// endRangeTime.setWidth("30%");
|
||||
// startRangeDate.setWidth("60%");
|
||||
// endRangeDate.setWidth("60%");
|
||||
//
|
||||
// startRangeDate.setPlaceholder(INSERT_DATE_START_LABEL);
|
||||
// endRangeDate.setPlaceholder(INSERT_DATE_END_LABEL);
|
||||
// endRangeTime.setPlaceholder(INSERT_TIME_INSTANT_LABEL);
|
||||
// }
|
||||
// startRangeDate.setValue(null);
|
||||
// startRangeTime.setValue(null);
|
||||
// endRangeDate.setValue(null);
|
||||
// endRangeTime.setValue(null);
|
||||
// }
|
||||
//
|
||||
// public boolean getIsRange(){
|
||||
// return isRange;
|
||||
// }
|
||||
//
|
||||
// public void setStartDate(String date, String time){
|
||||
// GWT.log("Date is " + date + " and time is " + time);
|
||||
// startRangeDate.setValue(new Date(date));
|
||||
// if(time != null && !time.isEmpty()){
|
||||
// Date completeDate = new Date();
|
||||
// completeDate.setHours(Integer.parseInt(time.split(COLON)[0]));
|
||||
// completeDate.setMinutes(Integer.parseInt(time.split(COLON)[1]));
|
||||
// startRangeTime.setValue(completeDate);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void setEndDate(String date, String time){
|
||||
// GWT.log("Date is " + date + " and time is " + time);
|
||||
// endRangeDate.setValue(new Date(date));
|
||||
// if(time != null && !time.isEmpty()){
|
||||
// Date completeDate = new Date();
|
||||
// completeDate.setHours(Integer.parseInt(time.split(COLON)[0]));
|
||||
// completeDate.setMinutes(Integer.parseInt(time.split(COLON)[1]));
|
||||
// endRangeTime.setValue(completeDate);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Return the current value, with MISSING_RANGE_VALUE in case of missing entry
|
||||
// * @return
|
||||
// */
|
||||
// public String getCurrentValue(){
|
||||
//
|
||||
// String firstRange = MISSING_RANGE_VALUE_START;
|
||||
// String secondRange = MISSING_RANGE_VALUE_END;
|
||||
//
|
||||
// if(startRangeDate.getValue() != null){
|
||||
// firstRange = formatDate.format(startRangeDate.getValue()) + " " + (startRangeTime.getValue() != null ? formatTime.format(startRangeTime.getValue()) : "");;
|
||||
// }
|
||||
// if(isRange && endRangeDate.getValue() != null){
|
||||
// secondRange = formatDate.format(endRangeDate.getValue()) + " " + (endRangeTime.getValue() != null ? formatTime.format(endRangeTime.getValue()) : "");
|
||||
// }
|
||||
//
|
||||
// if(isRange){
|
||||
// GWT.log("Returning " + firstRange + RANGE_SEPARATOR_START_END + secondRange);
|
||||
// return firstRange + RANGE_SEPARATOR_START_END + secondRange;
|
||||
// }else {
|
||||
// GWT.log("Returning " + firstRange);
|
||||
// return firstRange;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Freeze the inputs
|
||||
// */
|
||||
// public void freeze(){
|
||||
// startRangeDate.setEnabled(false);
|
||||
// startRangeTime.setEnabled(false);
|
||||
// endRangeDate.setEnabled(false);
|
||||
// endRangeTime.setEnabled(false);
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -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"
|
||||
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">
|
||||
|
@ -27,4 +27,4 @@
|
|||
</g:FlowPanel>
|
||||
</g:FlowPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
</ui:UiBinder> -->
|
|
@ -1,37 +1,37 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* Container for the third phase (add resource to dataset)
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class AddResourceContainer extends Composite{
|
||||
|
||||
private static AddResourceContainerUiBinder uiBinder = GWT
|
||||
.create(AddResourceContainerUiBinder.class);
|
||||
|
||||
interface AddResourceContainerUiBinder extends
|
||||
UiBinder<Widget, AddResourceContainer> {
|
||||
}
|
||||
|
||||
@UiField VerticalPanel resourcesPanel;
|
||||
|
||||
public AddResourceContainer(final String datasetUrl) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the form to this panel
|
||||
* @param w
|
||||
*/
|
||||
public void add(TabPanel w){
|
||||
resourcesPanel.add(w);
|
||||
}
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources;
|
||||
//
|
||||
//import com.github.gwtbootstrap.client.ui.TabPanel;
|
||||
//import com.google.gwt.core.client.GWT;
|
||||
//import com.google.gwt.uibinder.client.UiBinder;
|
||||
//import com.google.gwt.uibinder.client.UiField;
|
||||
//import com.google.gwt.user.client.ui.Composite;
|
||||
//import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
//import com.google.gwt.user.client.ui.Widget;
|
||||
//
|
||||
///**
|
||||
// * Container for the third phase (add resource to dataset)
|
||||
// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
// */
|
||||
//public class AddResourceContainer extends Composite{
|
||||
//
|
||||
// private static AddResourceContainerUiBinder uiBinder = GWT
|
||||
// .create(AddResourceContainerUiBinder.class);
|
||||
//
|
||||
// interface AddResourceContainerUiBinder extends
|
||||
// UiBinder<Widget, AddResourceContainer> {
|
||||
// }
|
||||
//
|
||||
// @UiField VerticalPanel resourcesPanel;
|
||||
//
|
||||
// public AddResourceContainer(final String datasetUrl) {
|
||||
// initWidget(uiBinder.createAndBindUi(this));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Add the form to this panel
|
||||
// * @param w
|
||||
// */
|
||||
// public void add(TabPanel w){
|
||||
// resourcesPanel.add(w);
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -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"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<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:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
</ui:UiBinder> -->
|
|
@ -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.CKanPublisherServiceAsync;
|
||||
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.mpformbuilder.client.ui.utils.LoaderIcon;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.AlertBlock;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
|
|
|
@ -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"
|
||||
xmlns:b="urn:import:com.github.gwtbootstrap.client.ui"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||
|
@ -101,12 +101,12 @@
|
|||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
|
||||
<!-- Alert blocks for info/errors -->
|
||||
Alert blocks for info/errors
|
||||
<b:AlertBlock type="INFO" animation="true"
|
||||
visible="false" close="false" ui:field="infoBlock"
|
||||
styleName="{style.block-alert-style}"></b:AlertBlock>
|
||||
|
||||
<!-- Add resource button -->
|
||||
Add resource button
|
||||
<b:Button title="Add resource" ui:field="addResourceButton"
|
||||
type="PRIMARY">Add</b:Button>
|
||||
|
||||
|
@ -122,4 +122,4 @@
|
|||
type="LINK" visible="true"></b:Button>
|
||||
</g:FlowPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
</ui:UiBinder> -->
|
|
@ -1,160 +1,160 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService;
|
||||
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.AddResourceEventHandler;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteResourceEvent;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteResourceEventHandler;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Accordion;
|
||||
import com.github.gwtbootstrap.client.ui.AccordionGroup;
|
||||
import com.github.gwtbootstrap.client.ui.Button;
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.shared.HandlerManager;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* A summary of the resources added by the user.
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class AddedResourcesSummary extends Composite{
|
||||
|
||||
private static AddedResourcesSummaryUiBinder uiBinder = GWT
|
||||
.create(AddedResourcesSummaryUiBinder.class);
|
||||
|
||||
interface AddedResourcesSummaryUiBinder extends
|
||||
UiBinder<Widget, AddedResourcesSummary> {
|
||||
}
|
||||
|
||||
//Create a remote service proxy to talk to the server-side ckan service.
|
||||
private final CKanPublisherServiceAsync ckanServices = GWT.create(CKanPublisherService.class);
|
||||
|
||||
// Event bus
|
||||
private HandlerManager eventBus;
|
||||
|
||||
// list of added resources (beans)
|
||||
List<ResourceElementBean> addedResources;
|
||||
|
||||
@UiField VerticalPanel addResourcesPanel;
|
||||
|
||||
public AddedResourcesSummary(HandlerManager eventBus) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
|
||||
// save bus
|
||||
this.eventBus = eventBus;
|
||||
|
||||
// bind on add resource event
|
||||
bind();
|
||||
|
||||
// init list
|
||||
addedResources = new ArrayList<ResourceElementBean>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Bind on add/delete resource event
|
||||
*/
|
||||
private void bind() {
|
||||
|
||||
// when a new resource is added
|
||||
eventBus.addHandler(AddResourceEvent.TYPE, new AddResourceEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onAddedResource(AddResourceEvent addResourceEvent) {
|
||||
|
||||
// get the resource
|
||||
final ResourceElementBean justAddedResource = addResourceEvent.getResource();
|
||||
|
||||
// Build an accordion to show resource info
|
||||
Accordion accordion = new Accordion();
|
||||
AccordionGroup accordionGroup = new AccordionGroup();
|
||||
accordionGroup.setHeading("- " + justAddedResource.getName());
|
||||
accordion.add(accordionGroup);
|
||||
|
||||
// add sub-info such as url and description
|
||||
Paragraph pUrl = new Paragraph();
|
||||
pUrl.setText("Url : " + justAddedResource.getUrl());
|
||||
Paragraph pDescription = new Paragraph();
|
||||
pDescription.setText("Description : " + justAddedResource.getDescription());
|
||||
|
||||
// button to delete the resource
|
||||
Button deleteButton = new Button();
|
||||
deleteButton.setText("Delete");
|
||||
deleteButton.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
|
||||
eventBus.fireEvent(new DeleteResourceEvent(justAddedResource));
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// fill accordion
|
||||
accordionGroup.add(pUrl);
|
||||
accordionGroup.add(pDescription);
|
||||
accordionGroup.add(deleteButton);
|
||||
|
||||
// add to the list
|
||||
addedResources.add(justAddedResource);
|
||||
|
||||
// add to the panel
|
||||
addResourcesPanel.add(accordion);
|
||||
}
|
||||
});
|
||||
|
||||
// when the user wants to delete a resource
|
||||
eventBus.addHandler(DeleteResourceEvent.TYPE, new DeleteResourceEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onDeletedResource(DeleteResourceEvent deleteResourceEvent) {
|
||||
|
||||
// to delete
|
||||
ResourceElementBean toDelete = deleteResourceEvent.getResource();
|
||||
|
||||
// find it
|
||||
for(int i = 0; i < addedResources.size(); i++){
|
||||
|
||||
if(addedResources.get(i).getOriginalIdInWorkspace().equals(toDelete.getOriginalIdInWorkspace())){
|
||||
|
||||
// get the associated widget and remove it
|
||||
final Widget widget = addResourcesPanel.getWidget(i);
|
||||
|
||||
// remote call to remove it from the dataset
|
||||
ckanServices.deleteResourceFromDataset(toDelete, new AsyncCallback<Boolean>() {
|
||||
|
||||
@Override
|
||||
public void onSuccess(Boolean result) {
|
||||
|
||||
if(result)
|
||||
widget.removeFromParent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// remove from the list
|
||||
addedResources.remove(toDelete);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import org.gcube.portlets.widgets.ckandatapublisherwidget.client.CKanPublisherService;
|
||||
//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.AddResourceEventHandler;
|
||||
//import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteResourceEvent;
|
||||
//import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.DeleteResourceEventHandler;
|
||||
//import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
|
||||
//
|
||||
//import com.github.gwtbootstrap.client.ui.Accordion;
|
||||
//import com.github.gwtbootstrap.client.ui.AccordionGroup;
|
||||
//import com.github.gwtbootstrap.client.ui.Button;
|
||||
//import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
//import com.google.gwt.core.client.GWT;
|
||||
//import com.google.gwt.event.dom.client.ClickEvent;
|
||||
//import com.google.gwt.event.dom.client.ClickHandler;
|
||||
//import com.google.gwt.event.shared.HandlerManager;
|
||||
//import com.google.gwt.uibinder.client.UiBinder;
|
||||
//import com.google.gwt.uibinder.client.UiField;
|
||||
//import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
//import com.google.gwt.user.client.ui.Composite;
|
||||
//import com.google.gwt.user.client.ui.VerticalPanel;
|
||||
//import com.google.gwt.user.client.ui.Widget;
|
||||
//
|
||||
///**
|
||||
// * A summary of the resources added by the user.
|
||||
// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
// */
|
||||
//public class AddedResourcesSummary extends Composite{
|
||||
//
|
||||
// private static AddedResourcesSummaryUiBinder uiBinder = GWT
|
||||
// .create(AddedResourcesSummaryUiBinder.class);
|
||||
//
|
||||
// interface AddedResourcesSummaryUiBinder extends
|
||||
// UiBinder<Widget, AddedResourcesSummary> {
|
||||
// }
|
||||
//
|
||||
// //Create a remote service proxy to talk to the server-side ckan service.
|
||||
// private final CKanPublisherServiceAsync ckanServices = GWT.create(CKanPublisherService.class);
|
||||
//
|
||||
// // Event bus
|
||||
// private HandlerManager eventBus;
|
||||
//
|
||||
// // list of added resources (beans)
|
||||
// List<ResourceElementBean> addedResources;
|
||||
//
|
||||
// @UiField VerticalPanel addResourcesPanel;
|
||||
//
|
||||
// public AddedResourcesSummary(HandlerManager eventBus) {
|
||||
// initWidget(uiBinder.createAndBindUi(this));
|
||||
//
|
||||
// // save bus
|
||||
// this.eventBus = eventBus;
|
||||
//
|
||||
// // bind on add resource event
|
||||
// bind();
|
||||
//
|
||||
// // init list
|
||||
// addedResources = new ArrayList<ResourceElementBean>();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Bind on add/delete resource event
|
||||
// */
|
||||
// private void bind() {
|
||||
//
|
||||
// // when a new resource is added
|
||||
// eventBus.addHandler(AddResourceEvent.TYPE, new AddResourceEventHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onAddedResource(AddResourceEvent addResourceEvent) {
|
||||
//
|
||||
// // get the resource
|
||||
// final ResourceElementBean justAddedResource = addResourceEvent.getResource();
|
||||
//
|
||||
// // Build an accordion to show resource info
|
||||
// Accordion accordion = new Accordion();
|
||||
// AccordionGroup accordionGroup = new AccordionGroup();
|
||||
// accordionGroup.setHeading("- " + justAddedResource.getName());
|
||||
// accordion.add(accordionGroup);
|
||||
//
|
||||
// // add sub-info such as url and description
|
||||
// Paragraph pUrl = new Paragraph();
|
||||
// pUrl.setText("Url : " + justAddedResource.getUrl());
|
||||
// Paragraph pDescription = new Paragraph();
|
||||
// pDescription.setText("Description : " + justAddedResource.getDescription());
|
||||
//
|
||||
// // button to delete the resource
|
||||
// Button deleteButton = new Button();
|
||||
// deleteButton.setText("Delete");
|
||||
// deleteButton.addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
//
|
||||
// eventBus.fireEvent(new DeleteResourceEvent(justAddedResource));
|
||||
//
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// // fill accordion
|
||||
// accordionGroup.add(pUrl);
|
||||
// accordionGroup.add(pDescription);
|
||||
// accordionGroup.add(deleteButton);
|
||||
//
|
||||
// // add to the list
|
||||
// addedResources.add(justAddedResource);
|
||||
//
|
||||
// // add to the panel
|
||||
// addResourcesPanel.add(accordion);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// // when the user wants to delete a resource
|
||||
// eventBus.addHandler(DeleteResourceEvent.TYPE, new DeleteResourceEventHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onDeletedResource(DeleteResourceEvent deleteResourceEvent) {
|
||||
//
|
||||
// // to delete
|
||||
// ResourceElementBean toDelete = deleteResourceEvent.getResource();
|
||||
//
|
||||
// // find it
|
||||
// for(int i = 0; i < addedResources.size(); i++){
|
||||
//
|
||||
// if(addedResources.get(i).getOriginalIdInWorkspace().equals(toDelete.getOriginalIdInWorkspace())){
|
||||
//
|
||||
// // get the associated widget and remove it
|
||||
// final Widget widget = addResourcesPanel.getWidget(i);
|
||||
//
|
||||
// // remote call to remove it from the dataset
|
||||
// ckanServices.deleteResourceFromDataset(toDelete, new AsyncCallback<Boolean>() {
|
||||
//
|
||||
// @Override
|
||||
// public void onSuccess(Boolean result) {
|
||||
//
|
||||
// if(result)
|
||||
// widget.removeFromParent();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onFailure(Throwable caught) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // remove from the list
|
||||
// addedResources.remove(toDelete);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -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"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui">
|
||||
<g:HTMLPanel>
|
||||
<h3>Added Resources</h3>
|
||||
<g:VerticalPanel ui:field="addResourcesPanel" width="100%"></g:VerticalPanel>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
</ui:UiBinder> -->
|
|
@ -1,279 +1,279 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.tags;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.gcubewidgets.client.elements.Span;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.InfoIconsLabels;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
import com.github.gwtbootstrap.client.ui.Icon;
|
||||
import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
import com.github.gwtbootstrap.client.ui.Popover;
|
||||
import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
import com.github.gwtbootstrap.client.ui.base.ListItem;
|
||||
import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.KeyCodes;
|
||||
import com.google.gwt.event.dom.client.KeyDownEvent;
|
||||
import com.google.gwt.uibinder.client.UiBinder;
|
||||
import com.google.gwt.uibinder.client.UiField;
|
||||
import com.google.gwt.uibinder.client.UiHandler;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.FlowPanel;
|
||||
import com.google.gwt.user.client.ui.FocusPanel;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* Panel for tags.
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class TagsPanel extends Composite{
|
||||
|
||||
private static TagsPanelUiBinder uiBinder = GWT
|
||||
.create(TagsPanelUiBinder.class);
|
||||
|
||||
interface TagsPanelUiBinder extends UiBinder<Widget, TagsPanel> {
|
||||
}
|
||||
|
||||
@UiField TextBox tagsEnterTextBox;
|
||||
@UiField FlowPanel tagsPanel;
|
||||
@UiField Icon infoIconTags;
|
||||
@UiField FocusPanel focusPanelTags;
|
||||
@UiField Popover popoverTags;
|
||||
@UiField ControlGroup tagsInsertGroup;
|
||||
@UiField ListBox tagsEnterListBox;
|
||||
|
||||
// regular expression for tags
|
||||
private static final String REGEX_TAG = "^[a-zA-Z0-9._-]*$";
|
||||
|
||||
// tags list
|
||||
private List<String> tagsList = new ArrayList<String>();
|
||||
|
||||
// vocabulary
|
||||
private List<String> vocabulary;
|
||||
|
||||
public TagsPanel() {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
tagsEnterListBox.setVisible(false);
|
||||
tagsList.clear();
|
||||
tagsPanel.clear();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Since we have a controlled vocabulary, we swap to a listbox with multiple selection
|
||||
* @param vocabularyTags
|
||||
*/
|
||||
public void setVocabulary(List<String> vocabularyTags) {
|
||||
|
||||
GWT.log("Vocabulary of tags is " + vocabularyTags);
|
||||
|
||||
if(vocabularyTags == null || vocabularyTags.isEmpty()){
|
||||
vocabulary = null;
|
||||
tagsEnterListBox.setVisible(false);
|
||||
tagsPanel.setVisible(true);
|
||||
tagsEnterTextBox.setVisible(true);
|
||||
}else{
|
||||
vocabulary = vocabularyTags;
|
||||
tagsEnterListBox.clear();
|
||||
tagsPanel.clear();
|
||||
tagsList.clear();
|
||||
for (String vocabularyTag : vocabularyTags) {
|
||||
tagsEnterListBox.addItem(vocabularyTag, vocabularyTag);
|
||||
}
|
||||
tagsPanel.setVisible(false);
|
||||
tagsEnterTextBox.setVisible(false);
|
||||
tagsEnterListBox.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prepare icons
|
||||
* @param popupOpenedIds
|
||||
*/
|
||||
public void prepareIcon(List<String> popupOpenedIds) {
|
||||
InfoIconsLabels.preparePopupPanelAndPopover(
|
||||
InfoIconsLabels.TAGS_INFO_ID_POPUP,
|
||||
InfoIconsLabels.TAGS_INFO_TEXT,
|
||||
InfoIconsLabels.TAGS_INFO_CAPTION,
|
||||
infoIconTags,
|
||||
popoverTags,
|
||||
focusPanelTags,
|
||||
popupOpenedIds
|
||||
);
|
||||
}
|
||||
|
||||
@UiHandler("tagsEnterTextBox")
|
||||
void onAddTag(KeyDownEvent event){
|
||||
|
||||
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
|
||||
if (!tagsEnterTextBox.getValue().trim().isEmpty()) {
|
||||
|
||||
addTagElement(tagsEnterTextBox);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the tag as an element (inserted by the user)
|
||||
*/
|
||||
private void addTagElement(TextBox itemBox){
|
||||
|
||||
if (itemBox.getValue() != null && !itemBox.getValue().trim().isEmpty()) {
|
||||
|
||||
if(tagsList.contains(itemBox.getValue().trim())){
|
||||
itemBox.setValue("");
|
||||
return;
|
||||
}
|
||||
|
||||
// ckan accepts only alphanumeric values
|
||||
String[] subTags = itemBox.getValue().trim().split(" ");
|
||||
if(subTags.length == 1){
|
||||
if(!subTags[0].matches(REGEX_TAG))
|
||||
return;
|
||||
if(subTags[0].length() <= 1)
|
||||
return;
|
||||
}else{
|
||||
for (int i = 0; i < subTags.length; i++) {
|
||||
String subTag = subTags[i];
|
||||
if(!subTag.matches(REGEX_TAG))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final String value = itemBox.getValue().trim();
|
||||
final ListItem displayItem = new ListItem();
|
||||
displayItem.setStyleName("tag-style");
|
||||
Span tagText = new Span(itemBox.getValue());
|
||||
|
||||
Span tagRemove = new Span("x");
|
||||
tagRemove.setTitle("Remove this tag");
|
||||
tagRemove.addClickHandler(new ClickHandler() {
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
removeTag(displayItem, value);
|
||||
}
|
||||
});
|
||||
|
||||
tagRemove.setStyleName("tag-style-x");
|
||||
displayItem.add(tagText);
|
||||
displayItem.add(tagRemove);
|
||||
itemBox.setValue("");
|
||||
itemBox.setFocus(true);
|
||||
tagsPanel.add(displayItem);
|
||||
tagsList.add(value);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the tag as an element (when publishing from workspace)
|
||||
*/
|
||||
public void addTagElement(final String tag){
|
||||
|
||||
if(tagsList.contains(tag))
|
||||
return;
|
||||
|
||||
// ckan accepts only alphanumeric values
|
||||
String[] subTags = tag.trim().split(" ");
|
||||
if(subTags.length == 1){
|
||||
if(!subTags[0].matches(REGEX_TAG))
|
||||
return;
|
||||
if(subTags[0].length() <= 1)
|
||||
return;
|
||||
}else{
|
||||
for (int i = 0; i < subTags.length; i++) {
|
||||
String subTag = subTags[i];
|
||||
if(!subTag.matches(REGEX_TAG))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final ListItem displayItem = new ListItem();
|
||||
displayItem.setStyleName("tag-style");
|
||||
Span p = new Span(tag);
|
||||
|
||||
Span span = new Span("x");
|
||||
span.setTitle("Remove this tag");
|
||||
span.addClickHandler(new ClickHandler() {
|
||||
public void onClick(ClickEvent clickEvent) {
|
||||
removeTag(displayItem, tag);
|
||||
}
|
||||
});
|
||||
|
||||
span.setStyleName("tag-style-x");
|
||||
displayItem.add(p);
|
||||
displayItem.add(span);
|
||||
tagsPanel.add(displayItem);
|
||||
tagsList.add(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a tag from the list
|
||||
* @param displayItem
|
||||
*/
|
||||
private void removeTag(ListItem displayItem, String value) {
|
||||
|
||||
tagsList.remove(value.trim());
|
||||
tagsPanel.remove(displayItem);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all inserted tags
|
||||
*/
|
||||
public void removeTags(){
|
||||
|
||||
tagsList.clear();
|
||||
tagsPanel.clear();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the tag list
|
||||
* @return
|
||||
*/
|
||||
public List<String> getTags() {
|
||||
|
||||
if(vocabulary == null){
|
||||
return tagsList;
|
||||
}else{
|
||||
|
||||
List<String> selected = new ArrayList<String>();
|
||||
for(int i = 0; i < tagsEnterListBox.getItemCount(); i++){
|
||||
if(tagsEnterListBox.isItemSelected(i))
|
||||
selected.add(tagsEnterListBox.getItemText(i));
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Freeze tags
|
||||
*/
|
||||
public void freeze() {
|
||||
tagsEnterTextBox.setEnabled(false);
|
||||
tagsEnterListBox.setEnabled(false);
|
||||
for(int i = 0; i < tagsList.size(); i++){
|
||||
|
||||
// get tag widget
|
||||
ListItem tagWidget = (ListItem)tagsPanel.getWidget(i);
|
||||
|
||||
// get the "x" span
|
||||
tagWidget.getWidget(1).removeFromParent();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the tag group panel type
|
||||
* @param none
|
||||
*/
|
||||
public void setGroupPanelType(ControlGroupType type) {
|
||||
tagsInsertGroup.setType(type);
|
||||
}
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.tags;
|
||||
//
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import org.gcube.portlets.user.gcubewidgets.client.elements.Span;
|
||||
//import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.InfoIconsLabels;
|
||||
//
|
||||
//import com.github.gwtbootstrap.client.ui.ControlGroup;
|
||||
//import com.github.gwtbootstrap.client.ui.Icon;
|
||||
//import com.github.gwtbootstrap.client.ui.ListBox;
|
||||
//import com.github.gwtbootstrap.client.ui.Popover;
|
||||
//import com.github.gwtbootstrap.client.ui.TextBox;
|
||||
//import com.github.gwtbootstrap.client.ui.base.ListItem;
|
||||
//import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
|
||||
//import com.google.gwt.core.client.GWT;
|
||||
//import com.google.gwt.event.dom.client.ClickEvent;
|
||||
//import com.google.gwt.event.dom.client.ClickHandler;
|
||||
//import com.google.gwt.event.dom.client.KeyCodes;
|
||||
//import com.google.gwt.event.dom.client.KeyDownEvent;
|
||||
//import com.google.gwt.uibinder.client.UiBinder;
|
||||
//import com.google.gwt.uibinder.client.UiField;
|
||||
//import com.google.gwt.uibinder.client.UiHandler;
|
||||
//import com.google.gwt.user.client.ui.Composite;
|
||||
//import com.google.gwt.user.client.ui.FlowPanel;
|
||||
//import com.google.gwt.user.client.ui.FocusPanel;
|
||||
//import com.google.gwt.user.client.ui.Widget;
|
||||
//
|
||||
///**
|
||||
// * Panel for tags.
|
||||
// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
// */
|
||||
//public class TagsPanel extends Composite{
|
||||
//
|
||||
// private static TagsPanelUiBinder uiBinder = GWT
|
||||
// .create(TagsPanelUiBinder.class);
|
||||
//
|
||||
// interface TagsPanelUiBinder extends UiBinder<Widget, TagsPanel> {
|
||||
// }
|
||||
//
|
||||
// @UiField TextBox tagsEnterTextBox;
|
||||
// @UiField FlowPanel tagsPanel;
|
||||
// @UiField Icon infoIconTags;
|
||||
// @UiField FocusPanel focusPanelTags;
|
||||
// @UiField Popover popoverTags;
|
||||
// @UiField ControlGroup tagsInsertGroup;
|
||||
// @UiField ListBox tagsEnterListBox;
|
||||
//
|
||||
// // regular expression for tags
|
||||
// private static final String REGEX_TAG = "^[a-zA-Z0-9._-]*$";
|
||||
//
|
||||
// // tags list
|
||||
// private List<String> tagsList = new ArrayList<String>();
|
||||
//
|
||||
// // vocabulary
|
||||
// private List<String> vocabulary;
|
||||
//
|
||||
// public TagsPanel() {
|
||||
// initWidget(uiBinder.createAndBindUi(this));
|
||||
// tagsEnterListBox.setVisible(false);
|
||||
// tagsList.clear();
|
||||
// tagsPanel.clear();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Since we have a controlled vocabulary, we swap to a listbox with multiple selection
|
||||
// * @param vocabularyTags
|
||||
// */
|
||||
// public void setVocabulary(List<String> vocabularyTags) {
|
||||
//
|
||||
// GWT.log("Vocabulary of tags is " + vocabularyTags);
|
||||
//
|
||||
// if(vocabularyTags == null || vocabularyTags.isEmpty()){
|
||||
// vocabulary = null;
|
||||
// tagsEnterListBox.setVisible(false);
|
||||
// tagsPanel.setVisible(true);
|
||||
// tagsEnterTextBox.setVisible(true);
|
||||
// }else{
|
||||
// vocabulary = vocabularyTags;
|
||||
// tagsEnterListBox.clear();
|
||||
// tagsPanel.clear();
|
||||
// tagsList.clear();
|
||||
// for (String vocabularyTag : vocabularyTags) {
|
||||
// tagsEnterListBox.addItem(vocabularyTag, vocabularyTag);
|
||||
// }
|
||||
// tagsPanel.setVisible(false);
|
||||
// tagsEnterTextBox.setVisible(false);
|
||||
// tagsEnterListBox.setVisible(true);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Prepare icons
|
||||
// * @param popupOpenedIds
|
||||
// */
|
||||
// public void prepareIcon(List<String> popupOpenedIds) {
|
||||
// InfoIconsLabels.preparePopupPanelAndPopover(
|
||||
// InfoIconsLabels.TAGS_INFO_ID_POPUP,
|
||||
// InfoIconsLabels.TAGS_INFO_TEXT,
|
||||
// InfoIconsLabels.TAGS_INFO_CAPTION,
|
||||
// infoIconTags,
|
||||
// popoverTags,
|
||||
// focusPanelTags,
|
||||
// popupOpenedIds
|
||||
// );
|
||||
// }
|
||||
//
|
||||
// @UiHandler("tagsEnterTextBox")
|
||||
// void onAddTag(KeyDownEvent event){
|
||||
//
|
||||
// if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
|
||||
// if (!tagsEnterTextBox.getValue().trim().isEmpty()) {
|
||||
//
|
||||
// addTagElement(tagsEnterTextBox);
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Add the tag as an element (inserted by the user)
|
||||
// */
|
||||
// private void addTagElement(TextBox itemBox){
|
||||
//
|
||||
// if (itemBox.getValue() != null && !itemBox.getValue().trim().isEmpty()) {
|
||||
//
|
||||
// if(tagsList.contains(itemBox.getValue().trim())){
|
||||
// itemBox.setValue("");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// // ckan accepts only alphanumeric values
|
||||
// String[] subTags = itemBox.getValue().trim().split(" ");
|
||||
// if(subTags.length == 1){
|
||||
// if(!subTags[0].matches(REGEX_TAG))
|
||||
// return;
|
||||
// if(subTags[0].length() <= 1)
|
||||
// return;
|
||||
// }else{
|
||||
// for (int i = 0; i < subTags.length; i++) {
|
||||
// String subTag = subTags[i];
|
||||
// if(!subTag.matches(REGEX_TAG))
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// final String value = itemBox.getValue().trim();
|
||||
// final ListItem displayItem = new ListItem();
|
||||
// displayItem.setStyleName("tag-style");
|
||||
// Span tagText = new Span(itemBox.getValue());
|
||||
//
|
||||
// Span tagRemove = new Span("x");
|
||||
// tagRemove.setTitle("Remove this tag");
|
||||
// tagRemove.addClickHandler(new ClickHandler() {
|
||||
// public void onClick(ClickEvent clickEvent) {
|
||||
// removeTag(displayItem, value);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// tagRemove.setStyleName("tag-style-x");
|
||||
// displayItem.add(tagText);
|
||||
// displayItem.add(tagRemove);
|
||||
// itemBox.setValue("");
|
||||
// itemBox.setFocus(true);
|
||||
// tagsPanel.add(displayItem);
|
||||
// tagsList.add(value);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Add the tag as an element (when publishing from workspace)
|
||||
// */
|
||||
// public void addTagElement(final String tag){
|
||||
//
|
||||
// if(tagsList.contains(tag))
|
||||
// return;
|
||||
//
|
||||
// // ckan accepts only alphanumeric values
|
||||
// String[] subTags = tag.trim().split(" ");
|
||||
// if(subTags.length == 1){
|
||||
// if(!subTags[0].matches(REGEX_TAG))
|
||||
// return;
|
||||
// if(subTags[0].length() <= 1)
|
||||
// return;
|
||||
// }else{
|
||||
// for (int i = 0; i < subTags.length; i++) {
|
||||
// String subTag = subTags[i];
|
||||
// if(!subTag.matches(REGEX_TAG))
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// final ListItem displayItem = new ListItem();
|
||||
// displayItem.setStyleName("tag-style");
|
||||
// Span p = new Span(tag);
|
||||
//
|
||||
// Span span = new Span("x");
|
||||
// span.setTitle("Remove this tag");
|
||||
// span.addClickHandler(new ClickHandler() {
|
||||
// public void onClick(ClickEvent clickEvent) {
|
||||
// removeTag(displayItem, tag);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// span.setStyleName("tag-style-x");
|
||||
// displayItem.add(p);
|
||||
// displayItem.add(span);
|
||||
// tagsPanel.add(displayItem);
|
||||
// tagsList.add(tag);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Remove a tag from the list
|
||||
// * @param displayItem
|
||||
// */
|
||||
// private void removeTag(ListItem displayItem, String value) {
|
||||
//
|
||||
// tagsList.remove(value.trim());
|
||||
// tagsPanel.remove(displayItem);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Remove all inserted tags
|
||||
// */
|
||||
// public void removeTags(){
|
||||
//
|
||||
// tagsList.clear();
|
||||
// tagsPanel.clear();
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Return the tag list
|
||||
// * @return
|
||||
// */
|
||||
// public List<String> getTags() {
|
||||
//
|
||||
// if(vocabulary == null){
|
||||
// return tagsList;
|
||||
// }else{
|
||||
//
|
||||
// List<String> selected = new ArrayList<String>();
|
||||
// for(int i = 0; i < tagsEnterListBox.getItemCount(); i++){
|
||||
// if(tagsEnterListBox.isItemSelected(i))
|
||||
// selected.add(tagsEnterListBox.getItemText(i));
|
||||
// }
|
||||
// return selected;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Freeze tags
|
||||
// */
|
||||
// public void freeze() {
|
||||
// tagsEnterTextBox.setEnabled(false);
|
||||
// tagsEnterListBox.setEnabled(false);
|
||||
// for(int i = 0; i < tagsList.size(); i++){
|
||||
//
|
||||
// // get tag widget
|
||||
// ListItem tagWidget = (ListItem)tagsPanel.getWidget(i);
|
||||
//
|
||||
// // get the "x" span
|
||||
// tagWidget.getWidget(1).removeFromParent();
|
||||
//
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Set the tag group panel type
|
||||
// * @param none
|
||||
// */
|
||||
// public void setGroupPanelType(ControlGroupType type) {
|
||||
// tagsInsertGroup.setType(type);
|
||||
// }
|
||||
//}
|
|
@ -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"
|
||||
xmlns:g="urn:import:com.google.gwt.user.client.ui" xmlns:b="urn:import:com.github.gwtbootstrap.client.ui">
|
||||
<ui:style>
|
||||
|
@ -33,4 +33,4 @@
|
|||
</b:Controls>
|
||||
</b:ControlGroup>
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
</ui:UiBinder> -->
|
|
@ -1,155 +1,155 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils;
|
||||
|
||||
import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace.ResourceInfoForm;
|
||||
|
||||
import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
import com.google.gwt.core.shared.GWT;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.EventTarget;
|
||||
import com.google.gwt.dom.client.Style.Cursor;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
import com.google.gwt.event.dom.client.ClickHandler;
|
||||
import com.google.gwt.event.dom.client.DoubleClickEvent;
|
||||
import com.google.gwt.event.dom.client.DoubleClickHandler;
|
||||
import com.google.gwt.user.client.ui.Anchor;
|
||||
import com.google.gwt.user.client.ui.FlexTable;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
|
||||
/**
|
||||
* Extended version of the GcubeDialog with close symbol on the caption
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class GcubeDialogExtended extends GCubeDialog {
|
||||
|
||||
/**
|
||||
* For simple information
|
||||
* @param captionText
|
||||
* @param text
|
||||
*/
|
||||
public GcubeDialogExtended(String captionText, String text){
|
||||
|
||||
// add custom style
|
||||
addStyleName("metadata-popup-panel");
|
||||
|
||||
// create an anchor to close the dialogbox
|
||||
final Anchor closeAnchor = new Anchor("x");
|
||||
closeAnchor.setTitle("Close");
|
||||
|
||||
// create a panel that will be put into the caption
|
||||
FlexTable captionLayoutTable = new FlexTable();
|
||||
captionLayoutTable.setText(0, 0, captionText);
|
||||
captionLayoutTable.setWidget(0, 3, closeAnchor);
|
||||
captionLayoutTable.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);
|
||||
captionLayoutTable.setWidth("100%");
|
||||
HTML caption = (HTML) getCaption();
|
||||
caption.getElement().getStyle().setCursor(Cursor.MOVE);
|
||||
caption.getElement().appendChild(captionLayoutTable.getElement());
|
||||
caption.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
// get the event
|
||||
EventTarget target = event.getNativeEvent().getEventTarget();
|
||||
Element targetElement = (Element) target.cast();
|
||||
|
||||
// fire the event to the anchor
|
||||
if (targetElement == closeAnchor.getElement()) {
|
||||
closeAnchor.fireEvent(event);
|
||||
}
|
||||
}
|
||||
});
|
||||
closeAnchor.addClickHandler(new ClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
add(new Paragraph(text));
|
||||
}
|
||||
|
||||
/**
|
||||
* For simple information
|
||||
* @param captionText
|
||||
* @param text
|
||||
*/
|
||||
public GcubeDialogExtended(final ResourceInfoForm form){
|
||||
|
||||
// add custom style
|
||||
addStyleName("metadata-popup-panel");
|
||||
|
||||
// create an anchor to close the dialogbox
|
||||
final Anchor closeAnchor = new Anchor("x");
|
||||
closeAnchor.setTitle("Close");
|
||||
closeAnchor.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
hide();
|
||||
}
|
||||
});
|
||||
|
||||
// create a panel that will be put into the caption
|
||||
FlexTable captionLayoutTable = new FlexTable();
|
||||
captionLayoutTable.setText(0, 0, "About Resource");
|
||||
captionLayoutTable.setWidget(0, 3, closeAnchor);
|
||||
captionLayoutTable.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);
|
||||
captionLayoutTable.setWidth("100%");
|
||||
HTML caption = (HTML) getCaption();
|
||||
caption.getElement().getStyle().setCursor(Cursor.MOVE);
|
||||
caption.getElement().appendChild(captionLayoutTable.getElement());
|
||||
caption.addClickHandler(new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
EventTarget target = event.getNativeEvent().getEventTarget();
|
||||
Element targetElement = (Element) target.cast();
|
||||
if (targetElement == closeAnchor.getElement()) {
|
||||
closeAnchor.fireEvent(event);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
setWidget(form);
|
||||
Widget widget = getWidget();
|
||||
|
||||
ClickHandler click = new ClickHandler() {
|
||||
@Override
|
||||
public void onClick(ClickEvent event) {
|
||||
EventTarget target = event.getNativeEvent().getEventTarget();
|
||||
Element targetElement = (Element) target.cast();
|
||||
GWT.log("Target elem is " + targetElement);
|
||||
if (targetElement == form.resourceDescription.getElement()) {
|
||||
GWT.log("Fired click");
|
||||
form.resourceDescription.fireEvent(event);
|
||||
}else if (targetElement == form.resourceName.getElement()) {
|
||||
GWT.log("Fired click");
|
||||
form.resourceName.fireEvent(event);
|
||||
}else if(targetElement == form.getElement()){
|
||||
form.fireEvent(event);
|
||||
}
|
||||
}
|
||||
};
|
||||
widget.addDomHandler(click, ClickEvent.getType());
|
||||
|
||||
widget.addDomHandler(new DoubleClickHandler() {
|
||||
|
||||
@Override
|
||||
public void onDoubleClick(DoubleClickEvent event) {
|
||||
EventTarget target = event.getNativeEvent().getEventTarget();
|
||||
Element targetElement = (Element) target.cast();
|
||||
GWT.log("Target elem is " + targetElement);
|
||||
if (targetElement == form.resourceDescription.getElement()) {
|
||||
GWT.log("Fired click");
|
||||
form.resourceDescription.fireEvent(event);
|
||||
}else if (targetElement == form.resourceName.getElement()) {
|
||||
GWT.log("Fired click");
|
||||
form.resourceName.fireEvent(event);
|
||||
}else if(targetElement == form.getElement()){
|
||||
form.fireEvent(event);
|
||||
}
|
||||
}
|
||||
}, DoubleClickEvent.getType());
|
||||
}
|
||||
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils;
|
||||
//
|
||||
//import org.gcube.portlets.user.gcubewidgets.client.popup.GCubeDialog;
|
||||
//import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace.ResourceInfoForm;
|
||||
//
|
||||
//import com.github.gwtbootstrap.client.ui.Paragraph;
|
||||
//import com.google.gwt.core.shared.GWT;
|
||||
//import com.google.gwt.dom.client.Element;
|
||||
//import com.google.gwt.dom.client.EventTarget;
|
||||
//import com.google.gwt.dom.client.Style.Cursor;
|
||||
//import com.google.gwt.event.dom.client.ClickEvent;
|
||||
//import com.google.gwt.event.dom.client.ClickHandler;
|
||||
//import com.google.gwt.event.dom.client.DoubleClickEvent;
|
||||
//import com.google.gwt.event.dom.client.DoubleClickHandler;
|
||||
//import com.google.gwt.user.client.ui.Anchor;
|
||||
//import com.google.gwt.user.client.ui.FlexTable;
|
||||
//import com.google.gwt.user.client.ui.HTML;
|
||||
//import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
||||
//import com.google.gwt.user.client.ui.Widget;
|
||||
//
|
||||
///**
|
||||
// * Extended version of the GcubeDialog with close symbol on the caption
|
||||
// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
// */
|
||||
//public class GcubeDialogExtended extends GCubeDialog {
|
||||
//
|
||||
// /**
|
||||
// * For simple information
|
||||
// * @param captionText
|
||||
// * @param text
|
||||
// */
|
||||
// public GcubeDialogExtended(String captionText, String text){
|
||||
//
|
||||
// // add custom style
|
||||
// addStyleName("metadata-popup-panel");
|
||||
//
|
||||
// // create an anchor to close the dialogbox
|
||||
// final Anchor closeAnchor = new Anchor("x");
|
||||
// closeAnchor.setTitle("Close");
|
||||
//
|
||||
// // create a panel that will be put into the caption
|
||||
// FlexTable captionLayoutTable = new FlexTable();
|
||||
// captionLayoutTable.setText(0, 0, captionText);
|
||||
// captionLayoutTable.setWidget(0, 3, closeAnchor);
|
||||
// captionLayoutTable.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);
|
||||
// captionLayoutTable.setWidth("100%");
|
||||
// HTML caption = (HTML) getCaption();
|
||||
// caption.getElement().getStyle().setCursor(Cursor.MOVE);
|
||||
// caption.getElement().appendChild(captionLayoutTable.getElement());
|
||||
// caption.addClickHandler(new ClickHandler() {
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// // get the event
|
||||
// EventTarget target = event.getNativeEvent().getEventTarget();
|
||||
// Element targetElement = (Element) target.cast();
|
||||
//
|
||||
// // fire the event to the anchor
|
||||
// if (targetElement == closeAnchor.getElement()) {
|
||||
// closeAnchor.fireEvent(event);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
// closeAnchor.addClickHandler(new ClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// hide();
|
||||
// }
|
||||
// });
|
||||
// add(new Paragraph(text));
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * For simple information
|
||||
// * @param captionText
|
||||
// * @param text
|
||||
// */
|
||||
// public GcubeDialogExtended(final ResourceInfoForm form){
|
||||
//
|
||||
// // add custom style
|
||||
// addStyleName("metadata-popup-panel");
|
||||
//
|
||||
// // create an anchor to close the dialogbox
|
||||
// final Anchor closeAnchor = new Anchor("x");
|
||||
// closeAnchor.setTitle("Close");
|
||||
// closeAnchor.addClickHandler(new ClickHandler() {
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// hide();
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// // create a panel that will be put into the caption
|
||||
// FlexTable captionLayoutTable = new FlexTable();
|
||||
// captionLayoutTable.setText(0, 0, "About Resource");
|
||||
// captionLayoutTable.setWidget(0, 3, closeAnchor);
|
||||
// captionLayoutTable.getCellFormatter().setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);
|
||||
// captionLayoutTable.setWidth("100%");
|
||||
// HTML caption = (HTML) getCaption();
|
||||
// caption.getElement().getStyle().setCursor(Cursor.MOVE);
|
||||
// caption.getElement().appendChild(captionLayoutTable.getElement());
|
||||
// caption.addClickHandler(new ClickHandler() {
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// EventTarget target = event.getNativeEvent().getEventTarget();
|
||||
// Element targetElement = (Element) target.cast();
|
||||
// if (targetElement == closeAnchor.getElement()) {
|
||||
// closeAnchor.fireEvent(event);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// setWidget(form);
|
||||
// Widget widget = getWidget();
|
||||
//
|
||||
// ClickHandler click = new ClickHandler() {
|
||||
// @Override
|
||||
// public void onClick(ClickEvent event) {
|
||||
// EventTarget target = event.getNativeEvent().getEventTarget();
|
||||
// Element targetElement = (Element) target.cast();
|
||||
// GWT.log("Target elem is " + targetElement);
|
||||
// if (targetElement == form.resourceDescription.getElement()) {
|
||||
// GWT.log("Fired click");
|
||||
// form.resourceDescription.fireEvent(event);
|
||||
// }else if (targetElement == form.resourceName.getElement()) {
|
||||
// GWT.log("Fired click");
|
||||
// form.resourceName.fireEvent(event);
|
||||
// }else if(targetElement == form.getElement()){
|
||||
// form.fireEvent(event);
|
||||
// }
|
||||
// }
|
||||
// };
|
||||
// widget.addDomHandler(click, ClickEvent.getType());
|
||||
//
|
||||
// widget.addDomHandler(new DoubleClickHandler() {
|
||||
//
|
||||
// @Override
|
||||
// public void onDoubleClick(DoubleClickEvent event) {
|
||||
// EventTarget target = event.getNativeEvent().getEventTarget();
|
||||
// Element targetElement = (Element) target.cast();
|
||||
// GWT.log("Target elem is " + targetElement);
|
||||
// if (targetElement == form.resourceDescription.getElement()) {
|
||||
// GWT.log("Fired click");
|
||||
// form.resourceDescription.fireEvent(event);
|
||||
// }else if (targetElement == form.resourceName.getElement()) {
|
||||
// GWT.log("Fired click");
|
||||
// form.resourceName.fireEvent(event);
|
||||
// }else if(targetElement == form.getElement()){
|
||||
// form.fireEvent(event);
|
||||
// }
|
||||
// }
|
||||
// }, DoubleClickEvent.getType());
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -2,6 +2,8 @@ package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils;
|
|||
|
||||
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.Popover;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
|
|
|
@ -1,62 +1,62 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils;
|
||||
|
||||
|
||||
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.HorizontalPanel;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
|
||||
/**
|
||||
* The Class LoaderIcon.
|
||||
*
|
||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
* Feb 19, 2015
|
||||
*/
|
||||
public class LoaderIcon extends HorizontalPanel{
|
||||
|
||||
|
||||
private Image imgLoading = new Image(Images.ICONS.loading());
|
||||
private HTML txtLoading = new HTML("");
|
||||
|
||||
/**
|
||||
* Instantiates a new loader icon.
|
||||
*
|
||||
* @param txtHTML the txt html
|
||||
*/
|
||||
public LoaderIcon(String txtHTML) {
|
||||
this();
|
||||
setText(txtHTML);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new loader icon.
|
||||
*/
|
||||
public LoaderIcon() {
|
||||
setStyleName("marginTop20");
|
||||
add(imgLoading);
|
||||
add(txtLoading);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text.
|
||||
*
|
||||
* @param txtHTML the new text
|
||||
*/
|
||||
public void setText(String txtHTML){
|
||||
txtLoading.setHTML("<span style=\"margin-left:5px; vertical-align:middle;\">"+txtHTML+"</span>");
|
||||
}
|
||||
|
||||
/**
|
||||
* Show.
|
||||
*
|
||||
* @param bool the bool
|
||||
*/
|
||||
public void show(boolean bool){
|
||||
this.setVisible(bool);
|
||||
}
|
||||
|
||||
}
|
||||
///**
|
||||
// *
|
||||
// */
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils;
|
||||
//
|
||||
//
|
||||
//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.HorizontalPanel;
|
||||
//import com.google.gwt.user.client.ui.Image;
|
||||
//
|
||||
///**
|
||||
// * The Class LoaderIcon.
|
||||
// *
|
||||
// * @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
||||
// * Feb 19, 2015
|
||||
// */
|
||||
//public class LoaderIcon extends HorizontalPanel{
|
||||
//
|
||||
//
|
||||
// private Image imgLoading = new Image(Images.ICONS.loading());
|
||||
// private HTML txtLoading = new HTML("");
|
||||
//
|
||||
// /**
|
||||
// * Instantiates a new loader icon.
|
||||
// *
|
||||
// * @param txtHTML the txt html
|
||||
// */
|
||||
// public LoaderIcon(String txtHTML) {
|
||||
// this();
|
||||
// setText(txtHTML);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Instantiates a new loader icon.
|
||||
// */
|
||||
// public LoaderIcon() {
|
||||
// setStyleName("marginTop20");
|
||||
// add(imgLoading);
|
||||
// add(txtLoading);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the text.
|
||||
// *
|
||||
// * @param txtHTML the new text
|
||||
// */
|
||||
// public void setText(String txtHTML){
|
||||
// txtLoading.setHTML("<span style=\"margin-left:5px; vertical-align:middle;\">"+txtHTML+"</span>");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Show.
|
||||
// *
|
||||
// * @param bool the bool
|
||||
// */
|
||||
// public void show(boolean bool){
|
||||
// this.setVisible(bool);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -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.OrganizationBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.ResourceElementBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses.LicenseBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetaDataProfileBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.license.LicenseBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||
import org.gcube.vomanagement.usermanagement.GroupManager;
|
||||
import org.gcube.vomanagement.usermanagement.UserManager;
|
||||
import org.gcube.vomanagement.usermanagement.exception.GroupRetrievalFault;
|
||||
|
|
|
@ -21,13 +21,13 @@ import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataVocabulary;
|
|||
import org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.NamespaceCategory;
|
||||
import org.gcube.datacatalogue.utillibrary.server.utils.CatalogueUtilMethods;
|
||||
import org.gcube.datacatalogue.utillibrary.server.utils.SessionCatalogueAttributes;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.CategoryWrapper;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.DataTypeWrapper;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.FieldAsGroup;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.FieldAsTag;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetaDataProfileBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.MetadataFieldWrapper;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.TaggingGroupingValue;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.CategoryWrapper;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.DataTypeWrapper;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.FieldAsGroup;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.FieldAsTag;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetaDataProfileBean;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.MetadataFieldWrapper;
|
||||
import org.gcube.portlets.widgets.mpformbuilder.shared.metadata.TaggingGroupingValue;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.io.Serializable;
|
|||
import java.util.List;
|
||||
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;
|
||||
|
||||
|
|
|
@ -1,52 +1,52 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* A license bean like the ckan's one.
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class LicenseBean implements Serializable, IsSerializable{
|
||||
|
||||
private static final long serialVersionUID = -2079275598877326206L;
|
||||
private String title;
|
||||
private String url;
|
||||
|
||||
public LicenseBean() {
|
||||
super();
|
||||
}
|
||||
|
||||
public LicenseBean(String title, String url) {
|
||||
super();
|
||||
this.title = title;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
return obj.getClass().equals(this.getClass()) && ((LicenseBean)obj).getTitle().equals(this.title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LicenseBean [title=" + title + ", url=" + url + "]";
|
||||
}
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.licenses;
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//
|
||||
//import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
//
|
||||
///**
|
||||
// * A license bean like the ckan's one.
|
||||
// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
// */
|
||||
//public class LicenseBean implements Serializable, IsSerializable{
|
||||
//
|
||||
// private static final long serialVersionUID = -2079275598877326206L;
|
||||
// private String title;
|
||||
// private String url;
|
||||
//
|
||||
// public LicenseBean() {
|
||||
// super();
|
||||
// }
|
||||
//
|
||||
// public LicenseBean(String title, String url) {
|
||||
// super();
|
||||
// this.title = title;
|
||||
// this.url = url;
|
||||
// }
|
||||
//
|
||||
// public String getTitle() {
|
||||
// return title;
|
||||
// }
|
||||
//
|
||||
// public void setTitle(String title) {
|
||||
// this.title = title;
|
||||
// }
|
||||
//
|
||||
// public String getUrl() {
|
||||
// return url;
|
||||
// }
|
||||
//
|
||||
// public void setUrl(String url) {
|
||||
// this.url = url;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean equals(Object obj) {
|
||||
// return obj.getClass().equals(this.getClass()) && ((LicenseBean)obj).getTitle().equals(this.title);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return "LicenseBean [title=" + title + ", url=" + url + "]";
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,77 +1,77 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* A wrapper for the MetadataCategory class.
|
||||
* @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataCategory
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class CategoryWrapper implements Serializable, IsSerializable{
|
||||
|
||||
private static final long serialVersionUID = -1949961285656672831L;
|
||||
private String id;
|
||||
private String title;
|
||||
private String description;
|
||||
private List<MetadataFieldWrapper> fieldsForThisCategory;
|
||||
|
||||
public CategoryWrapper() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CategoryWrapper(String id, String title, String description) {
|
||||
super();
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public List<MetadataFieldWrapper> getFieldsForThisCategory() {
|
||||
return fieldsForThisCategory;
|
||||
}
|
||||
|
||||
public void setFieldsForThisCategory(
|
||||
List<MetadataFieldWrapper> fieldsForThisCategory) {
|
||||
this.fieldsForThisCategory = fieldsForThisCategory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CategoryWrapper ["
|
||||
+ (id != null ? "id=" + id + ", " : "")
|
||||
+ (title != null ? "title=" + title + ", " : "")
|
||||
+ (description != null ? "description=" + description + ", "
|
||||
: "")
|
||||
+ (fieldsForThisCategory != null ? "fieldsForThisCategory="
|
||||
+ fieldsForThisCategory.size() : "") + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
//
|
||||
///**
|
||||
// * A wrapper for the MetadataCategory class.
|
||||
// * @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataCategory
|
||||
// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
// */
|
||||
//public class CategoryWrapper implements Serializable, IsSerializable{
|
||||
//
|
||||
// private static final long serialVersionUID = -1949961285656672831L;
|
||||
// private String id;
|
||||
// private String title;
|
||||
// private String description;
|
||||
// private List<MetadataFieldWrapper> fieldsForThisCategory;
|
||||
//
|
||||
// public CategoryWrapper() {
|
||||
// super();
|
||||
// }
|
||||
//
|
||||
// public CategoryWrapper(String id, String title, String description) {
|
||||
// super();
|
||||
// this.id = id;
|
||||
// this.title = title;
|
||||
// this.description = description;
|
||||
// }
|
||||
//
|
||||
// public String getId() {
|
||||
// return id;
|
||||
// }
|
||||
//
|
||||
// public void setId(String id) {
|
||||
// this.id = id;
|
||||
// }
|
||||
//
|
||||
// public String getTitle() {
|
||||
// return title;
|
||||
// }
|
||||
//
|
||||
// public void setTitle(String title) {
|
||||
// this.title = title;
|
||||
// }
|
||||
//
|
||||
// public String getDescription() {
|
||||
// return description;
|
||||
// }
|
||||
//
|
||||
// public void setDescription(String description) {
|
||||
// this.description = description;
|
||||
// }
|
||||
//
|
||||
// public List<MetadataFieldWrapper> getFieldsForThisCategory() {
|
||||
// return fieldsForThisCategory;
|
||||
// }
|
||||
//
|
||||
// public void setFieldsForThisCategory(
|
||||
// List<MetadataFieldWrapper> fieldsForThisCategory) {
|
||||
// this.fieldsForThisCategory = fieldsForThisCategory;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return "CategoryWrapper ["
|
||||
// + (id != null ? "id=" + id + ", " : "")
|
||||
// + (title != null ? "title=" + title + ", " : "")
|
||||
// + (description != null ? "description=" + description + ", "
|
||||
// : "")
|
||||
// + (fieldsForThisCategory != null ? "fieldsForThisCategory="
|
||||
// + fieldsForThisCategory.size() : "") + "]";
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
|
||||
/**
|
||||
* Data type.
|
||||
* @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.DataType
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public enum DataTypeWrapper {
|
||||
|
||||
String,
|
||||
Time,
|
||||
Time_Interval,
|
||||
Times_ListOf,
|
||||
Text,
|
||||
Boolean,
|
||||
Number,
|
||||
GeoJSON;
|
||||
|
||||
/**
|
||||
* Value as String.
|
||||
* @return the string
|
||||
*/
|
||||
public String value() {
|
||||
return name();
|
||||
}
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
//
|
||||
///**
|
||||
// * Data type.
|
||||
// * @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.DataType
|
||||
// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
// */
|
||||
//public enum DataTypeWrapper {
|
||||
//
|
||||
// String,
|
||||
// Time,
|
||||
// Time_Interval,
|
||||
// Times_ListOf,
|
||||
// Text,
|
||||
// Boolean,
|
||||
// Number,
|
||||
// GeoJSON;
|
||||
//
|
||||
// /**
|
||||
// * Value as String.
|
||||
// * @return the string
|
||||
// */
|
||||
// public String value() {
|
||||
// return name();
|
||||
// }
|
||||
//}
|
||||
|
|
|
@ -1,62 +1,62 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* To be used when a field must be used to create a group.
|
||||
* @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataGrouping
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class FieldAsGroup implements Serializable, IsSerializable{
|
||||
|
||||
private static final long serialVersionUID = 8096886403417944385L;
|
||||
private boolean create;
|
||||
private boolean isPropagateUp;
|
||||
private TaggingGroupingValue groupingValue;
|
||||
|
||||
public FieldAsGroup() {
|
||||
super();
|
||||
}
|
||||
|
||||
public FieldAsGroup(boolean create, TaggingGroupingValue groupingValue, boolean isPropagateUp) {
|
||||
this.isPropagateUp = isPropagateUp;
|
||||
this.create = create;
|
||||
this.groupingValue = groupingValue;
|
||||
}
|
||||
|
||||
public boolean getCreate() {
|
||||
return create;
|
||||
}
|
||||
|
||||
public void setCreate(Boolean create) {
|
||||
this.create = create;
|
||||
}
|
||||
|
||||
public TaggingGroupingValue getGroupingValue() {
|
||||
return groupingValue;
|
||||
}
|
||||
|
||||
public void setGroupingValue(TaggingGroupingValue groupingValue) {
|
||||
this.groupingValue = groupingValue;
|
||||
}
|
||||
|
||||
public boolean isPropagateUp() {
|
||||
return isPropagateUp;
|
||||
}
|
||||
|
||||
public void setPropagateUp(boolean isPropagateUp) {
|
||||
this.isPropagateUp = isPropagateUp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FieldAsGroup [create=" + create + ", isPropagateUp="
|
||||
+ isPropagateUp + ", groupingValue=" + groupingValue + "]";
|
||||
}
|
||||
|
||||
}
|
||||
///**
|
||||
// *
|
||||
// */
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//
|
||||
//import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
//
|
||||
///**
|
||||
// * To be used when a field must be used to create a group.
|
||||
// * @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataGrouping
|
||||
// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
// */
|
||||
//public class FieldAsGroup implements Serializable, IsSerializable{
|
||||
//
|
||||
// private static final long serialVersionUID = 8096886403417944385L;
|
||||
// private boolean create;
|
||||
// private boolean isPropagateUp;
|
||||
// private TaggingGroupingValue groupingValue;
|
||||
//
|
||||
// public FieldAsGroup() {
|
||||
// super();
|
||||
// }
|
||||
//
|
||||
// public FieldAsGroup(boolean create, TaggingGroupingValue groupingValue, boolean isPropagateUp) {
|
||||
// this.isPropagateUp = isPropagateUp;
|
||||
// this.create = create;
|
||||
// this.groupingValue = groupingValue;
|
||||
// }
|
||||
//
|
||||
// public boolean getCreate() {
|
||||
// return create;
|
||||
// }
|
||||
//
|
||||
// public void setCreate(Boolean create) {
|
||||
// this.create = create;
|
||||
// }
|
||||
//
|
||||
// public TaggingGroupingValue getGroupingValue() {
|
||||
// return groupingValue;
|
||||
// }
|
||||
//
|
||||
// public void setGroupingValue(TaggingGroupingValue groupingValue) {
|
||||
// this.groupingValue = groupingValue;
|
||||
// }
|
||||
//
|
||||
// public boolean isPropagateUp() {
|
||||
// return isPropagateUp;
|
||||
// }
|
||||
//
|
||||
// public void setPropagateUp(boolean isPropagateUp) {
|
||||
// this.isPropagateUp = isPropagateUp;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return "FieldAsGroup [create=" + create + ", isPropagateUp="
|
||||
// + isPropagateUp + ", groupingValue=" + groupingValue + "]";
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,62 +1,62 @@
|
|||
|
||||
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* To be used when a field must be used to create a tag.
|
||||
* @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataTagging
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class FieldAsTag implements Serializable, IsSerializable{
|
||||
|
||||
private static final long serialVersionUID = 5414077853964288094L;
|
||||
public static final String DEFAULT_SEPARATOR = "-";
|
||||
private boolean create;
|
||||
private String separator = DEFAULT_SEPARATOR;
|
||||
private TaggingGroupingValue taggingValue;
|
||||
|
||||
public FieldAsTag() {
|
||||
super();
|
||||
}
|
||||
|
||||
public FieldAsTag(Boolean create, String separator, TaggingGroupingValue taggingValue) {
|
||||
super();
|
||||
this.create = create;
|
||||
this.separator = separator;
|
||||
this.taggingValue = taggingValue;
|
||||
}
|
||||
|
||||
public boolean isCreate() {
|
||||
return create;
|
||||
}
|
||||
|
||||
public void setCreate(boolean create) {
|
||||
this.create = create;
|
||||
}
|
||||
|
||||
public String getSeparator() {
|
||||
return separator;
|
||||
}
|
||||
|
||||
public void setSeparator(String separator) {
|
||||
this.separator = separator;
|
||||
}
|
||||
|
||||
public TaggingGroupingValue getTaggingValue() {
|
||||
return taggingValue;
|
||||
}
|
||||
|
||||
public void setTaggingValue(TaggingGroupingValue taggingValue) {
|
||||
this.taggingValue = taggingValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FieldAsTag [create=" + create + ", separator=" + separator
|
||||
+ ", taggingValue=" + taggingValue + "]";
|
||||
}
|
||||
|
||||
}
|
||||
//
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//
|
||||
//import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
//
|
||||
///**
|
||||
// * To be used when a field must be used to create a tag.
|
||||
// * @see org.gcube.datacatalogue.metadatadiscovery.bean.jaxb.MetadataTagging
|
||||
// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
// */
|
||||
//public class FieldAsTag implements Serializable, IsSerializable{
|
||||
//
|
||||
// private static final long serialVersionUID = 5414077853964288094L;
|
||||
// public static final String DEFAULT_SEPARATOR = "-";
|
||||
// private boolean create;
|
||||
// private String separator = DEFAULT_SEPARATOR;
|
||||
// private TaggingGroupingValue taggingValue;
|
||||
//
|
||||
// public FieldAsTag() {
|
||||
// super();
|
||||
// }
|
||||
//
|
||||
// public FieldAsTag(Boolean create, String separator, TaggingGroupingValue taggingValue) {
|
||||
// super();
|
||||
// this.create = create;
|
||||
// this.separator = separator;
|
||||
// this.taggingValue = taggingValue;
|
||||
// }
|
||||
//
|
||||
// public boolean isCreate() {
|
||||
// return create;
|
||||
// }
|
||||
//
|
||||
// public void setCreate(boolean create) {
|
||||
// this.create = create;
|
||||
// }
|
||||
//
|
||||
// public String getSeparator() {
|
||||
// return separator;
|
||||
// }
|
||||
//
|
||||
// public void setSeparator(String separator) {
|
||||
// this.separator = separator;
|
||||
// }
|
||||
//
|
||||
// public TaggingGroupingValue getTaggingValue() {
|
||||
// return taggingValue;
|
||||
// }
|
||||
//
|
||||
// public void setTaggingValue(TaggingGroupingValue taggingValue) {
|
||||
// this.taggingValue = taggingValue;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return "FieldAsTag [create=" + create + ", separator=" + separator
|
||||
// + ", taggingValue=" + taggingValue + "]";
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,88 +1,88 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* A MetaDataProfileBean with its children (MetaDataType, MetaDataFields, Categories)
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public class MetaDataProfileBean implements Serializable, IsSerializable{
|
||||
|
||||
private static final long serialVersionUID = -7377022025375553568L;
|
||||
|
||||
private String type;
|
||||
private String title;
|
||||
private List<CategoryWrapper> categories;
|
||||
private List<MetadataFieldWrapper> metadataFields;
|
||||
|
||||
public MetaDataProfileBean(){
|
||||
super();
|
||||
}
|
||||
public MetaDataProfileBean(String type,
|
||||
String title,
|
||||
List<MetadataFieldWrapper> metadataFields,
|
||||
List<CategoryWrapper> categories) {
|
||||
super();
|
||||
this.type = type;
|
||||
this.title = title;
|
||||
this.categories = categories;
|
||||
this.metadataFields = metadataFields;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the type
|
||||
*/
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
/**
|
||||
* @param type the type to set
|
||||
*/
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
/**
|
||||
* @return the metadataFields
|
||||
*/
|
||||
public List<MetadataFieldWrapper> getMetadataFields() {
|
||||
return metadataFields;
|
||||
}
|
||||
/**
|
||||
* @param metadataFields the metadataFields to set
|
||||
*/
|
||||
public void setMetadataFields(List<MetadataFieldWrapper> metadataFields) {
|
||||
this.metadataFields = metadataFields;
|
||||
}
|
||||
|
||||
public List<CategoryWrapper> getCategories() {
|
||||
return categories;
|
||||
}
|
||||
|
||||
public void setCategories(List<CategoryWrapper> categories) {
|
||||
this.categories = categories;
|
||||
}
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
@Override
|
||||
public String toString() {
|
||||
final int maxLen = 10;
|
||||
return "MetaDataProfileBean [type="
|
||||
+ type
|
||||
+ ", title="
|
||||
+ title
|
||||
+ ", categories="
|
||||
+ (categories != null ? categories.subList(0,
|
||||
Math.min(categories.size(), maxLen)) : null)
|
||||
+ ", metadataFields="
|
||||
+ (metadataFields != null ? metadataFields.subList(0,
|
||||
Math.min(metadataFields.size(), maxLen)) : null) + "]";
|
||||
}
|
||||
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
//
|
||||
///**
|
||||
// * A MetaDataProfileBean with its children (MetaDataType, MetaDataFields, Categories)
|
||||
// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
// */
|
||||
//public class MetaDataProfileBean implements Serializable, IsSerializable{
|
||||
//
|
||||
// private static final long serialVersionUID = -7377022025375553568L;
|
||||
//
|
||||
// private String type;
|
||||
// private String title;
|
||||
// private List<CategoryWrapper> categories;
|
||||
// private List<MetadataFieldWrapper> metadataFields;
|
||||
//
|
||||
// public MetaDataProfileBean(){
|
||||
// super();
|
||||
// }
|
||||
// public MetaDataProfileBean(String type,
|
||||
// String title,
|
||||
// List<MetadataFieldWrapper> metadataFields,
|
||||
// List<CategoryWrapper> categories) {
|
||||
// super();
|
||||
// this.type = type;
|
||||
// this.title = title;
|
||||
// this.categories = categories;
|
||||
// this.metadataFields = metadataFields;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @return the type
|
||||
// */
|
||||
// public String getType() {
|
||||
// return type;
|
||||
// }
|
||||
// /**
|
||||
// * @param type the type to set
|
||||
// */
|
||||
// public void setType(String type) {
|
||||
// this.type = type;
|
||||
// }
|
||||
// /**
|
||||
// * @return the metadataFields
|
||||
// */
|
||||
// public List<MetadataFieldWrapper> getMetadataFields() {
|
||||
// return metadataFields;
|
||||
// }
|
||||
// /**
|
||||
// * @param metadataFields the metadataFields to set
|
||||
// */
|
||||
// public void setMetadataFields(List<MetadataFieldWrapper> metadataFields) {
|
||||
// this.metadataFields = metadataFields;
|
||||
// }
|
||||
//
|
||||
// public List<CategoryWrapper> getCategories() {
|
||||
// return categories;
|
||||
// }
|
||||
//
|
||||
// public void setCategories(List<CategoryWrapper> categories) {
|
||||
// this.categories = categories;
|
||||
// }
|
||||
// public String getTitle() {
|
||||
// return title;
|
||||
// }
|
||||
// public void setTitle(String title) {
|
||||
// this.title = title;
|
||||
// }
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// final int maxLen = 10;
|
||||
// return "MetaDataProfileBean [type="
|
||||
// + type
|
||||
// + ", title="
|
||||
// + title
|
||||
// + ", categories="
|
||||
// + (categories != null ? categories.subList(0,
|
||||
// Math.min(categories.size(), maxLen)) : null)
|
||||
// + ", metadataFields="
|
||||
// + (metadataFields != null ? metadataFields.subList(0,
|
||||
// Math.min(metadataFields.size(), maxLen)) : null) + "]";
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,341 +1,341 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
* The Class MetadataFieldWrapper.
|
||||
* @author Costantino Perciante 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{
|
||||
|
||||
private static final long serialVersionUID = -8476731365884466698L;
|
||||
private String fieldName;
|
||||
private String fieldNameFromCategory;
|
||||
private Boolean mandatory = false;
|
||||
private DataTypeWrapper type;
|
||||
private String defaultValue;
|
||||
private String note;
|
||||
private List<String> vocabulary;
|
||||
private boolean multiSelection;
|
||||
private String validator;
|
||||
private CategoryWrapper ownerCategory;
|
||||
private FieldAsGroup asGroup;
|
||||
private FieldAsTag asTag;
|
||||
|
||||
private Integer maxOccurs = 1;
|
||||
|
||||
/**
|
||||
* Instantiates a new metadata field.
|
||||
*/
|
||||
public MetadataFieldWrapper() {
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new metadata field.
|
||||
*
|
||||
* @param fieldName the field name
|
||||
* @param mandatory the mandatory
|
||||
* @param type the type
|
||||
* @param defaultValue the default value
|
||||
* @param note the note
|
||||
* @param vocabulary the vocabulary
|
||||
* @param validator the validator
|
||||
* @param category the category
|
||||
*/
|
||||
public MetadataFieldWrapper(
|
||||
String fieldName, Boolean mandatory, DataTypeWrapper type,
|
||||
String defaultValue, String note, List<String> vocabulary,
|
||||
String validator, CategoryWrapper category) {
|
||||
super();
|
||||
this.fieldName = fieldName;
|
||||
this.mandatory = mandatory;
|
||||
this.type = type;
|
||||
this.defaultValue = defaultValue;
|
||||
this.note = note;
|
||||
this.vocabulary = vocabulary;
|
||||
this.validator = validator;
|
||||
this.ownerCategory = category;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Gets the max occurs.
|
||||
*
|
||||
* @return the max occurs
|
||||
*/
|
||||
public Integer getMaxOccurs() {
|
||||
return maxOccurs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the max occurs.
|
||||
*
|
||||
* @param maxOccurs the new max occurs
|
||||
*/
|
||||
public void setMaxOccurs(Integer maxOccurs) {
|
||||
this.maxOccurs = maxOccurs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the field name.
|
||||
*
|
||||
* @return the fieldName
|
||||
*/
|
||||
public String getFieldName() {
|
||||
|
||||
return fieldName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the mandatory.
|
||||
*
|
||||
* @return the mandatory
|
||||
*/
|
||||
public Boolean getMandatory() {
|
||||
|
||||
return mandatory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the defaul value.
|
||||
*
|
||||
* @return the defaulValue
|
||||
*/
|
||||
public String getDefaultValue() {
|
||||
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the note.
|
||||
*
|
||||
* @return the note
|
||||
*/
|
||||
public String getNote() {
|
||||
|
||||
return note;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the vocabulary.
|
||||
*
|
||||
* @return the vocabulary
|
||||
*/
|
||||
public List<String> getVocabulary() {
|
||||
|
||||
return vocabulary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the validator.
|
||||
*
|
||||
* @return the validator
|
||||
*/
|
||||
public String getValidator() {
|
||||
|
||||
return validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the field name.
|
||||
*
|
||||
* @param fieldName the fieldName to set
|
||||
*/
|
||||
public void setFieldName(String fieldName) {
|
||||
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the mandatory.
|
||||
*
|
||||
* @param mandatory the mandatory to set
|
||||
*/
|
||||
public void setMandatory(Boolean mandatory) {
|
||||
|
||||
this.mandatory = mandatory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the defaul value.
|
||||
*
|
||||
* @param defaultValue the new default value
|
||||
*/
|
||||
public void setDefaultValue(String defaultValue) {
|
||||
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the note.
|
||||
*
|
||||
* @param note the note to set
|
||||
*/
|
||||
public void setNote(String note) {
|
||||
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the vocabulary.
|
||||
*
|
||||
* @param vocabulary the vocabulary to set
|
||||
*/
|
||||
public void setVocabulary(List<String> vocabulary) {
|
||||
|
||||
this.vocabulary = vocabulary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the validator.
|
||||
*
|
||||
* @param validator the validator to set
|
||||
*/
|
||||
public void setValidator(String validator) {
|
||||
|
||||
this.validator = validator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the type.
|
||||
*
|
||||
* @return the type
|
||||
*/
|
||||
public DataTypeWrapper getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type.
|
||||
*
|
||||
* @param type the new type
|
||||
*/
|
||||
public void setType(DataTypeWrapper type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is multi selection.
|
||||
*
|
||||
* @return true, if is multi selection
|
||||
*/
|
||||
public boolean isMultiSelection() {
|
||||
return multiSelection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the multi selection.
|
||||
*
|
||||
* @param multiSelection the new multi selection
|
||||
*/
|
||||
public void setMultiSelection(boolean multiSelection) {
|
||||
this.multiSelection = multiSelection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the owner category.
|
||||
*
|
||||
* @return the owner category
|
||||
*/
|
||||
public CategoryWrapper getOwnerCategory() {
|
||||
return ownerCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the owner category.
|
||||
*
|
||||
* @param ownerCategory the new owner category
|
||||
*/
|
||||
public void setOwnerCategory(CategoryWrapper ownerCategory) {
|
||||
this.ownerCategory = ownerCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the field name from category.
|
||||
*
|
||||
* @return the field name from category
|
||||
*/
|
||||
public String getFieldNameFromCategory() {
|
||||
return fieldNameFromCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the field name from category.
|
||||
*
|
||||
* @param fieldNameFromCategory the new field name from category
|
||||
*/
|
||||
public void setFieldNameFromCategory(String fieldNameFromCategory) {
|
||||
this.fieldNameFromCategory = fieldNameFromCategory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the as group.
|
||||
*
|
||||
* @return the as group
|
||||
*/
|
||||
public FieldAsGroup getAsGroup() {
|
||||
return asGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the as group.
|
||||
*
|
||||
* @param asGroup the new as group
|
||||
*/
|
||||
public void setAsGroup(FieldAsGroup asGroup) {
|
||||
this.asGroup = asGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the as tag.
|
||||
*
|
||||
* @return the as tag
|
||||
*/
|
||||
public FieldAsTag getAsTag() {
|
||||
return asTag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the as tag.
|
||||
*
|
||||
* @param asTag the new as tag
|
||||
*/
|
||||
public void setAsTag(FieldAsTag asTag) {
|
||||
this.asTag = asTag;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MetadataFieldWrapper ["
|
||||
+ (fieldName != null ? "fieldName=" + fieldName + ", " : "")
|
||||
+ (fieldNameFromCategory != null ? "fieldNameFromCategory="
|
||||
+ fieldNameFromCategory + ", " : "")
|
||||
+ (mandatory != null ? "mandatory=" + mandatory + ", " : "")
|
||||
+ (maxOccurs != null ? "maxOccurs=" + maxOccurs + ", " : "")
|
||||
+ (type != null ? "type=" + type + ", " : "")
|
||||
+ (defaultValue != null ? "defaultValue=" + defaultValue + ", "
|
||||
: "")
|
||||
+ (note != null ? "note=" + note + ", " : "")
|
||||
+ (vocabulary != null ? "vocabulary=" + vocabulary + ", " : "")
|
||||
+ "multiSelection="
|
||||
+ multiSelection
|
||||
+ ", "
|
||||
+ (validator != null ? "validator=" + validator + ", " : "")
|
||||
+ (ownerCategory != null ? "ownerCategory=" + ownerCategory.getId()
|
||||
+ ", " : "")
|
||||
+ (asGroup != null ? "asGroup=" + asGroup + ", " : "")
|
||||
+ (asTag != null ? "asTag=" + asTag : "") + "]";
|
||||
}
|
||||
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
//
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//import java.util.List;
|
||||
//
|
||||
//import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
//
|
||||
///**
|
||||
// * The Class MetadataFieldWrapper.
|
||||
// * @author Costantino Perciante 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{
|
||||
//
|
||||
// private static final long serialVersionUID = -8476731365884466698L;
|
||||
// private String fieldName;
|
||||
// private String fieldNameFromCategory;
|
||||
// private Boolean mandatory = false;
|
||||
// private DataTypeWrapper type;
|
||||
// private String defaultValue;
|
||||
// private String note;
|
||||
// private List<String> vocabulary;
|
||||
// private boolean multiSelection;
|
||||
// private String validator;
|
||||
// private CategoryWrapper ownerCategory;
|
||||
// private FieldAsGroup asGroup;
|
||||
// private FieldAsTag asTag;
|
||||
//
|
||||
// private Integer maxOccurs = 1;
|
||||
//
|
||||
// /**
|
||||
// * Instantiates a new metadata field.
|
||||
// */
|
||||
// public MetadataFieldWrapper() {
|
||||
// super();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Instantiates a new metadata field.
|
||||
// *
|
||||
// * @param fieldName the field name
|
||||
// * @param mandatory the mandatory
|
||||
// * @param type the type
|
||||
// * @param defaultValue the default value
|
||||
// * @param note the note
|
||||
// * @param vocabulary the vocabulary
|
||||
// * @param validator the validator
|
||||
// * @param category the category
|
||||
// */
|
||||
// public MetadataFieldWrapper(
|
||||
// String fieldName, Boolean mandatory, DataTypeWrapper type,
|
||||
// String defaultValue, String note, List<String> vocabulary,
|
||||
// String validator, CategoryWrapper category) {
|
||||
// super();
|
||||
// this.fieldName = fieldName;
|
||||
// this.mandatory = mandatory;
|
||||
// this.type = type;
|
||||
// this.defaultValue = defaultValue;
|
||||
// this.note = note;
|
||||
// this.vocabulary = vocabulary;
|
||||
// this.validator = validator;
|
||||
// this.ownerCategory = category;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * Gets the max occurs.
|
||||
// *
|
||||
// * @return the max occurs
|
||||
// */
|
||||
// public Integer getMaxOccurs() {
|
||||
// return maxOccurs;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the max occurs.
|
||||
// *
|
||||
// * @param maxOccurs the new max occurs
|
||||
// */
|
||||
// public void setMaxOccurs(Integer maxOccurs) {
|
||||
// this.maxOccurs = maxOccurs;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the field name.
|
||||
// *
|
||||
// * @return the fieldName
|
||||
// */
|
||||
// public String getFieldName() {
|
||||
//
|
||||
// return fieldName;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the mandatory.
|
||||
// *
|
||||
// * @return the mandatory
|
||||
// */
|
||||
// public Boolean getMandatory() {
|
||||
//
|
||||
// return mandatory;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the defaul value.
|
||||
// *
|
||||
// * @return the defaulValue
|
||||
// */
|
||||
// public String getDefaultValue() {
|
||||
//
|
||||
// return defaultValue;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the note.
|
||||
// *
|
||||
// * @return the note
|
||||
// */
|
||||
// public String getNote() {
|
||||
//
|
||||
// return note;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the vocabulary.
|
||||
// *
|
||||
// * @return the vocabulary
|
||||
// */
|
||||
// public List<String> getVocabulary() {
|
||||
//
|
||||
// return vocabulary;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the validator.
|
||||
// *
|
||||
// * @return the validator
|
||||
// */
|
||||
// public String getValidator() {
|
||||
//
|
||||
// return validator;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the field name.
|
||||
// *
|
||||
// * @param fieldName the fieldName to set
|
||||
// */
|
||||
// public void setFieldName(String fieldName) {
|
||||
//
|
||||
// this.fieldName = fieldName;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the mandatory.
|
||||
// *
|
||||
// * @param mandatory the mandatory to set
|
||||
// */
|
||||
// public void setMandatory(Boolean mandatory) {
|
||||
//
|
||||
// this.mandatory = mandatory;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the defaul value.
|
||||
// *
|
||||
// * @param defaultValue the new default value
|
||||
// */
|
||||
// public void setDefaultValue(String defaultValue) {
|
||||
//
|
||||
// this.defaultValue = defaultValue;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the note.
|
||||
// *
|
||||
// * @param note the note to set
|
||||
// */
|
||||
// public void setNote(String note) {
|
||||
//
|
||||
// this.note = note;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the vocabulary.
|
||||
// *
|
||||
// * @param vocabulary the vocabulary to set
|
||||
// */
|
||||
// public void setVocabulary(List<String> vocabulary) {
|
||||
//
|
||||
// this.vocabulary = vocabulary;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the validator.
|
||||
// *
|
||||
// * @param validator the validator to set
|
||||
// */
|
||||
// public void setValidator(String validator) {
|
||||
//
|
||||
// this.validator = validator;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the type.
|
||||
// *
|
||||
// * @return the type
|
||||
// */
|
||||
// public DataTypeWrapper getType() {
|
||||
// return type;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the type.
|
||||
// *
|
||||
// * @param type the new type
|
||||
// */
|
||||
// public void setType(DataTypeWrapper type) {
|
||||
// this.type = type;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Checks if is multi selection.
|
||||
// *
|
||||
// * @return true, if is multi selection
|
||||
// */
|
||||
// public boolean isMultiSelection() {
|
||||
// return multiSelection;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the multi selection.
|
||||
// *
|
||||
// * @param multiSelection the new multi selection
|
||||
// */
|
||||
// public void setMultiSelection(boolean multiSelection) {
|
||||
// this.multiSelection = multiSelection;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the owner category.
|
||||
// *
|
||||
// * @return the owner category
|
||||
// */
|
||||
// public CategoryWrapper getOwnerCategory() {
|
||||
// return ownerCategory;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the owner category.
|
||||
// *
|
||||
// * @param ownerCategory the new owner category
|
||||
// */
|
||||
// public void setOwnerCategory(CategoryWrapper ownerCategory) {
|
||||
// this.ownerCategory = ownerCategory;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the field name from category.
|
||||
// *
|
||||
// * @return the field name from category
|
||||
// */
|
||||
// public String getFieldNameFromCategory() {
|
||||
// return fieldNameFromCategory;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the field name from category.
|
||||
// *
|
||||
// * @param fieldNameFromCategory the new field name from category
|
||||
// */
|
||||
// public void setFieldNameFromCategory(String fieldNameFromCategory) {
|
||||
// this.fieldNameFromCategory = fieldNameFromCategory;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the as group.
|
||||
// *
|
||||
// * @return the as group
|
||||
// */
|
||||
// public FieldAsGroup getAsGroup() {
|
||||
// return asGroup;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the as group.
|
||||
// *
|
||||
// * @param asGroup the new as group
|
||||
// */
|
||||
// public void setAsGroup(FieldAsGroup asGroup) {
|
||||
// this.asGroup = asGroup;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the as tag.
|
||||
// *
|
||||
// * @return the as tag
|
||||
// */
|
||||
// public FieldAsTag getAsTag() {
|
||||
// return asTag;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Sets the as tag.
|
||||
// *
|
||||
// * @param asTag the new as tag
|
||||
// */
|
||||
// public void setAsTag(FieldAsTag asTag) {
|
||||
// this.asTag = asTag;
|
||||
// }
|
||||
//
|
||||
// /* (non-Javadoc)
|
||||
// * @see java.lang.Object#toString()
|
||||
// */
|
||||
// @Override
|
||||
// public String toString() {
|
||||
// return "MetadataFieldWrapper ["
|
||||
// + (fieldName != null ? "fieldName=" + fieldName + ", " : "")
|
||||
// + (fieldNameFromCategory != null ? "fieldNameFromCategory="
|
||||
// + fieldNameFromCategory + ", " : "")
|
||||
// + (mandatory != null ? "mandatory=" + mandatory + ", " : "")
|
||||
// + (maxOccurs != null ? "maxOccurs=" + maxOccurs + ", " : "")
|
||||
// + (type != null ? "type=" + type + ", " : "")
|
||||
// + (defaultValue != null ? "defaultValue=" + defaultValue + ", "
|
||||
// : "")
|
||||
// + (note != null ? "note=" + note + ", " : "")
|
||||
// + (vocabulary != null ? "vocabulary=" + vocabulary + ", " : "")
|
||||
// + "multiSelection="
|
||||
// + multiSelection
|
||||
// + ", "
|
||||
// + (validator != null ? "validator=" + validator + ", " : "")
|
||||
// + (ownerCategory != null ? "ownerCategory=" + ownerCategory.getId()
|
||||
// + ", " : "")
|
||||
// + (asGroup != null ? "asGroup=" + asGroup + ", " : "")
|
||||
// + (asTag != null ? "asTag=" + asTag : "") + "]";
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -1,66 +1,66 @@
|
|||
package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
*/
|
||||
public enum TaggingGroupingValue {
|
||||
|
||||
onFieldName,
|
||||
onValue,
|
||||
onFieldName_onValue,
|
||||
onValue_onFieldName;
|
||||
|
||||
/**
|
||||
* Returns the composed value in case of tag
|
||||
* @param name
|
||||
* @param value
|
||||
* @param separator
|
||||
* @param action
|
||||
* @return
|
||||
*/
|
||||
public static String getComposedValueTag(String name, String value, String separator, TaggingGroupingValue action){
|
||||
|
||||
switch(action){
|
||||
case onFieldName:
|
||||
return name;
|
||||
case onValue:
|
||||
return value;
|
||||
case onFieldName_onValue:
|
||||
return name + separator + value;
|
||||
case onValue_onFieldName:
|
||||
return value + separator + name;
|
||||
default: return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the composed value in case of group
|
||||
* @param name
|
||||
* @param value
|
||||
* @param separator
|
||||
* @param action
|
||||
* @return a list of group names
|
||||
*/
|
||||
public static List<String> getComposedValueGroup(String name, String value, TaggingGroupingValue action){
|
||||
|
||||
switch(action){
|
||||
case onFieldName:
|
||||
return Arrays.asList(name);
|
||||
case onValue:
|
||||
return Arrays.asList(value);
|
||||
case onFieldName_onValue:
|
||||
case onValue_onFieldName:
|
||||
return Arrays.asList(value, name);
|
||||
default: return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//package org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata;
|
||||
//
|
||||
//import java.util.Arrays;
|
||||
//import java.util.List;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * 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
|
||||
// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
||||
// */
|
||||
//public enum TaggingGroupingValue {
|
||||
//
|
||||
// onFieldName,
|
||||
// onValue,
|
||||
// onFieldName_onValue,
|
||||
// onValue_onFieldName;
|
||||
//
|
||||
// /**
|
||||
// * Returns the composed value in case of tag
|
||||
// * @param name
|
||||
// * @param value
|
||||
// * @param separator
|
||||
// * @param action
|
||||
// * @return
|
||||
// */
|
||||
// public static String getComposedValueTag(String name, String value, String separator, TaggingGroupingValue action){
|
||||
//
|
||||
// switch(action){
|
||||
// case onFieldName:
|
||||
// return name;
|
||||
// case onValue:
|
||||
// return value;
|
||||
// case onFieldName_onValue:
|
||||
// return name + separator + value;
|
||||
// case onValue_onFieldName:
|
||||
// return value + separator + name;
|
||||
// default: return null;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Returns the composed value in case of group
|
||||
// * @param name
|
||||
// * @param value
|
||||
// * @param separator
|
||||
// * @param action
|
||||
// * @return a list of group names
|
||||
// */
|
||||
// public static List<String> getComposedValueGroup(String name, String value, TaggingGroupingValue action){
|
||||
//
|
||||
// switch(action){
|
||||
// case onFieldName:
|
||||
// return Arrays.asList(name);
|
||||
// case onValue:
|
||||
// return Arrays.asList(value);
|
||||
// case onFieldName_onValue:
|
||||
// case onValue_onFieldName:
|
||||
// return Arrays.asList(value, name);
|
||||
// default: return null;
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
|
|
@ -16,6 +16,12 @@
|
|||
<servlet-class>org.gcube.portlets.widgets.wsexplorer.server.WorkspaceExplorerServiceImpl</servlet-class>
|
||||
</servlet>
|
||||
|
||||
<servlet>
|
||||
<servlet-name>metadataProfileFormBuilderUploadServlet</servlet-name>
|
||||
<servlet-class>org.gcube.portlets.widgets.mpformbuilder.server.MetadataProfileFormBuilderUploadServlet</servlet-class>
|
||||
</servlet>
|
||||
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>ckanpublisherservices</servlet-name>
|
||||
<url-pattern>/CKanMetadataPublisher/ckanservices</url-pattern>
|
||||
|
@ -27,6 +33,12 @@
|
|||
</servlet-mapping>
|
||||
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>metadataProfileFormBuilderUploadServlet</servlet-name>
|
||||
<url-pattern>/CKanMetadataPublisher/metadataProfileFormBuilderUploadServlet</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
<!-- Default page to serve -->
|
||||
<welcome-file-list>
|
||||
<welcome-file>CKanMetadataPublisher.html</welcome-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.shared.DatasetBean;
|
||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean;
|
||||
import org.junit.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue