From 7f9ca08068afa60303e1027e1e6ab19103d83d27 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 9 Jun 2015 17:07:57 +0000 Subject: [PATCH] 209: TDM - Show the resources through a ListView widget Task-Url: https://support.d4science.org/issues/209 Updated UI behaviour git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widget-common-event@115281 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../client/event/UIStateEvent.java | 41 ++++++++++++------- .../shared/dataview/DataViewType.java | 5 +-- .../dataview/TabularResourceDataView.java | 6 +-- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/client/event/UIStateEvent.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/client/event/UIStateEvent.java index b4af9e8..e6540e8 100644 --- a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/client/event/UIStateEvent.java +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/client/event/UIStateEvent.java @@ -2,6 +2,7 @@ package org.gcube.portlets.user.td.widgetcommonevent.client.event; import org.gcube.portlets.user.td.widgetcommonevent.client.type.UIStateType; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; +import org.gcube.portlets.user.td.widgetcommonevent.shared.dataview.DataViewType; import com.google.gwt.event.shared.EventHandler; import com.google.gwt.event.shared.GwtEvent; @@ -10,8 +11,8 @@ import com.google.gwt.event.shared.HasHandlers; /** * - * @author "Giancarlo Panichi" - * g.panichi@isti.cnr.it + * @author "Giancarlo Panichi" g.panichi@isti.cnr.it * */ public class UIStateEvent extends GwtEvent { @@ -19,23 +20,32 @@ public class UIStateEvent extends GwtEvent { public static Type TYPE = new Type(); private UIStateType uiStateType; private TRId trId; - + private DataViewType dataViewType; + public interface UIStateHandler extends EventHandler { void onUIState(UIStateEvent event); } - - public interface HasUIStateHandler extends HasHandlers{ + + public interface HasUIStateHandler extends HasHandlers { public HandlerRegistration addUIStateHandler(UIStateHandler handler); } public UIStateEvent(UIStateType uiStateType) { this.uiStateType = uiStateType; + this.trId=null; + this.dataViewType=DataViewType.GRID; + } + + public UIStateEvent(UIStateType uiStateType, TRId trId, DataViewType dataViewType) { + this.uiStateType = uiStateType; + this.trId=trId; + this.dataViewType=dataViewType; } public UIStateType getUIStateType() { return uiStateType; } - + @Override protected void dispatch(UIStateHandler handler) { handler.onUIState(this); @@ -50,12 +60,10 @@ public class UIStateEvent extends GwtEvent { return TYPE; } - public static void fire(HasHandlers source, UIStateType uiStateType) { - source.fireEvent(new UIStateEvent(uiStateType)); + public static void fire(HasHandlers source, UIStateEvent uiStateEvent) { + source.fireEvent(uiStateEvent); } - - public TRId getTrId() { return trId; } @@ -64,13 +72,18 @@ public class UIStateEvent extends GwtEvent { this.trId = trId; } + public DataViewType getDataViewType() { + return dataViewType; + } + + public void setDataViewType(DataViewType dataViewType) { + this.dataViewType = dataViewType; + } + @Override public String toString() { return "UIStateEvent [uiStateType=" + uiStateType + ", trId=" + trId - + "]"; + + ", dataViewType=" + dataViewType + "]"; } - - - } diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/dataview/DataViewType.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/dataview/DataViewType.java index 5850f02..aa365c9 100644 --- a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/dataview/DataViewType.java +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/dataview/DataViewType.java @@ -7,9 +7,8 @@ package org.gcube.portlets.user.td.widgetcommonevent.shared.dataview; * */ public enum DataViewType { - TABULARRESOURCE("TabularResource"), - MAP("Map"), - TABLE("Table"); + GRID("Grid"), + RESOURCES("Resources"); /** * @param text diff --git a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/dataview/TabularResourceDataView.java b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/dataview/TabularResourceDataView.java index 684ebc1..241d464 100644 --- a/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/dataview/TabularResourceDataView.java +++ b/src/main/java/org/gcube/portlets/user/td/widgetcommonevent/shared/dataview/TabularResourceDataView.java @@ -18,20 +18,20 @@ public class TabularResourceDataView extends DataView { public TabularResourceDataView() { super(); - dataViewType = DataViewType.TABULARRESOURCE; + dataViewType = DataViewType.GRID; } public TabularResourceDataView(TRId trId) { super(); - dataViewType = DataViewType.TABULARRESOURCE; + dataViewType = DataViewType.GRID; this.trId = trId; this.tabName = null; } public TabularResourceDataView(TRId trId, String tabName) { super(); - dataViewType = DataViewType.TABULARRESOURCE; + dataViewType = DataViewType.GRID; this.trId = trId; this.tabName = tabName; }