removed commented classes #26656

This commit is contained in:
Francesco Mangiacrapa 2024-02-05 16:57:39 +01:00
parent 103eda2642
commit d85f7e9e35
26 changed files with 0 additions and 3404 deletions

View File

@ -1,162 +0,0 @@
//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;
// }
//
//}

View File

@ -1,24 +0,0 @@
<!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>
.margin-left-max-occurrs {
padding-left: 50px;
}
</ui:style>
<g:HTMLPanel>
<g:VerticalPanel
ui:field="panelMetaDataFieldsSkeleton" width="100%">
</g:VerticalPanel>
<b:ControlGroup>
<b:Controls addStyleNames="{style.margin-left-max-occurrs}">
<b:Label ui:field="repeatabilityLabel" visible="false">Repeatable field</b:Label>
<b:Button icon="MINUS_SIGN" title="Remove Latest Field"
ui:field="removeFieldButton" visible="false"></b:Button>
<b:Button icon="PLUS_SIGN" title="Add Another Field"
ui:field="addFieldButton" visible="false"></b:Button>
</b:Controls>
</b:ControlGroup>
</g:HTMLPanel>
</ui:UiBinder>

View File

@ -1,80 +0,0 @@
//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);
// }
//
//}

View File

@ -1,12 +0,0 @@
<!-- <!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
<g:VerticalPanel ui:field="fieldsPanel" visible="false"
width="100%"></g:VerticalPanel>
</g:VerticalPanel>
</g:HTMLPanel>
</ui:UiBinder> -->

View File

