Updated the ShowDatasetsEvents
This commit is contained in:
parent
2f6ddcf2a0
commit
a5efc60c57
|
@ -39,6 +39,8 @@ import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModerat
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorWidgetTrusted;
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.CkanContentModeratorWidgetTrusted;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.client.ContentModeratorWidgetConstants;
|
import org.gcube.portlets.widgets.ckancontentmoderator.client.ContentModeratorWidgetConstants;
|
||||||
import org.gcube.portlets.widgets.ckancontentmoderator.shared.DISPLAY_FIELD;
|
import org.gcube.portlets.widgets.ckancontentmoderator.shared.DISPLAY_FIELD;
|
||||||
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.ReloadDatasetPageEvent;
|
||||||
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.ReloadDatasetPageEventHandler;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.CreateDatasetForm;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.CreateDatasetForm;
|
||||||
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.UpdateDatasetForm;
|
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.ui.form.UpdateDatasetForm;
|
||||||
import org.gcube.portlets_widgets.catalogue_sharing_widget.client.ShareCatalogueWidget;
|
import org.gcube.portlets_widgets.catalogue_sharing_widget.client.ShareCatalogueWidget;
|
||||||
|
@ -96,6 +98,7 @@ public class CkanEventHandlerManager {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// bind on insert metadata
|
// bind on insert metadata
|
||||||
eventBus.addHandler(InsertMetadataEvent.TYPE, new InsertMetadataEventHandler() {
|
eventBus.addHandler(InsertMetadataEvent.TYPE, new InsertMetadataEventHandler() {
|
||||||
|
|
||||||
|
@ -131,15 +134,6 @@ public class CkanEventHandlerManager {
|
||||||
modal.show();
|
modal.show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// bind on edit (TODO)
|
|
||||||
eventBus.addHandler(EditMetadataEvent.TYPE, new EditMetadataEventHandler() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onEditMetadata(EditMetadataEvent editMetadataEvent) {
|
|
||||||
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// show datasets event
|
// show datasets event
|
||||||
eventBus.addHandler(ShowDatasetsEvent.TYPE, new ShowDatasetsEventHandler() {
|
eventBus.addHandler(ShowDatasetsEvent.TYPE, new ShowDatasetsEventHandler() {
|
||||||
|
@ -147,14 +141,35 @@ public class CkanEventHandlerManager {
|
||||||
@Override
|
@Override
|
||||||
public void onShowDatasets(ShowDatasetsEvent showUserDatasetsEvent) {
|
public void onShowDatasets(ShowDatasetsEvent showUserDatasetsEvent) {
|
||||||
String request = null;
|
String request = null;
|
||||||
if (showUserDatasetsEvent.isOwnOnly())
|
|
||||||
request = getCkanRequest("/dashboard/datasets", null);
|
if (showUserDatasetsEvent.getDatasetId() == null) {
|
||||||
else
|
if (showUserDatasetsEvent.isOwnOnly()) {
|
||||||
request = getCkanRequest("/dataset", null);
|
request = getCkanRequest("/dashboard/datasets", null);
|
||||||
|
} else {
|
||||||
|
request = getCkanRequest("/dataset", null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
String datasetId = showUserDatasetsEvent.getDatasetId();
|
||||||
|
request = getCkanRequest("/dataset/" + datasetId, null);
|
||||||
|
|
||||||
|
}
|
||||||
gcubeCkanDataCatalogue.instanceCkanFrame(request);
|
gcubeCkanDataCatalogue.instanceCkanFrame(request);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ReloadDatasetPageEvent is declared in the Publisher Widget
|
||||||
|
eventBus.addHandler(ReloadDatasetPageEvent.TYPE, new ReloadDatasetPageEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onReloadDatasetPage(ReloadDatasetPageEvent addResourceEvent) {
|
||||||
|
|
||||||
|
if (addResourceEvent.getDatasetIDorName() != null) {
|
||||||
|
eventBus.fireEvent(new ShowDatasetsEvent(false, addResourceEvent.getDatasetIDorName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
eventBus.addHandler(ShowTypesEvent.TYPE, new ShowTypesEventHandler() {
|
eventBus.addHandler(ShowTypesEvent.TYPE, new ShowTypesEventHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -325,27 +340,10 @@ public class CkanEventHandlerManager {
|
||||||
modal.add(new UpdateDatasetForm(eventBus, editMetadataEvent.getItemID()));
|
modal.add(new UpdateDatasetForm(eventBus, editMetadataEvent.getItemID()));
|
||||||
modal.setCloseVisible(true);
|
modal.setCloseVisible(true);
|
||||||
|
|
||||||
// // hide any popup gcubeCkanDataCatalogue opened
|
|
||||||
// modal.addHideHandler(new HideHandler() {
|
|
||||||
//
|
|
||||||
// @Override
|
|
||||||
// public void onHide(HideEvent hideEvent) {
|
|
||||||
// GWT.log("HideEvent on modal fired");
|
|
||||||
// GWT.log(hideEvent.toDebugString());
|
|
||||||
// eventBus.fireEvent(new CloseCreationFormProfileEvent());
|
|
||||||
//
|
|
||||||
// hideEvent.preventDefault();
|
|
||||||
// hideEvent.stopPropagation();
|
|
||||||
// return;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
GWT.log("show");
|
GWT.log("show");
|
||||||
modal.show();
|
modal.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,25 +2,28 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class NotifyLogoutEvent.
|
* The Class IFrameInstanciedEvent.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it Jun 23, 2016
|
||||||
* Jun 23, 2016
|
|
||||||
*/
|
*/
|
||||||
public class IFrameInstanciedEvent extends GwtEvent<IFrameInstanciedEventHandler> {
|
public class IFrameInstanciedEvent extends GwtEvent<IFrameInstanciedEventHandler> {
|
||||||
public static Type<IFrameInstanciedEventHandler> TYPE = new Type<IFrameInstanciedEventHandler>();
|
public static Type<IFrameInstanciedEventHandler> TYPE = new Type<IFrameInstanciedEventHandler>();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new insert metadata event.
|
* Instantiates a new insert metadata event.
|
||||||
*/
|
*/
|
||||||
public IFrameInstanciedEvent() {
|
public IFrameInstanciedEvent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,8 +31,17 @@ public class IFrameInstanciedEvent extends GwtEvent<IFrameInstanciedEventHandler
|
||||||
return TYPE;
|
return TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
* Dispatch.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||||
|
* EventHandler)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void dispatch(IFrameInstanciedEventHandler handler) {
|
protected void dispatch(IFrameInstanciedEventHandler handler) {
|
||||||
|
|
|
@ -2,17 +2,15 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
|
||||||
|
|
||||||
import com.google.gwt.event.shared.EventHandler;
|
import com.google.gwt.event.shared.EventHandler;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Interface IFrameInstanciedEentHandler.
|
* The Interface IFrameInstanciedEventHandler.
|
||||||
*
|
*
|
||||||
* @author Francesco Mangiacrapa francesco.mangiacrapa@isti.cnr.it
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
* Jun 23, 2016
|
*
|
||||||
|
* Feb 13, 2024
|
||||||
*/
|
*/
|
||||||
public interface IFrameInstanciedEventHandler extends EventHandler {
|
public interface IFrameInstanciedEventHandler extends EventHandler {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On new instance.
|
* On new instance.
|
||||||
*
|
*
|
||||||
|
|
|
@ -3,29 +3,57 @@ package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
|
||||||
import com.google.gwt.event.shared.GwtEvent;
|
import com.google.gwt.event.shared.GwtEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Raised when the user wants to see his datasets.
|
* The Class ShowDatasetsEvent.
|
||||||
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
|
*
|
||||||
|
* @author Francesco Mangiacrapa at ISTI-CNR francesco.mangiacrapa@isti.cnr.it
|
||||||
|
*
|
||||||
|
* Feb 13, 2024
|
||||||
*/
|
*/
|
||||||
public class ShowDatasetsEvent extends GwtEvent<ShowDatasetsEventHandler>{
|
public class ShowDatasetsEvent extends GwtEvent<ShowDatasetsEventHandler> {
|
||||||
|
|
||||||
public static Type<ShowDatasetsEventHandler> TYPE = new Type<ShowDatasetsEventHandler>();
|
public static Type<ShowDatasetsEventHandler> TYPE = new Type<ShowDatasetsEventHandler>();
|
||||||
|
|
||||||
private boolean ownOnly;
|
private boolean ownOnly;
|
||||||
|
|
||||||
|
private String datasetId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new show user datasets event.
|
* Instantiates a new show user datasets event.
|
||||||
|
*
|
||||||
|
* @param ownOnly the own only
|
||||||
*/
|
*/
|
||||||
public ShowDatasetsEvent(boolean ownOnly) {
|
public ShowDatasetsEvent(boolean ownOnly) {
|
||||||
|
|
||||||
this.ownOnly = ownOnly;
|
this.ownOnly = ownOnly;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new show user datasets event.
|
||||||
|
*
|
||||||
|
* @param ownOnly the own only
|
||||||
|
* @param datasetId the dataset id
|
||||||
|
*/
|
||||||
|
public ShowDatasetsEvent(boolean ownOnly, String datasetId) {
|
||||||
|
this.ownOnly = ownOnly;
|
||||||
|
this.datasetId = datasetId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is own only.
|
||||||
|
*
|
||||||
|
* @return true, if is own only
|
||||||
|
*/
|
||||||
public boolean isOwnOnly() {
|
public boolean isOwnOnly() {
|
||||||
return ownOnly;
|
return ownOnly;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
|
* Gets the associated type.
|
||||||
|
*
|
||||||
|
* @return the associated type
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,12 +61,25 @@ public class ShowDatasetsEvent extends GwtEvent<ShowDatasetsEventHandler>{
|
||||||
return TYPE;
|
return TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
|
* Dispatch.
|
||||||
|
*
|
||||||
|
* @param handler the handler
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.
|
||||||
|
* EventHandler)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void dispatch(ShowDatasetsEventHandler handler) {
|
protected void dispatch(ShowDatasetsEventHandler handler) {
|
||||||
handler.onShowDatasets(this);
|
handler.onShowDatasets(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDatasetId() {
|
||||||
|
return datasetId;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue