share link widget embedded

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@146521 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-04-03 14:43:36 +00:00
parent 9aa733e658
commit 0d5c92e005
10 changed files with 125 additions and 17 deletions

View File

@ -6,22 +6,12 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/gcube-ckan-datacatalog-1.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
@ -34,5 +24,15 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/gcube-ckan-datacatalog-1.3.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/gcube-ckan-datacatalog-1.3.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -4,7 +4,7 @@
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<dependent-module archiveName="grsf-manage-widget-1.1.0-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/grsf-manage-widget/grsf-manage-widget">
<dependent-module archiveName="ckan-metadata-publisher-widget-1.2.2-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/ckan-metadata-publisher-widget/ckan-metadata-publisher-widget">
<dependency-type>uses</dependency-type>
</dependent-module>
<property name="context-root" value="gcube-ckan-datacatalog"/>

View File

@ -89,6 +89,13 @@
</dependency>
<!-- END FWS -->
<!-- share link widget -->
<dependency>
<groupId>org.gcube.portlets-widgets</groupId>
<artifactId>catalogue-sharing-widget</artifactId>
<version>[1.0.0-SNAPSHOT, 2.0.0-SNAPSHOT)</version>
</dependency>
<!-- Metadata publisher widget -->
<dependency>
<groupId>org.gcube.portlets.widgets</groupId>
@ -232,7 +239,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2</version>
<configuration>
<descriptors>
<descriptor>${distroDirectory}/descriptor.xml</descriptor>

View File

@ -20,11 +20,11 @@
<!-- Inherits widget -->
<inherits
name='org.gcube.portlets.widgets.ckandatapublisherwidget.CKanMetadataPublisher' />
<inherits
name='org.gcube.datacatalogue.grsf_manage_widget.GRSFManageWidget' />
name='org.gcube.portlets_widgets.catalogue_sharing_widget.ShareCatalogue' />
<inherits
name='org.gcube.datacatalogue.ckanutillibrary.CkanUtilLibrary' />
name='org.gcube.portlets.widgets.ckandatapublisherwidget.CKanMetadataPublisher' />
<inherits name='org.gcube.datacatalogue.grsf_manage_widget.GRSFManageWidget' />
<inherits name='org.gcube.datacatalogue.ckanutillibrary.CkanUtilLibrary' />
<inherits name='org.gcube.portlets.user.gcubewidgets.WidgetFactory' />
<!-- Specify the paths for translatable code -->

View File

@ -10,6 +10,8 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMeta
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.NotifyLogoutEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.NotifyLogoutEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShareLinkEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShareLinkEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowDatasetsEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowDatasetsEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowGroupsEvent;
@ -26,6 +28,7 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view.GCubeCkanDa
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEvent;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.CreateDatasetForm;
import org.gcube.portlets_widgets.catalogue_sharing_widget.client.ShareCatalogueWidget;
import com.github.gwtbootstrap.client.ui.Modal;
import com.github.gwtbootstrap.client.ui.event.HideEvent;
@ -202,6 +205,16 @@ public class CkanEventHandlerManager {
new ManageProductWidget(event.getProductIdentifier());
}
});
eventBus.addHandler(ShareLinkEvent.TYPE, new ShareLinkEventHandler() {
@Override
public void onShareLink(ShareLinkEvent event) {
new ShareCatalogueWidget(event.getUuidItem());
}
});
}
/**

View File

@ -0,0 +1,42 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* On share link button press event
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class ShareLinkEvent extends GwtEvent<ShareLinkEventHandler>{
public static Type<ShareLinkEventHandler> TYPE = new Type<ShareLinkEventHandler>();
private String uuidItem;
/**
* Instantiates a new insert metadata event.
*/
public ShareLinkEvent(String uuidItem) {
this.uuidItem = uuidItem;
}
public String getUuidItem() {
return uuidItem;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<ShareLinkEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(ShareLinkEventHandler handler) {
handler.onShareLink(this);
}
}

View File

@ -0,0 +1,11 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* On share link button press event
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public interface ShareLinkEventHandler extends EventHandler {
void onShareLink(ShareLinkEvent event);
}

View File

@ -5,6 +5,7 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.EditMetadataEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.InsertMetadataEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShareLinkEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowDatasetsEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowGroupsEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowHomeEvent;
@ -46,6 +47,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
private Button organizations = new Button("Organizations");
private Button groups = new Button("Groups");
private Button items = new Button("Items");
private Button shareLink = new Button("Share Link");
// user's own
private InlineHTML separatorMyInfo = null;
@ -77,7 +79,11 @@ public class CkanMetadataManagementPanel extends FlowPanel{
organizations.setType(ButtonType.LINK);
groups.setType(ButtonType.LINK);
items.setType(ButtonType.LINK);
shareLink.setType(ButtonType.LINK);
shareLink.setEnabled(false);
shareLink.setTitle("Get the link of this item and share it!");
myDatasets.setType(ButtonType.LINK);
myOrganizations.setType(ButtonType.LINK);
myGroups.setType(ButtonType.LINK);
@ -94,6 +100,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
organizations.setIcon(IconType.BUILDING);
groups.setIcon(IconType.GROUP);
items.setIcon(IconType.SITEMAP);
shareLink.setIcon(IconType.SHARE);
myDatasets.setIcon(IconType.SITEMAP);
myOrganizations.setIcon(IconType.BUILDING);
myGroups.setIcon(IconType.GROUP);
@ -118,6 +125,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
nav.add(groups);
nav.add(items);
nav.add(statistics);
nav.add(shareLink);
separatorMyInfo = new InlineHTML("<span style=\"font-weight:bold;vertical-alignment:middle;\">|</span>");
separatorMyInfo.setVisible(true);
nav.add(separatorMyInfo);
@ -251,6 +259,16 @@ public class CkanMetadataManagementPanel extends FlowPanel{
}
});
shareLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
eventBus.fireEvent(new ShareLinkEvent(GCubeCkanDataCatalogPanel.getLatestSelectedProductIdentifier()));
}
});
}
/**
@ -289,6 +307,13 @@ public class CkanMetadataManagementPanel extends FlowPanel{
public void enableManageProductButton(boolean value){
manageProduct.setEnabled(value);
}
/**
* Enable or disable the share link button
*/
public void enableShareItemButton(boolean value){
shareLink.setEnabled(value);
}
/**
* Show only home/statistics buttons

View File

@ -386,6 +386,7 @@ public class GCubeCkanDataCatalogPanel extends BaseViewTemplate {
// show or hide the manage product button
if(!isProductKeyMissing){
latestSelectedProductIdentifier = productId.toString();
managementPanel.enableShareItemButton(productId != null && !productId.isEmpty());
managementPanel.enableManageProductButton(productId != null && !productId.isEmpty() && isManageProductToShow);
}
} else {

View File

@ -49,6 +49,16 @@
<servlet-class>org.gcube.datacatalogue.grsf_manage_widget.server.manage.GRSFNotificationService</servlet-class>
</servlet>
<servlet>
<servlet-name>shareservices</servlet-name>
<servlet-class>org.gcube.portlets_widgets.catalogue_sharing_widget.server.ShareServicesImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>shareservices</servlet-name>
<url-pattern>/gCubeCkanDataCatalog/shareservices</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>gcubeckandatacatalogservice</servlet-name>
<url-pattern>/gCubeCkanDataCatalog/ckandatacatalogue</url-pattern>