@ -1,906 +0,0 @@
//package org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata;
//
//import java.util.ArrayList;
//import java.util.List;
//
//import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEvent;
//import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEventHandler;
//import org.gcube.portlets.widgets.ckandatapublisherwidget.client.openlayerwidget.GeoJsonAreaSelectionDialog;
//import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.metadata.timeandreanges.DataTimeBox;
//import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.GcubeDialogExtended;
//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.MetadataFieldWrapper;
//import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.metadata.TaggingGroupingValue;
//
//import com.github.gwtbootstrap.client.ui.Alert;
//import com.github.gwtbootstrap.client.ui.Button;
//import com.github.gwtbootstrap.client.ui.CheckBox;
//import com.github.gwtbootstrap.client.ui.ControlGroup;
//import com.github.gwtbootstrap.client.ui.ControlLabel;
//import com.github.gwtbootstrap.client.ui.Controls;
//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.TextArea;
//import com.github.gwtbootstrap.client.ui.TextBox;
//import com.github.gwtbootstrap.client.ui.constants.AlertType;
//import com.github.gwtbootstrap.client.ui.constants.ControlGroupType;
//import com.github.gwtbootstrap.client.ui.constants.IconType;
//import com.google.gwt.core.client.GWT;
//import com.google.gwt.dom.client.Element;
//import com.google.gwt.dom.client.SpanElement;
//import com.google.gwt.dom.client.Style.Cursor;
//import com.google.gwt.dom.client.Style.Display;
//import com.google.gwt.dom.client.Style.Unit;
//import com.google.gwt.event.dom.client.ClickEvent;
//import com.google.gwt.event.dom.client.ClickHandler;
//import com.google.gwt.event.logical.shared.ResizeEvent;
//import com.google.gwt.event.logical.shared.ResizeHandler;
//import com.google.gwt.event.shared.HandlerManager;
//import com.google.gwt.uibinder.client.UiBinder;
//import com.google.gwt.uibinder.client.UiField;
//import com.google.gwt.uibinder.client.UiHandler;
//import com.google.gwt.user.client.Command;
//import com.google.gwt.user.client.Window;
//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.HTML;
//import com.google.gwt.user.client.ui.HorizontalPanel;
//import com.google.gwt.user.client.ui.Label;
//import com.google.gwt.user.client.ui.SimplePanel;
//import com.google.gwt.user.client.ui.VerticalPanel;
//import com.google.gwt.user.client.ui.Widget;
//
//public class MetaDataFieldSkeleton extends Composite{
//
// private static MetaDataFieldSkeletonUiBinder uiBinder = GWT
// .create(MetaDataFieldSkeletonUiBinder.class);
//
// interface MetaDataFieldSkeletonUiBinder extends
// UiBinder<Widget, MetaDataFieldSkeleton> {
// }
//
// @UiField Element mandatorySymbol;
// @UiField SpanElement name;
// @UiField SimplePanel elementPanel;
// @UiField FlowPanel noteFieldContainer;
// @UiField Popover noteFieldPopover;
// @UiField ControlLabel controlLabel;
// @UiField Controls controls;
// @UiField Icon infoIcon;
// @UiField FocusPanel focusPanelIconContainer;
// @UiField ControlGroup metafieldControlGroup;
//
// // private static final String REGEX_IS_NUMBER = "[0-9]+[.]?[0-9]+";
//
// // the element that holds the value (it could be a checkbox, textbox or listbox, textarea, calendar, two calendars, more calendars)
// private Widget holder;
//
// // the field this object represents
// private MetadataFieldWrapper field;
//
// // the dialog box for this metadata
// private GcubeDialogExtended dialog;
//
// // range list
// private List<DataTimeBox> rangesList = new ArrayList<DataTimeBox>();
//
// private List<TextArea> geoJsonList = new ArrayList<TextArea>();
//
// // save event bus reference
// private HandlerManager eventBus;
//
// // errors
// private static final String MANDATORY_ATTRIBUTE_MISSING = "a mandatory attribute cannot be empty";
// private static final String MALFORMED_ATTRIBUTE = " the inserted value has a wrong format";
// private static final String ADD_NEW_TIME_RANGE = "Add a new Time Range";
// private static final String DELETE_TIME_RANGE = "Delete the last Time Range";
//
// // missing range value
// private static final String INSERT_MISSING_VALUE = " you cannot specify an end date without a start one";
// private static final String INSERT_MISSING_VALUE_MANDATORY = " one or more range value missing in mandatory attribute";
// private static final String UPPER_RANGE_NOT_SPECIFIED = "Not specified";
// // time range separator
// public static final String RANGE_SEPARATOR = ",";
// private static final String TOOLTIP_MULTISELECTION = "Hold down the Control (CTRL) or Command (CMD) button to select multiple options";
//
// public MetaDataFieldSkeleton(final MetadataFieldWrapper field, HandlerManager eventBus) throws Exception{
// initWidget(uiBinder.createAndBindUi(this));
//
// // prepare information
// this.field = field;
//
// // event bus
// this.eventBus = eventBus;
//
// // bind
// bind();
//
// switch(field.getType()){
//
// case Boolean :
//
// // its a checkbox
// holder = new CheckBox();
// if(field.getDefaultValue() != null)
// ((CheckBox)holder).setValue(Boolean.valueOf(field.getDefaultValue()));
// break;
//
// case GeoJSON:
// //MANAGED By FRANCESCO
// final VerticalPanel containerGeoJSON = new VerticalPanel();
// //containerGeoJSON.setWidth("100%");
//
// final TextArea textArea = new TextArea();
// textArea.setWidth("100%");
//
// if(field.getDefaultValue() != null)
// textArea.setText(field.getDefaultValue());
//
// containerGeoJSON.add(textArea);
//
// HorizontalPanel hp = new HorizontalPanel();
// hp.getElement().getStyle().setMarginTop(10, Unit.PX);
// final ListBox geometries = GeoJsonAreaSelectionDialog.getGeometries();
//
//
// Button butt = new Button();
// butt.setIcon(IconType.MAP_MARKER);
// butt.addClickHandler(new ClickHandler() {
//
// @Override
// public void onClick(ClickEvent event) {
// String geometrySelected = geometries.getSelectedItemText();
// if(geometrySelected==null) {
// containerGeoJSON.add(new Alert("Please, select one geometry", AlertType.WARNING, true));
// }
//
// final GeoJsonAreaSelectionDialog dialog=new GeoJsonAreaSelectionDialog(GeoJsonAreaSelectionDialog.toGeometry(geometrySelected));
//
// Command fillGeoJSONArea = new Command() {
// public void execute() {
//
// try {
// String geoJsonGeom = dialog.getWKTToGeoJSON();
// if(geoJsonGeom!=null)
// textArea.setText(geoJsonGeom);
// else{
// textArea.setText("");
// containerGeoJSON.add(new Alert("Sorry, an error occurred by reading the Geometry", AlertType.ERROR, true));
// }
// }catch (Exception e) {
// containerGeoJSON.add(new Alert(e.getMessage(), AlertType.ERROR, true));
// }
// }
// };
//
// dialog.fireCommandOnResponse(fillGeoJSONArea);
// dialog.center();
// }
// });
//
// geoJsonList.add(textArea);
// Label label = new Label("Draw a");
// label.getElement().getStyle().setMarginRight(5, Unit.PX);
// hp.add(label);
// geometries.getElement().getStyle().setMarginRight(5, Unit.PX);
// hp.add(geometries);
// hp.add(butt);
// geometries.setItemSelected(0, true);
// containerGeoJSON.add(hp);
// holder = containerGeoJSON;
//
// break;
//
// case Text:
//
// holder = new TextArea();
//
// if(field.getDefaultValue() != null)
// ((TextArea)holder).setText(field.getDefaultValue());
// break;
//
// case Time:
//
// DataTimeBox ref;
// holder = ref = new DataTimeBox(false);
//
// // set time, if present
// if(field.getDefaultValue() != null && !field.getDefaultValue().isEmpty()){
// String[] dateAndTime = field.getDefaultValue().split(" ");
// if(dateAndTime.length > 0){
// ref.setStartDate(dateAndTime[0], dateAndTime.length > 1 ? dateAndTime[1] : null);
// }
// }
// break;
//
// case Time_Interval:
//
// DataTimeBox rangeBox;
// holder = rangeBox = new DataTimeBox(true);
// setRangeTimeInTimeBox(field.getDefaultValue(), rangeBox);
// rangesList.add(rangeBox);
// break;
//
// case Times_ListOf:
//
// holder = new FlowPanel();
//
// // start and end range date
// final VerticalPanel containerRanges = new VerticalPanel();
// containerRanges.setWidth("100%");
//
// SimplePanel panelFirstRange = new SimplePanel();
// DataTimeBox rangeBoxFirst = new DataTimeBox(true);
// setRangeTimeInTimeBox(field.getDefaultValue(), rangeBoxFirst);
// panelFirstRange.add(rangeBoxFirst);
// rangesList.add(rangeBoxFirst);
//
// // Add more button
// Button addRangeButton = new Button();
// addRangeButton.setIcon(IconType.PLUS_SIGN);
// addRangeButton.setTitle(ADD_NEW_TIME_RANGE);
//
// addRangeButton.addClickHandler(new ClickHandler() {
//
// @Override
// public void onClick(ClickEvent event) {
//
// final FlowPanel newRange = new FlowPanel();
// final DataTimeBox newRangeBox = new DataTimeBox(true);
// setRangeTimeInTimeBox(field.getDefaultValue(), newRangeBox);
// rangesList.add(newRangeBox);
//
// // delete button
// Button deleteRangeButton = new Button("", IconType.MINUS_SIGN, new ClickHandler() {
//
// @Override
// public void onClick(ClickEvent event) {
//
// newRange.removeFromParent();
// rangesList.remove(newRangeBox);
// }
// });
// deleteRangeButton.setTitle(DELETE_TIME_RANGE);
// newRange.add(newRangeBox);
// newRange.add(deleteRangeButton);
// containerRanges.add(newRange);
//
// }
// });
//
// // add calendars and plus sign
// containerRanges.add(panelFirstRange);
//
// // add the vertical panel first, then the button
// ((FlowPanel)holder).add(containerRanges);
// ((FlowPanel)holder).add(addRangeButton);
//
// break;
//
// case Number:
//
// holder = new TextBox();
//
// if(field.getDefaultValue() != null)
// ((TextBox)holder).setText(field.getDefaultValue());
//
// break;
//
// case String:
//
// // it could be a listbox or a textbox according to the vocabulary fields
// if(field.getVocabulary() == null || field.getVocabulary().isEmpty()){
//
// // textbox
// holder = new TextBox();
//
// if(field.getDefaultValue() != null)
// ((TextBox)holder).setText(field.getDefaultValue());
//
// }else{
//
// // listbox
// ListBox tempListBox;
// holder = tempListBox = new ListBox(field.isMultiSelection());
//
// if(field.isMultiSelection())
// tempListBox.setTitle(TOOLTIP_MULTISELECTION);
//
// // if it is not mandatory and not multi-selection, add a disabled option (placeholder)
// if(!field.getMandatory() && !field.isMultiSelection()){
// tempListBox.addItem("Select " + field.getFieldName());
// tempListBox.setValue(0, "");
// tempListBox.getElement().getElementsByTagName("option").getItem(0).setAttribute("disabled", "disabled");
// tempListBox.setSelectedValue("Select " + field.getFieldName());
// }
//
// // get vocabulary fields
// List<String> vocabulary = field.getVocabulary();
// GWT.log("Vocabulary: "+field.getFieldName());
// for (String term : vocabulary) {
// GWT.log("Adding term: "+term);
// tempListBox.addItem(term);
// }
//
// // set default value
// if(field.getDefaultValue() != null)
// tempListBox.setSelectedValue(field.getDefaultValue());
//
// }
//
// break;
//
// default: return;
//
// }
//
// // add custom css properties
// controls.addStyleName("form-controls-custom");
// controlLabel.addStyleName("form-control-label-custom");
//
// // save the name
// name.setInnerText(field.getFieldName() + ":");
//
// // check if it is mandatory
// if(!field.getMandatory())
// mandatorySymbol.getStyle().setDisplay(Display.NONE);
//
// // add to the elementPanel
// elementPanel.add(holder);
//
// // set holder width
// if(holder.getClass().equals(ListBox.class))
// holder.setWidth("96%");
// else
// holder.setWidth("95%");
//
// // set the notes, if any, and the popover
// if(field.getNote() != null && !field.getNote().isEmpty()){
// noteFieldPopover.setText(new HTML("<p style='color:initial'>" + field.getNote() +"</p>").getHTML());
// noteFieldPopover.setHeading(new HTML("<b>" + field.getFieldName() +"</b>").getHTML());
// infoIcon.getElement().getStyle().setCursor(Cursor.HELP);
// noteFieldPopover.setHtml(true);
// noteFieldContainer.setVisible(true);
// }else{
// noteFieldContainer.setVisible(false);
// }
//
// // add a resize handler to center the dialog box if it's not null
// Window.addResizeHandler(new ResizeHandler() {
//
// @Override
// public void onResize(ResizeEvent event) {
//
// if(dialog != null)
// dialog.center();
//
// }
// });
//
// }
//
// /**
// * Bind on events
// */
// private void bind() {
//
// // on close form
// eventBus.addHandler(CloseCreationFormEvent.TYPE, new CloseCreationFormEventHandler() {
//
// @Override
// public void onClose(CloseCreationFormEvent event) {
//
// if(dialog != null)
// dialog.hide();
//
// }
// });
//
// }
//
// @UiHandler("focusPanelIconContainer")
// void onInfoIconClick(ClickEvent c){
//
// if(dialog == null){
//
// // create the dialog box
// dialog = new GcubeDialogExtended(field.getFieldName(), field.getNote());
//
// // set as non modal
// dialog.setModal(false);
// }
//
// // else just show and center
// dialog.center();
// dialog.show();
// }
//
// /**
// * Check if this field has valid values
// * @return a string with the occurred error on error, null otherwise
// */
// public String isFieldValueValid(){
//
//// try {
//// //Feature #18700
//// String value = getFieldCurrentValue().get(0);
//// if(field.getMandatory() && value.isEmpty())
//// return checkValidator(value, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
//// }catch (Exception e) {
//// //continue
//// }
//
// switch(field.getType()){
//
// case Boolean :
//
// // nothing to validate
// return null;
//
// case Text:
// case GeoJSON:
// String textAreaValue = getFieldCurrentValue().get(0);
//
// if(field.getMandatory()){
//
// if(!textAreaValue.trim().isEmpty()) {
// if(field.getValidator() == null || field.getValidator().isEmpty())
// return null; // no further check
// else return checkValidator(textAreaValue, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
// }
// else return MANDATORY_ATTRIBUTE_MISSING;
//
// }else{
//
// if(textAreaValue.trim().isEmpty())
// return null;
//
// else return checkValidator(textAreaValue, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
//
// }
//
// case Time:
//
// String dateValue = getFieldCurrentValue().get(0);
//
// if(field.getMandatory()){
// if(dateValue.isEmpty())
// return MANDATORY_ATTRIBUTE_MISSING;
// }
//
// return null;
//
//
// case Time_Interval:
//
// String rangeValue = rangesList.get(0).getCurrentValue();
//
// if(field.getMandatory()){
// if(rangeValue.contains(DataTimeBox.MISSING_RANGE_VALUE_START) || rangeValue.contains(DataTimeBox.MISSING_RANGE_VALUE_END))
// return INSERT_MISSING_VALUE_MANDATORY;
// }
//
// if(rangeValue.contains(DataTimeBox.MISSING_RANGE_VALUE_START) && !rangeValue.equals(DataTimeBox.MISSING_RANGE_VALUE_START + DataTimeBox.RANGE_SEPARATOR_START_END + DataTimeBox.MISSING_RANGE_VALUE_END))
// return INSERT_MISSING_VALUE;
//
// return null;
//
// case Times_ListOf:
//
// for(DataTimeBox el: rangesList){
//
// String currentValue = el.getCurrentValue();
// if(field.getMandatory()){
// if(currentValue.contains(DataTimeBox.MISSING_RANGE_VALUE_START) || currentValue.contains(DataTimeBox.MISSING_RANGE_VALUE_END))
// return INSERT_MISSING_VALUE_MANDATORY;
// }
//
// GWT.log("Printing " + currentValue);
// if(currentValue.contains(DataTimeBox.MISSING_RANGE_VALUE_START) && !currentValue.equals(DataTimeBox.MISSING_RANGE_VALUE_START + DataTimeBox.RANGE_SEPARATOR_START_END + DataTimeBox.MISSING_RANGE_VALUE_END))
// return INSERT_MISSING_VALUE;
//
// }
// return null;
//
// case Number:
//
// String numberValue = ((TextBox)holder).getValue();
//
// if(field.getMandatory()){
//
// if(!numberValue.trim().isEmpty())
// if(field.getValidator() == null || field.getValidator().isEmpty())
// return isANumber(numberValue) ? null : MALFORMED_ATTRIBUTE;
// else return checkValidator(numberValue, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
// else return " a mandatory attribute cannot be empty";
//
// }else{
//
// if(numberValue.trim().isEmpty())
// return null;
// else {
// String validatorToUse = field.getValidator();
// if(validatorToUse != null && !validatorToUse.isEmpty())
// return checkValidator(numberValue, validatorToUse) ? null : MALFORMED_ATTRIBUTE;
// else
// return isANumber(numberValue) ? null : MALFORMED_ATTRIBUTE;
// }
// }
//
// case String:
//
// // just handle the case of textbox
// if(holder.getClass().equals(TextBox.class)){
//
// String textBoxValue = getFieldCurrentValue().get(0);
// if(field.getMandatory()){
// if(!textBoxValue.trim().isEmpty())
// if(field.getValidator() == null || field.getValidator().isEmpty())
// return null; // no further check
// else return checkValidator(textBoxValue, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
// else return MANDATORY_ATTRIBUTE_MISSING;
//
// }else{
// if(textBoxValue.trim().isEmpty())
// return null;
// else return checkValidator(textBoxValue, field.getValidator()) ? null : MALFORMED_ATTRIBUTE;
// }
// }
// else{
//
// List<String> listboxValues = getFieldCurrentValue();
//
// if(listboxValues.isEmpty() && field.getMandatory())
// return MANDATORY_ATTRIBUTE_MISSING;
//
// for (String value : listboxValues) {
// if(!field.getMandatory()){
//
// if(field.getValidator() == null || field.getValidator().isEmpty())
// continue;
// else
// if(checkValidator(value, field.getValidator()))
// continue;
// else return MALFORMED_ATTRIBUTE;
//
// }else{
//
// if(value == null || value.isEmpty())
// return MANDATORY_ATTRIBUTE_MISSING;
// else
// continue;
//
// }
// }
// }
//
// return null;
//
// default: return null;
//
// }
// }
//
// /**
// * Check if this string is a number
// * @param numberValue
// * @return
// */
// private boolean isANumber(String numberValue) {
// return numberValue.matches("-?\\d+(\\.\\d+)?");
// }
//
// /**
// * Check if value matches validator (regex). In case validator is null, true is returned.
// * @param value
// * @param validator
// * @return true if validator is null OR value.matches(reges), false otherwise
// */
// private boolean checkValidator(String value, String validator) {
// GWT.log("Value is " + value);
// GWT.log("Validator is " + validator);
// if(validator == null || validator.isEmpty())
// return true;
// else return value.matches(validator);
// }
//
// /**
// * Returns the current value of the field. In case of TimeInterval or TimeList see getTimeIntervalOrTimeListWithoutMissing()
// * @return
// */
// public List<String> getFieldCurrentValue(){
//
// List<String> toReturn = new ArrayList<String>();
// String manipulatedTemp = "";
//
// switch(field.getType()){
//
// case Boolean :
//
// toReturn.add(((CheckBox)holder).getValue().toString());
// break;
//
// case Text:
// toReturn.add(((TextArea)holder).getText());
// break;
//
// case GeoJSON:
// toReturn.add(geoJsonList.get(0).getText());
// break;
//
// case Time:
//
// toReturn.add(((DataTimeBox)holder).getCurrentValue().replaceAll(DataTimeBox.MISSING_RANGE_VALUE_START, "")); // it was a noRange metadata
// break;
//
// case Time_Interval:
//
// manipulatedTemp = rangesList.get(0).getCurrentValue().replaceAll(DataTimeBox.MISSING_RANGE_VALUE_START, "").replaceAll(DataTimeBox.MISSING_RANGE_VALUE_END, UPPER_RANGE_NOT_SPECIFIED);
//
// //fixed by Francesco, see #20663#note-12
// if(!field.getMandatory()) {
// if(manipulatedTemp.equals(DataTimeBox.RANGE_SEPARATOR_START_END + UPPER_RANGE_NOT_SPECIFIED))
// manipulatedTemp = "";
// }
//
// // split to check if the extreme are equals
// //fixed by Francesco
// if(!manipulatedTemp.isEmpty()) {
// String[] temp = manipulatedTemp.split(DataTimeBox.RANGE_SEPARATOR_START_END);
// if(temp[0].equals(temp[1]))
// manipulatedTemp = temp[0];
// }
//
// toReturn.add(manipulatedTemp);
// break;
//
// case Times_ListOf:
//
// manipulatedTemp = "";
// for (DataTimeBox elem : rangesList) {
//
// String currentRange = elem.getCurrentValue().replaceAll(DataTimeBox.MISSING_RANGE_VALUE_START, "").replaceAll(DataTimeBox.MISSING_RANGE_VALUE_END, UPPER_RANGE_NOT_SPECIFIED);
// if(currentRange.equals(DataTimeBox.RANGE_SEPARATOR_START_END + UPPER_RANGE_NOT_SPECIFIED))
// continue;
//
// String[] splitted = currentRange.split(DataTimeBox.RANGE_SEPARATOR_START_END);
// if(splitted[0].equals(splitted[1]))
// manipulatedTemp += manipulatedTemp.isEmpty() ? splitted[0] : RANGE_SEPARATOR + splitted[0];
// else
// manipulatedTemp += manipulatedTemp.isEmpty() ? splitted[0] + DataTimeBox.RANGE_SEPARATOR_START_END + splitted[1] :
// RANGE_SEPARATOR + splitted[0] + DataTimeBox.RANGE_SEPARATOR_START_END + splitted[1];
//
// }
//
// if(manipulatedTemp.endsWith(RANGE_SEPARATOR))
// manipulatedTemp = manipulatedTemp.substring(0, manipulatedTemp.length() - 1);
//
// toReturn.add(manipulatedTemp);
// break;
//
// case Number:
// case String:
//
// if(holder.getClass().equals(TextBox.class))
// toReturn.add(((TextBox)holder).getText());
// else{
//
// // handle single and multi-selected case
// for(int i = 0; i < ((ListBox)holder).getItemCount(); i++){
// if(((ListBox)holder).isItemSelected(i)){
// toReturn.add(((ListBox)holder).getItemText(i));
// }
// }
//
// // if it was not mandatory but there was no choice, returning empty string
// if(!field.getMandatory()) {
// //Task #20446 - bug fix. Ignoring the placeholder
// if(toReturn.size()==1) {
// String placeholder = "Select " + field.getFieldName();
// if(toReturn.get(0).equals(placeholder)){
// GWT.log("Skipping placeholder: "+placeholder);
// toReturn.clear();
// //toReturn.add("");
// }
// }
// }
// }
//
// break;
//
// default: break;
//
// }
//
// return toReturn;
// }
//
// /**
// * Returns the current name of the field
// * @return
// */
// public String getFieldNameOriginal(){
//
// return field.getFieldName();
//
// }
//
// /**
// * Returns the current name of the field
// * @return
// */
// public String getFieldNameQualified(){
//
// if(field.getFieldNameFromCategory() != null)
// return field.getFieldNameFromCategory();
// return field.getFieldName();
//
// }
//
// /**
// * Freeze this widget (after on create)
// */
// public void freeze() {
//
// switch(field.getType()){
//
// case Boolean :
//
// ((CheckBox)holder).setEnabled(false);
// break;
//
// case GeoJSON:
// case Text:
//
// ((TextArea)holder).setEnabled(false);
// break;
//
// case Time:
//
// ((DataTimeBox)holder).freeze();
// break;
//
// case Time_Interval:
//
// rangesList.get(0).freeze();
// break;
//
// case Times_ListOf:
//
// for(DataTimeBox el : rangesList)
// el.freeze();
//
// break;
//
// case Number:
//
// ((TextBox)holder).setEnabled(false);
// break;
//
// case String:
//
// if(holder.getClass().equals(ListBox.class))
// ((ListBox)holder).setEnabled(false);
// else
// ((TextBox)holder).setEnabled(false);
// break;
//
// default: break;
//
// }
// }
//
// /**
// * Get the original MetadataFieldWrapper object
// * @return
// */
// public MetadataFieldWrapper getField() {
// return field;
// }
//
// public void removeError() {
//
// metafieldControlGroup.setType(ControlGroupType.NONE);
//
// }
//
// public void showError() {
//
// metafieldControlGroup.setType(ControlGroupType.ERROR);
//
// }
//
// /**
// * Build the range interval
// * @param rangeValues
// * @param tb
// */
// private void setRangeTimeInTimeBox(String rangeValues, DataTimeBox tb){
// // set time, if present
// if(rangeValues != null && !rangeValues.isEmpty()){
// if(!rangeValues.contains(DataTimeBox.RANGE_SEPARATOR_START_END))
// rangeValues += "/" + rangeValues;
//
// String[] dateAndTimeRanges = rangeValues.split(DataTimeBox.RANGE_SEPARATOR_START_END);
// if(dateAndTimeRanges.length > 0){
// String[] firstRangeDate = dateAndTimeRanges[0].split(" ");
// tb.setStartDate(firstRangeDate[0], firstRangeDate.length > 1 ? firstRangeDate[1] : null);
// if(dateAndTimeRanges.length > 1){
// String[] secondRangeDate = dateAndTimeRanges[1].split(" ");
// tb.setEndDate(secondRangeDate[0], secondRangeDate.length > 1 ? secondRangeDate[1] : null);
// }
// }
// }
// }
//
// /**
// * Given the name and the value of this field, return a tag if it is the case.
// * @return a tag as string
// */
// public List<String> getTagFromThisField(){
//
// FieldAsTag asTag = field.getAsTag();
// List<String> generatedTags = new ArrayList<String>();
// if(asTag != null && asTag.isCreate()){
// List<String> values = getFieldCurrentValue();
// for (String value : values) {
//
// //Feature #18700
// if(value.isEmpty()) {
// //if the value is empty I'm adding the tag on in case of onFieldName
// if(asTag.getTaggingValue().equals(TaggingGroupingValue.onFieldName))
// generatedTags.add(TaggingGroupingValue.getComposedValueTag(field.getFieldName(), value, asTag.getSeparator(), asTag.getTaggingValue()));
// }else
// generatedTags.add(TaggingGroupingValue.getComposedValueTag(field.getFieldName(), value, asTag.getSeparator(), asTag.getTaggingValue()));
//
// }
// return generatedTags;
// }
// return null;
// }
//
// /**
// * Given the name and the value of this field, return a group title if it is the case.
// * @return a tag as string
// */
// public List<String> getGroupTitleFromThisGroup(){
// FieldAsGroup asGroup = field.getAsGroup();
// List<String> generatedGroups = new ArrayList<String>();
// if(asGroup != null){
// List<String> values = getFieldCurrentValue();
// for (String value : values) {
// generatedGroups.addAll(TaggingGroupingValue.getComposedValueGroup(field.getFieldName(), value, asGroup.getGroupingValue()));
// }
// return generatedGroups;
// }
// return null;
// }
//
// /**
// * Check if the group associated (if it exists) should be forced
// * @return
// */
// public boolean isGroupToForce(){
// FieldAsGroup asGroup = field.getAsGroup();
// if(asGroup != null){
// return asGroup.getCreate();
// }
// return false;
// }
//
// /**
// * Check if the propagateUp is set
// * @return
// */
// public boolean isPropagateUp(){
// FieldAsGroup asGroup = field.getAsGroup();
// if(asGroup != null){
// return asGroup.isPropagateUp();
// }
// return false;
// }
//
//}

View File

@ -1,50 +0,0 @@
<!-- <!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"
xmlns:b3="urn:import:com.github.gwtbootstrap.datepicker.client.ui">
<ui:style>
.note-container {
display: inline-block;
float: right;
width: 5%;
color: #aaaaaa;
}
.note-field-text {
display: inline;
text-align: justify;
margin-left: 5px;
word-wrap: break-word;
}
.element-panel {
display: inline-block;
}
</ui:style>
<g:HTMLPanel width="100%">
<b:ControlGroup ui:field="metafieldControlGroup">
<b:ControlLabel ui:field="controlLabel">
<font color="red" ui:field="mandatorySymbol">*</font>
<span ui:field="name"></span>
</b:ControlLabel>
<b:Controls ui:field="controls">
<g:FlowPanel width="95%">
<g:SimplePanel ui:field="elementPanel" styleName="{style.element-panel}"
width="95%">
Listbox, Checkbox, Textbox, Calendar etc
</g:SimplePanel>
<g:FlowPanel ui:field="noteFieldContainer" styleName="{style.note-container}">
<b:Popover ui:field="noteFieldPopover" html="true"
animation="true" placement="LEFT">
<g:FocusPanel ui:field="focusPanelIconContainer">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIcon" />
</g:FocusPanel>
</b:Popover>
</g:FlowPanel>
</g:FlowPanel>
</b:Controls>
</b:ControlGroup>
</g:HTMLPanel>
</ui:UiBinder> -->

