added types button to portlet header

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/gcube-ckan-datacatalog@153245 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Costantino Perciante 2017-09-19 09:55:45 +00:00
parent 49bbbf2bde
commit 69f48f2ef2
4 changed files with 90 additions and 0 deletions

View File

@ -24,6 +24,8 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowOrgani
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowOrganizationsEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowStatisticsEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowStatisticsEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowTypesEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowTypesEventHandler;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.view.GCubeCkanDataCatalogPanel;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.shared.CkanConnectorAccessPoint;
import org.gcube.portlets.widgets.ckandatapublisherwidget.client.events.CloseCreationFormEvent;
@ -134,6 +136,18 @@ public class CkanEventHandlerManager {
panel.instanceCkanFrame(request);
}
});
eventBus.addHandler(ShowTypesEvent.TYPE,
new ShowTypesEventHandler() {
@Override
public void onShowTypes(ShowTypesEvent showTypes) {
String request = getCkanRequest("/type", null);
panel.instanceCkanFrame(request);
}
});
eventBus.addHandler(
ShowOrganizationsEvent.TYPE,
new ShowOrganizationsEventHandler() {

View File

@ -0,0 +1,44 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
import com.google.gwt.event.shared.GwtEvent;
/**
* Show types page
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public class ShowTypesEvent extends GwtEvent<ShowTypesEventHandler>{
public static Type<ShowTypesEventHandler> TYPE = new Type<ShowTypesEventHandler>();
private boolean ownOnly;
/**
* Instantiates a new show user datasets event.
*/
public ShowTypesEvent(boolean ownOnly) {
this.ownOnly = ownOnly;
}
public boolean isOwnOnly() {
return ownOnly;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#getAssociatedType()
*/
@Override
public Type<ShowTypesEventHandler> getAssociatedType() {
return TYPE;
}
/* (non-Javadoc)
* @see com.google.gwt.event.shared.GwtEvent#dispatch(com.google.gwt.event.shared.EventHandler)
*/
@Override
protected void dispatch(ShowTypesEventHandler handler) {
handler.onShowTypes(this);
}
}

View File

@ -0,0 +1,17 @@
package org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event;
import com.google.gwt.event.shared.EventHandler;
/**
* Show types interface event
* @author Costantino Perciante at ISTI-CNR (costantino.perciante@isti.cnr.it)
*/
public interface ShowTypesEventHandler extends EventHandler {
/**
* Show statistics
* @param showStatisticsEvent
*/
void onShowTypes(ShowTypesEvent showTypes);
}

View File

@ -12,6 +12,7 @@ import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowHomeEv
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowManageProductWidgetEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowOrganizationsEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowStatisticsEvent;
import org.gcube.portlets.gcubeckan.gcubeckandatacatalog.client.event.ShowTypesEvent;
import com.github.gwtbootstrap.client.ui.AlertBlock;
import com.github.gwtbootstrap.client.ui.Button;
@ -47,6 +48,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 types = new Button("Types");
// user's own
private InlineHTML separatorMyInfo = null;
@ -79,6 +81,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
organizations.setType(ButtonType.LINK);
groups.setType(ButtonType.LINK);
items.setType(ButtonType.LINK);
types.setType(ButtonType.LINK);
myDatasets.setType(ButtonType.LINK);
myOrganizations.setType(ButtonType.LINK);
@ -97,6 +100,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
organizations.setIcon(IconType.BUILDING);
groups.setIcon(IconType.GROUP);
items.setIcon(IconType.SITEMAP);
types.setIcon(IconType.FILE_TEXT);
shareLink.setIcon(IconType.SHARE);
myDatasets.setIcon(IconType.SITEMAP);
myOrganizations.setIcon(IconType.BUILDING);
@ -122,6 +126,7 @@ public class CkanMetadataManagementPanel extends FlowPanel{
nav.add(organizations);
nav.add(groups);
nav.add(items);
nav.add(types);
nav.add(statistics);
separatorMyInfo = new InlineHTML("<span style=\"font-weight:bold;vertical-alignment:middle;\">|</span>");
separatorMyInfo.setVisible(true);
@ -188,6 +193,16 @@ public class CkanMetadataManagementPanel extends FlowPanel{
}
});
types.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
eventBus.fireEvent(new ShowTypesEvent(false));
}
});
insertMeta.addClickHandler(new ClickHandler() {