diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/UpdateDatasetForm.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/UpdateDatasetForm.java index e1d8f3a..65173ab 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/UpdateDatasetForm.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/form/UpdateDatasetForm.java @@ -24,7 +24,6 @@ import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources.Ad import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.resources.ManageResources; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.InfoIconsLabels; import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.utils.WizardCreator; -import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.workspace.SelectResourceByWEMainPanel; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.DatasetBean; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.MetadataProfileBeanForUpdate; import org.gcube.portlets.widgets.ckandatapublisherwidget.shared.OrganizationBean; @@ -310,7 +309,7 @@ public class UpdateDatasetForm extends Composite { private DatasetBean theDatasetBean; // resource table - private SelectResourceByWEMainPanel resourcesSelectByWEMainPanel; + //private SelectResourceByWEMainPanel resourcesSelectByWEMainPanel; // List of opened popup'ids private List popupOpenedIds = new ArrayList(); @@ -515,11 +514,11 @@ public class UpdateDatasetForm extends Composite { // set it as visible anyway tagsPanel.setVisible(true); - // The resource root is the folder id. Es. ID of the Workspace Root folder. - if (datasetBean.getResourceRoot() != null) { - resourcesSelectByWEMainPanel = new SelectResourceByWEMainPanel( - datasetBean.getResourceRoot()); - } +// // The resource root is the folder id. Es. ID of the Workspace Root folder. +// if (datasetBean.getResourceRoot() != null) { +// resourcesSelectByWEMainPanel = new SelectResourceByWEMainPanel( +// datasetBean.getResourceRoot()); +// } // set organizations List organizations = datasetBean.getOrganizationList(); @@ -946,7 +945,7 @@ public class UpdateDatasetForm extends Composite { // add the resources to the container panel if (workspaceResourcesContainer.getWidget() == null) { workspaceResourcesContainer.getElement().getStyle().setMarginLeft(20, Unit.PX); - workspaceResourcesContainer.add(resourcesSelectByWEMainPanel); + //workspaceResourcesContainer.add(resourcesSelectByWEMainPanel); } } else { @@ -1156,9 +1155,9 @@ public class UpdateDatasetForm extends Composite { theDatasetBean.setGroups(groups); theDatasetBean.setGroupsForceCreation(groupsToForceCreation); - if (resourcesSelectByWEMainPanel != null) { - theDatasetBean.setResourceRoot(resourcesSelectByWEMainPanel.getResourcesToPublish()); - } +// if (resourcesSelectByWEMainPanel != null) { +// theDatasetBean.setResourceRoot(resourcesSelectByWEMainPanel.getResourcesToPublish()); +// } theDatasetBean.setCustomFields(customFieldsMap); @@ -1600,9 +1599,9 @@ public class UpdateDatasetForm extends Composite { } - // freeze table of resources - if (resourcesSelectByWEMainPanel != null) - resourcesSelectByWEMainPanel.freeze(); +// // freeze table of resources +// if (resourcesSelectByWEMainPanel != null) +// resourcesSelectByWEMainPanel.freeze(); } /** diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.java index 84b0957..ba8a167 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/resources/AddResourceToDataset.java @@ -35,14 +35,23 @@ import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.Widget; /** - * Form used to add resource(s) to a dataset + * The Class AddResourceToDataset. + * + * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it * - * @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it) + * Feb 23, 2024 */ public class AddResourceToDataset extends Composite { private static AddResourceToDatasetUiBinder uiBinder = GWT.create(AddResourceToDatasetUiBinder.class); + /** + * The Interface AddResourceToDatasetUiBinder. + * + * @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it + * + * Feb 23, 2024 + */ interface AddResourceToDatasetUiBinder extends UiBinder { } @@ -82,6 +91,15 @@ public class AddResourceToDataset extends Composite { FlowPanel alertPanel = new FlowPanel(); + /** + * Instantiates a new adds the resource to dataset. + * + * @param eventBus the event bus + * @param datasetId the dataset id + * @param datasetTitle the dataset title + * @param datasetOrg the dataset org + * @param datasetUrl the dataset url + */ public AddResourceToDataset(HandlerManager eventBus, final String datasetId, String datasetTitle, final String datasetOrg, final String datasetUrl) { initWidget(uiBinder.createAndBindUi(this)); @@ -115,6 +133,9 @@ public class AddResourceToDataset extends Composite { } + /** + * Bind. + */ private void bind() { eventBus.addHandler(WorkspaceItemSelectedEvent.TYPE, new WorkspaceItemSelectedEventHandler() { @@ -149,6 +170,11 @@ public class AddResourceToDataset extends Composite { } + /** + * On select from workspace click. + * + * @param e the e + */ @UiHandler("buttoSelectFromWorkspace") void onSelectFromWorkspaceClick(ClickEvent e) { @@ -165,6 +191,11 @@ public class AddResourceToDataset extends Composite { dialog.center(); } + /** + * On add button click. + * + * @param e the e + */ @UiHandler("addResourceButton") void onAddButtonClick(ClickEvent e) { @@ -228,8 +259,7 @@ public class AddResourceToDataset extends Composite { } else showAlert("Unable to add this resource. Check that the url is correct", null, AlertType.ERROR, true, true); - - + addResourceButton.setEnabled(true); } @@ -239,7 +269,7 @@ public class AddResourceToDataset extends Composite { infoPanel.clear(); showAlert("Unable to add this resource, sorry. Error is: " + caught.getMessage(), null, AlertType.ERROR, true, true); - + addResourceButton.setEnabled(true); } @@ -249,9 +279,12 @@ public class AddResourceToDataset extends Composite { /** * Show error/success after resource creation attempt. - * - * @param text - * @param type + * + * @param text the text + * @param loader the loader + * @param type the type + * @param scheduleHide the schedule hide + * @param setVisible the set visible */ protected void showAlert(String text, LoaderIcon loader, AlertType type, boolean scheduleHide, boolean setVisible) { diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/ResourceInfoForm.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/ResourceInfoForm.java index 3e35839..0a1788f 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/ResourceInfoForm.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/ResourceInfoForm.java @@ -16,7 +16,6 @@ import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HasHorizontalAlignment; import com.google.gwt.user.client.ui.HorizontalPanel; import com.google.gwt.user.client.ui.Widget; @@ -62,7 +61,7 @@ public class ResourceInfoForm extends Composite{ resourcePath.setText(resource.getFullPath()); closeButton.getElement().getStyle().setFloat(Float.RIGHT); closeButton.setIcon(IconType.REMOVE_CIRCLE); - commandPanel.setCellHorizontalAlignment(updateResourceButton, HasHorizontalAlignment.ALIGN_RIGHT); + //commandPanel.setCellHorizontalAlignment(updateResourceButton, HasHorizontalAlignment.ALIGN_RIGHT); commandPanel.getElement().getStyle().setMarginTop(10, Unit.PX); updateResourceButton.addClickHandler(new ClickHandler() { diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/ResourceInfoForm.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/ResourceInfoForm.ui.xml index 98c045c..588c3e8 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/ResourceInfoForm.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/ResourceInfoForm.ui.xml @@ -14,8 +14,8 @@ padding: 5px; border: 1px solid #bbb; border-radius: 5px; - height: 320px; - width: 700px; + height: 300px; + /*width: 700px;*/ margin-bottom: 20px; } @@ -32,11 +32,11 @@ } .custom-input input { - width: 350px; + width: 80%; } .custom-input textarea { - width: 355px; + width: 81%; } @@ -45,7 +45,7 @@ Resource Information + title="Close details" visible="false"> - Update + Update diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.ui.xml index 54fb234..3c0b93e 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectResourceByWEMainPanel.ui.xml @@ -40,14 +40,14 @@ Select + type="INFO" addStyleNames="{style.margin-top-10}">Select diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectedResourceWidget.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectedResourceWidget.java index 3835c5a..2ec9915 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectedResourceWidget.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectedResourceWidget.java @@ -7,9 +7,12 @@ import com.github.gwtbootstrap.client.ui.constants.ButtonType; 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.MouseDownEvent; +import com.google.gwt.event.dom.client.MouseDownHandler; 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.HTMLPanel; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.Widget; @@ -19,7 +22,7 @@ import com.google.gwt.user.client.ui.Widget; * * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * - * Mar 12, 2021 + * Mar 12, 2021 */ public class SelectedResourceWidget extends Composite { @@ -31,7 +34,7 @@ public class SelectedResourceWidget extends Composite { * * @author Francesco Mangiacrapa at ISTI-CNR (francesco.mangiacrapa@isti.cnr.it) * - * Mar 12, 2021 + * Mar 12, 2021 */ interface SelectedResourceWidgetUiBinder extends UiBinder { } @@ -54,14 +57,22 @@ public class SelectedResourceWidget extends Composite { /** The field name. */ @UiField Label fieldName; - + @UiField Label fieldDescription; - + /** The edit panel. */ @UiField HTMLPanel editPanel; + @UiField + FlowPanel resourcePanel; + + @UiField + FlowPanel selectedResourcesPanelTitle; + + private boolean selectetResource = false; + /** The resource bean. */ private ResourceElementBean resourceBean; @@ -79,46 +90,66 @@ public class SelectedResourceWidget extends Composite { addHandlers(); } - + private void updateFields() { this.fieldName.setText(resourceBean.getEditableName()); - - if(resourceBean.getDescription()!=null && !resourceBean.getDescription().isEmpty()) { + + if (resourceBean.getDescription() != null && !resourceBean.getDescription().isEmpty()) { this.fieldDescription.setVisible(true); this.fieldDescription.setText(resourceBean.getDescription()); - }else + } else this.fieldDescription.setVisible(false); } - + /** * Adds the handlers. */ private void addHandlers() { - + buttonEdit.addClickHandler(new ClickHandler() { - + @Override public void onClick(ClickEvent event) { - editPanel.clear(); - ResourceInfoForm resourceInformationInfo = new ResourceInfoForm(resourceBean) { - protected void onUnload() { - super.onUnload(); - updateFields(); - }; - }; - editPanel.add(resourceInformationInfo); - + manageEditOpenResource(); + } }); - + buttonDelete.addClickHandler(new ClickHandler() { - + @Override public void onClick(ClickEvent event) { SelectResourceByWEMainPanel.eventBus.fireEvent(new RemovePublishingResourceEvent(resourceBean)); } }); - + + MouseDownHandler handler = new MouseDownHandler() { + + @Override + public void onMouseDown(MouseDownEvent event) { + manageEditOpenResource(); + + } + }; + + selectedResourcesPanelTitle.addDomHandler(handler, MouseDownEvent.getType()); + } + + private void manageEditOpenResource() { + + editPanel.clear(); + if (selectetResource) { + selectetResource = false; + } else { + ResourceInfoForm resourceInformationInfo = new ResourceInfoForm(resourceBean) { + protected void onUnload() { + super.onUnload(); + updateFields(); + }; + }; + editPanel.add(resourceInformationInfo); + selectetResource = true; + } } /** diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectedResourceWidget.ui.xml b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectedResourceWidget.ui.xml index 009dec0..bcb0df3 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectedResourceWidget.ui.xml +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/client/ui/workspace/SelectedResourceWidget.ui.xml @@ -7,14 +7,6 @@ font-weight: bold; } - .selected-resources { - - } - - .selected-resources td { - vertical-align: middle !important; - } - .margin-bottom-8 { margin-bottom: 8px; } @@ -26,7 +18,7 @@ } .title-text { - font-weight: bold; + /*font-weight: bold;*/ font-size: 14px; display: inline; vertical-align: middle; @@ -41,14 +33,18 @@ } - + - + + + diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/public/CKanMetadataPublisher.css b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/public/CKanMetadataPublisher.css index d1300e7..29d2735 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/public/CKanMetadataPublisher.css +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/public/CKanMetadataPublisher.css @@ -62,6 +62,24 @@ padding: 4px 4px !important; } +.selected-resources-ws { + background-color: #f1f3f9 !important; + padding: 5px; + box-shadow: 0px 3px #888; + border-radius: 3px; +} + +.selected-resources-ws td { + vertical-align: middle !important; +} + +.selected-resources-ws-title { + display: inline; +} +.selected-resources-ws-title:hover { + cursor: pointer; +} + /* WIZARD-CREATOR CLASSES */ .wizard-creator { width: 100%; diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java index f0a77fb..1fa556e 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/CKANPublisherServicesImpl.java @@ -1187,8 +1187,9 @@ public class CKANPublisherServicesImpl extends RemoteServiceServlet implements C logger.info("Checking if the user " + username + " can publish or not on the catalogue"); if (!isWithinPortal()) { - logger.warn("OUT FROM PORTAL DETECTED RETURNING TRUE"); - return true; + boolean isPublisherFunny = true; + logger.warn("OUT FROM PORTAL DETECTED RETURNING: "+isPublisherFunny); + return isPublisherFunny; } try { diff --git a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/CatalogueRoleManager.java b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/CatalogueRoleManager.java index da8ff78..c94c7f0 100644 --- a/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/CatalogueRoleManager.java +++ b/src/main/java/org/gcube/portlets/widgets/ckandatapublisherwidget/server/utils/CatalogueRoleManager.java @@ -73,7 +73,8 @@ public class CatalogueRoleManager { List listGroups = groupManager.listGroupsByUser(userid); groups = new HashSet(listGroups); } - + + //Used by Workspace? // root (so check into the root, the VOs and the VRES) if(groupManager.isRootVO(currentGroupId)){