View File

@ -1,138 +0,0 @@
//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);
// }
//}

View File

@ -1,30 +0,0 @@
<!-- <!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">
<ui:style>
.flow-panel-style {
display: inline-block;
}
</ui:style>
<g:HTMLPanel width="100%">
<g:FlowPanel width="100%">
<g:FlowPanel width="100%" ui:field="singleDataStart" styleName="{style.flow-panel-style}"
visible="true">
<b3:DateBox format="yyyy-mm-dd" autoClose="true"
language="en" ui:field="startRangeDate" width="70%" />
<b2:DateTimeBox format="hh:ii" autoClose="true"
maxView="HOUR" startView="HOUR" language="en"
width="20%" ui:field="startRangeTime" />
</g:FlowPanel>
<g:FlowPanel width="100%" ui:field="singleDataEnd" visible="false"
styleName="{style.flow-panel-style}">
<b3:DateBox format="yyyy-mm-dd" autoClose="true" width="70%"
language="en" ui:field="endRangeDate" />
<b2:DateTimeBox format="hh:ii" autoClose="true"
maxView="HOUR" startView="HOUR" language="en"
width="20%" ui:field="endRangeTime" />
</g:FlowPanel>
</g:FlowPanel>
</g:HTMLPanel>
</ui:UiBinder> -->

View File

@ -1,37 +0,0 @@
//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);
// }
//}

View File

@ -1,8 +0,0 @@
<!-- <!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
<g:VerticalPanel ui:field="resourcesPanel" width="100%"></g:VerticalPanel>
</g:HTMLPanel>
</ui:UiBinder> -->

View File

@ -1,160 +0,0 @@
//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);
// }
// });
// }
//}

View File

@ -1,8 +0,0 @@
<!-- <!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> -->

View File

@ -1,279 +0,0 @@
//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);
// }
//}

View File

@ -1,36 +0,0 @@
<!-- <!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>
.tagsPanelStyle {
display: inline-block;
}
</ui:style>
<g:HTMLPanel>
<b:ControlGroup ui:field="tagsInsertGroup">
<b:ControlLabel for="tags" title="Item tag">
<font color="red">*</font>
Tag:
</b:ControlLabel>
<b:Controls ui:field="controlAsTextBox">
<b:TextBox width="90%" placeholder="Write a tag here (push ENTER to attach it to the Item)"
b:id="tags" ui:field="tagsEnterTextBox" maxLength="100"/>
<b:ListBox width="91%" title="HOLD CTRL or CMD for multiple selection"
b:id="tags" ui:field="tagsEnterListBox" multipleSelect="true"/>
<span style="float:right; width:5%; color: #aaaaaa;">
<b:Popover ui:field="popoverTags" html="true" animation="true"
placement="LEFT">
<g:FocusPanel ui:field="focusPanelTags">
<b:Icon type="INFO_SIGN" size="TWO_TIMES" ui:field="infoIconTags" />
</g:FocusPanel>
</b:Popover>
</span>
</b:Controls>
</b:ControlGroup>
<b:ControlGroup>
<b:Controls>
<g:FlowPanel ui:field="tagsPanel" styleName="{style.tagsPanelStyle}"></g:FlowPanel>
</b:Controls>
</b:ControlGroup>
</g:HTMLPanel>
</ui:UiBinder> -->

View File

@ -1,155 +0,0 @@
//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());
// }
//
//}

View File

@ -1,62 +0,0 @@
///**
// *
// */
//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);
// }
//
//}

View File

@ -1,161 +0,0 @@
//package org.gcube.portlets.widgets.ckandatapublisherwidget.server.threads;
//
//import java.util.ArrayList;
//import java.util.Iterator;
//import java.util.List;
//import java.util.Map;
//
//import javax.servlet.http.HttpServletRequest;
//
//import org.gcube.common.portal.mailing.EmailNotification;
//import org.gcube.datacatalogue.ckanutillibrary.server.DataCatalogue;
//import org.gcube.datacatalogue.ckanutillibrary.server.utils.CatalogueUtilMethods;
//import org.gcube.datacatalogue.ckanutillibrary.shared.RolesCkanGroupOrOrg;
//import org.gcube.datacatalogue.ckanutillibrary.shared.jackan.model.CkanGroup;
//import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean;
//import org.gcube.vomanagement.usermanagement.UserManager;
//import org.gcube.vomanagement.usermanagement.impl.LiferayUserManager;
//
//import com.liferay.portal.kernel.log.Log;
//import com.liferay.portal.kernel.log.LogFactoryUtil;
//
//
//
///**
// * Associate the dataset to a group and send notifications to group's admins.
// * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
// */
//public class AssociationToGroupAndNotifyThread extends Thread {
//
// //private static final Logger logger = LoggerFactory.getLogger(AssociationToGroupAndNotifyThread.class);
// private static final Log logger = LogFactoryUtil.getLog(AssociationToGroupAndNotifyThread.class);
// private static final String PRODUCT_ASSOCIATED_TO_GROUP_SUBJECT = "Item $TITLE added to group $GROUP";
// private static final String PRODUCT_ASSOCIATED_TO_GROUP_BODY = "Dear user,<br> a new item named '<b>$TITLE</b>' has been "
// + "just published by $USER_FULLNAME in <b>$GROUP</b> .<br>"
// + "You can find it here $DATASET_URL";
//
// private String groupTitle;
// private String datasetId;
// private String username;
// private String datasetTitle;
// private String userFullName;
// private DataCatalogue catalogue;
// // private String organization;
// private List<OrganizationBean> groups;
// private HttpServletRequest request;
// private String datasetUrl;
// private List<OrganizationBean> groupsForceCreation;
//
// /**
// * @param list
// * @param groupTitle
// * @param datasetId
// * @param username
// * @param catalogue
// */
// public AssociationToGroupAndNotifyThread(List<OrganizationBean> groups, List<OrganizationBean> groupsForceCreation, String groupTitle, String datasetUrl, String datasetId, String datasetTitle, String userFullName,
// String username, DataCatalogue catalogue, String organization, HttpServletRequest request) {
// this.request = request;
// this.groups = groups == null ? new ArrayList<OrganizationBean>() : groups;
// this.groupsForceCreation = groupsForceCreation;
// this.groupTitle = groupTitle;
// this.datasetId = datasetId;
// this.username = username;
// this.catalogue = catalogue;
// // this.organization = organization;
// this.datasetTitle = datasetTitle;
// this.userFullName = userFullName;
// this.datasetUrl = datasetUrl;
// }
//
// @Override
// public void run() {
//
// logger.info("Association thread started to put the dataset with id = "+ datasetId + " into group with title " + groupTitle + " for user " + username);
//
// // force creation of groups if needed
// if(groupsForceCreation != null){
// logger.info("Groups that must be created before association are " + groupsForceCreation);
// for (OrganizationBean groupToForce : groupsForceCreation) {
// try{
// CkanGroup group = catalogue.createGroup(groupToForce.getName(), groupToForce.getTitle(), "");
// if(group == null)
// logger.error("Unable to retrieve or create group with name " + groupToForce);
// else
// groups.add(new OrganizationBean(group.getTitle(), group.getName(), false, groupToForce.isPropagateUp()));
// }catch(Exception e){
// logger.error("Failed to check if a group with this info " + groupToForce + " already exists or can be created");
// }
// }
//
// }
//
// logger.info("Other groups to which the product should be associate are " + groups);
//
// if(groups != null)
// for (OrganizationBean groupBean : groups) {
// boolean putIntoGroup = catalogue.assignDatasetToGroup(groupBean.getName(), datasetId, groupBean.isPropagateUp());
// logger.info("Was product put into group" + groupBean.getTitle() + "? " + putIntoGroup);
// if(putIntoGroup)
// notifyGroupAdmins(catalogue, groupBean.getName() ,groupBean.getTitle(), username);
// }
//
// }
//
// /**
// * Send a notification to the group admin(s) about the just added product
// * @param username
// * @param groupTitle
// * @param catalogue
// */
// private void notifyGroupAdmins(DataCatalogue catalogue, String groupName, String groupTitle, String username){
//
// // get the groups admin
// Map<RolesCkanGroupOrOrg, List<String>> userAndRoles = catalogue.getRolesAndUsersGroup(groupName);
//
// if(userAndRoles.containsKey(RolesCkanGroupOrOrg.ADMIN)){
//
// List<String> admins = userAndRoles.get(RolesCkanGroupOrOrg.ADMIN);
// List<String> adminsEmails = new ArrayList<String>();
//
// for(int i = 0; i < admins.size(); i++){
// String convertedName = CatalogueUtilMethods.fromCKanUsernameToUsername(admins.get(i));
// admins.set(i, convertedName);
// }
//
// // remove the same user who published the product if he/she is an admin of the group
// int indexOfUser = admins.indexOf(username);
// if(indexOfUser >= 0)
// admins.remove(indexOfUser);
//
// // further cleaning of the list (for users that are only in ckan... sysadmin for example)
// UserManager um = new LiferayUserManager();
// Iterator<String> adminIt = admins.iterator();
//
// while (adminIt.hasNext()) {
// String admin = (String) adminIt.next();
// try{
// adminsEmails.add(um.getUserByUsername(admin).getEmail());
// }catch(Exception e){
// logger.error("User with username " + admin + " doesn't exist in Liferay");
// adminIt.remove();
// }
// }
//
// logger.info("The list of admins for group " + groupTitle + " is " + admins);
//
// if(admins.isEmpty())
// return;
//
// // send the email
// EmailNotification mailToSend = new EmailNotification(
// adminsEmails,
// PRODUCT_ASSOCIATED_TO_GROUP_SUBJECT.replace("$TITLE", datasetTitle).replace("$GROUP", groupTitle),
// PRODUCT_ASSOCIATED_TO_GROUP_BODY.replace("$TITLE", datasetTitle).replace("$GROUP", groupTitle).replace("$USER_FULLNAME", userFullName).replace("$DATASET_URL", datasetUrl),
// request);
// mailToSend.sendEmail();
//
// }else
// logger.warn("It seems there is no user with role Admin in group " + groupTitle);
// }
//}

View File

@ -1,322 +0,0 @@
//package org.gcube.portlets.widgets.ckandatapublisherwidget.server.threads;
//
//import java.io.IOException;
//import java.net.HttpURLConnection;
//import java.util.List;
//
//import org.apache.http.HttpEntity;
//import org.apache.http.HttpResponse;
//import org.apache.http.client.ClientProtocolException;
//import org.apache.http.client.methods.HttpPost;
//import org.apache.http.entity.StringEntity;
//import org.apache.http.impl.client.CloseableHttpClient;
//import org.apache.http.impl.client.HttpClientBuilder;
//import org.apache.http.util.EntityUtils;
//import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
//import org.gcube.common.scope.api.ScopeProvider;
//import org.gcube.portlets.widgets.ckandatapublisherwidget.server.utils.GCoreEndPointReaderSocial;
//import org.gcube.portlets.widgets.ckandatapublisherwidget.server.utils.GenericUtils;
//
//import com.google.gwt.json.client.JSONParser;
//import com.liferay.portal.kernel.log.Log;
//import com.liferay.portal.kernel.log.LogFactoryUtil;
//
//
///**
// * Let the Product Catalogue Manager write a post in a VRE and alert there is a new product
// * @author Costantino Perciante at ISTI-CNR
// * (costantino.perciante@isti.cnr.it)
// */
//public class WritePostCatalogueManagerThread extends Thread {
//
// public static final String APPLICATION_ID_CATALOGUE_MANAGER = "org.gcube.datacatalogue.ProductCatalogue";
// private static final String NOTIFICATION_MESSAGE = "Dear members,\n$USER_FULLNAME just published the item '$PRODUCT_TITLE'.\nYou can find it at: $PRODUCT_URL\n";
// private static final String SOCIAL_SERVICE_APPLICATION_TOKEN = "2/tokens/generate-application-token";
// private static final String SOCIAL_SERVICE_WRITE_APPLICATION_POST = "2/posts/write-post-app";
// private static final String MEDIATYPE_JSON = "application/json";
// private static final Log logger = LogFactoryUtil.getLog(WritePostCatalogueManagerThread.class);
// private String username;
// private String scope;
// private String productTitle;
// private String productUrl;
// private boolean enableNotification;
// private List<String> hashtags;
// private String userFullName;
// private String userCurrentUrl;
//
// /**
// * @param token
// * @param scope
// * @param productTitle
// * @param productUrl
// * @param enableNotification
// * @param hashtags
// * @param userFullName
// */
// public WritePostCatalogueManagerThread(
// String username, String scope,
// String productTitle, String productUrl, boolean enableNotification,
// List<String> hashtags, String userFullName, String userCurrentUrl) {
// super();
// this.username = username;
// this.scope = scope;
// this.productTitle = productTitle;
// this.productUrl = productUrl;
// this.enableNotification = enableNotification;
// this.hashtags = hashtags;
// this.userFullName = userFullName;
// this.userCurrentUrl = userCurrentUrl;
// }
//
// @Override
// public void run() {
//
// try{
// // evaluate user's token for this scope
// String token = GenericUtils.tryGetElseCreateToken(username, scope);
//
// if(token == null){
// logger.warn("Unable to proceed, user's token is not available");
// return;
// }
//
// logger.info("Started request to write application post "
// + "for new product created. Scope is " + scope + " and "
// + "token is " + token.substring(0, 10) + "****************");
//
// // set token and scope
// ScopeProvider.instance.set(scope);
// SecurityTokenProvider.instance.set(token);
//
// //see Feature #17577
// /*final String profilePageURL = GCubePortalConstants.PREFIX_GROUP_URL + extractOrgFriendlyURL(userCurrentUrl) + GCubePortalConstants.USER_PROFILE_FRIENDLY_URL;
//
// userFullName = "<a class=\"link\" href=\"" + profilePageURL + "?"+
// Base64.getEncoder().encodeToString(GCubeSocialNetworking.USER_PROFILE_OID.getBytes())+"="+
// Base64.getEncoder().encodeToString(username.getBytes())+"\">"+userFullName+
// "</a> ";
// */
//
// userFullName = "@"+username;
//
// // write
// writeProductPost(
// productTitle,
// productUrl,
// userFullName,
// hashtags,
// enableNotification
// );
//
// }catch(Exception e){
// logger.error("Failed to write the post because of the following error ", e);
// }finally{
// SecurityTokenProvider.instance.reset();
// ScopeProvider.instance.reset();
// }
// }
//
// public static String extractOrgFriendlyURL(String portalURL) {
// String groupRegEx = "/group/";
// if (portalURL.contains(groupRegEx)) {
// String[] splits = portalURL.split(groupRegEx);
// String friendlyURL = splits[1];
// if (friendlyURL.contains("/")) {
// friendlyURL = friendlyURL.split("/")[0];
// } else {
// friendlyURL = friendlyURL.split("\\?")[0].split("\\#")[0];
// }
// return "/"+friendlyURL;
// }
// return null;
// }
//
// /**
// * Send notification to vre members about the created product by writing a post.
// * @param productName the title of the product
// * @param productUrl the url of the product
// * @param hashtags a list of product's hashtags
// */
// private static void writeProductPost(String productName, String productUrl, String userFullname, List<String> hashtags, boolean enablePostNotification){
//
// // discover service endpoint for the social networking library
// String currentScope = ScopeProvider.instance.get();
// String tokenUser = SecurityTokenProvider.instance.get();
//
// logger.info("Current scope for writeProductPost is " + currentScope + " and token is " + tokenUser.substring(0, 10) + "***************");
// String basePath = new GCoreEndPointReaderSocial(currentScope).getBasePath();
//
// if(basePath == null){
//
// logger.error("Unable to write a post because there is no social networking service available");
//
// }else{
//
// // check base path form
// basePath = basePath.endsWith("/") ? basePath : basePath + "/";
//
// try(CloseableHttpClient client = HttpClientBuilder.create().build();){
//
// String pathTokenApp = basePath + SOCIAL_SERVICE_APPLICATION_TOKEN + "?gcube-token=" + tokenUser;
// String tokenApp = requireAppToken(client, pathTokenApp);
// if(tokenApp != null){
// String pathWritePost = basePath + SOCIAL_SERVICE_WRITE_APPLICATION_POST + "?gcube-token=" + tokenApp;
// writePost(client, pathWritePost, productName, productUrl, userFullname, hashtags, enablePostNotification);
// }
//
// }catch(Exception e){
// logger.error("Failed to create a post", e);
// }
// }
// }
//
// /**
// * Require the application token
// * @param tokenUser
// * @param basePath
// * @param client
// * @return
// */
// private static String requireAppToken(CloseableHttpClient client, String path){
//
// String token = null;
// try{
//
// JSONObject request = new JSONObject();
// request.put("app_id", APPLICATION_ID_CATALOGUE_MANAGER);
// HttpResponse response = performRequest(client, path, request.toJSONString());
//
// int statusTokenGenerate = response.getStatusLine().getStatusCode();
//
// if(statusTokenGenerate == HttpURLConnection.HTTP_CREATED){
//
// // extract token
// JSONObject obj = getJSONObject(response);
// if(((Boolean) obj.get("success")))
// token = (String)obj.get("result");
// else
// return null;
//
// }else if(statusTokenGenerate == HttpURLConnection.HTTP_MOVED_TEMP
// || statusTokenGenerate == HttpURLConnection.HTTP_MOVED_PERM
// || statusTokenGenerate == HttpURLConnection.HTTP_SEE_OTHER){
//
// // re-execute
// Header[] locations = response.getHeaders("Location");
// Header lastLocation = locations[locations.length - 1];
// String realLocation = lastLocation.getValue();
// logger.debug("New location is " + realLocation);
// token = requireAppToken(client, realLocation);
//
// }else
// return null;
//
// }catch(Exception e){
// logger.error("Failed to retrieve application token", e);
// }
//
// logger.info("Returning app token " + (token != null ? token.substring(0, 10) + "*************************" : null));
// return token;
// }
//
// /**
// * Write post request
// * @param client
// * @param applicationToken
// * @param productName
// * @param productUrl
// * @param userFullname
// * @param hashtags
// */
// private static void writePost(CloseableHttpClient client, String path, String productName, String productUrl, String userFullname, List<String> hashtags,
// boolean enablePostNotification) {
//
// try{
//
// // replace
// String message = NOTIFICATION_MESSAGE.replace("$PRODUCT_TITLE", productName).replace("$PRODUCT_URL", productUrl).replace("$USER_FULLNAME", userFullname);
//
// if(hashtags != null && !hashtags.isEmpty())
// for (String hashtag : hashtags) {
// String modifiedHashtag = hashtag.replaceAll(" ", "_").replace("_+", "_");
// if(modifiedHashtag.endsWith("_"))
// modifiedHashtag = modifiedHashtag.substring(0, modifiedHashtag.length() - 1);
// message += " #" + modifiedHashtag; // ckan accepts tag with empty spaces, we don't
// }
//
// JSONObject request = new JSONObject();
// request.put("text", message);
// request.put("enable_notification", enablePostNotification);
// logger.info("The post that is going to be written is ->\n" + request.toJSONString());
// HttpResponse response = performRequest(client, path, request.toJSONString());
// int statusWritePost = response.getStatusLine().getStatusCode();
//
// if(statusWritePost == HttpURLConnection.HTTP_CREATED){
//
// // extract token
// JSONObject obj = getJSONObject(response);
// if(((Boolean) obj.get("success")))
// logger.info("Post written");
// else
// logger.info("Failed to write the post " + obj.get("message"));
//
// }else if(statusWritePost == HttpURLConnection.HTTP_MOVED_TEMP
// || statusWritePost == HttpURLConnection.HTTP_MOVED_PERM
// || statusWritePost == HttpURLConnection.HTTP_SEE_OTHER){
//
// // re-execute
// Header[] locations = response.getHeaders("Location");
// Header lastLocation = locations[locations.length - 1];
// String realLocation = lastLocation.getValue();
// logger.debug("New location is " + realLocation);
// writePost(client, realLocation, productName, productUrl, userFullname, hashtags, enablePostNotification);
//
// }else
// throw new RuntimeException("Failed to write the post ");
//
// }catch(Exception e){
// logger.error("Failed to write the post ", e);
// }
//
// }
//
// /**
// * Convert the json response to a map
// * @param response
// * @return
// */
// private static JSONObject getJSONObject(HttpResponse response){
//
// JSONObject toReturn = null;
// HttpEntity entity = response.getEntity();
//
// if (entity != null) {
// try {
// String jsonString = EntityUtils.toString(response.getEntity());
// JSONParser parser = new JSONParser();
// toReturn = (JSONObject)parser.parse(jsonString);
// }catch(Exception e){
// logger.error("Failed to read json object", e);
// }
// }
//
// logger.debug("Returning " + toReturn.toJSONString());
// return toReturn;
// }
//
// /**
// * Perform an http request post request with json entity
// * @throws IOException
// * @throws ClientProtocolException
// */
// private static HttpResponse performRequest(CloseableHttpClient client, String path, String entity) throws ClientProtocolException, IOException{
//
// HttpPost request = new HttpPost(path);
// StringEntity stringEntity = new StringEntity(entity);
// stringEntity.setContentType(MEDIATYPE_JSON);
// request.setEntity(stringEntity);
// return client.execute(request);
//
// }
//
//}

View File

@ -1,52 +0,0 @@
//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 + "]";
// }
//}

View File

@ -1,77 +0,0 @@
//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() : "") + "]";
// }
//
//
//}

View File

@ -1,26 +0,0 @@
//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();
// }
//}

View File

@ -1,62 +0,0 @@
///**
// *
// */
//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 + "]";
// }
//
//}

View File

@ -1,62 +0,0 @@
//
//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 + "]";
// }
//
//}

View File

@ -1,88 +0,0 @@
//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) + "]";
// }
//
//}

View File

@ -1,341 +0,0 @@
//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 : "") + "]";
// }
//
//}

View File

@ -1,66 +0,0 @@
//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;
// }
//
// }
//
//}