From d10dacdaf7370676004d89e6841ac7646c50081e Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Tue, 9 Jun 2015 16:57:27 +0000 Subject: [PATCH] 209: TDM - Show the resources through a ListView widget Task-Url: https://support.d4science.org/issues/209 Updated Resources git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-mainbox-widget@115276 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../td/mainboxwidget/client/MainBoxEntry.java | 4 ++-- .../td/mainboxwidget/client/MainBoxPanel.java | 14 +----------- .../mainboxwidget/client/tdx/TDXTabPanel.java | 22 +++++++++++++++++-- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/MainBoxEntry.java b/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/MainBoxEntry.java index 830e29f..237dc7d 100644 --- a/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/MainBoxEntry.java +++ b/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/MainBoxEntry.java @@ -6,6 +6,7 @@ import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo; import org.gcube.portlets.user.td.widgetcommonevent.client.event.UIStateEvent; 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 org.gcube.portlets.user.td.widgetcommonevent.shared.tr.TabResourceType; import com.allen_sauer.gwt.log.client.Log; @@ -108,8 +109,7 @@ public class MainBoxEntry implements EntryPoint { startInDevMode(mainBoxPanel); - UIStateEvent uiStateEvent1 = new UIStateEvent(UIStateType.TR_OPEN); - uiStateEvent1.setTrId(trId); + UIStateEvent uiStateEvent1 = new UIStateEvent(UIStateType.TR_OPEN, trId, DataViewType.GRID); eventBus.fireEvent(uiStateEvent1); diff --git a/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/MainBoxPanel.java b/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/MainBoxPanel.java index 32c4e15..4faa09b 100644 --- a/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/MainBoxPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/MainBoxPanel.java @@ -7,7 +7,6 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.event.UIStateEvent; 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.DataView; -import org.gcube.portlets.user.td.widgetcommonevent.shared.dataview.DataViewType; import org.gcube.portlets.user.td.widgetcommonevent.shared.dataview.TabularResourceDataView; import com.allen_sauer.gwt.log.client.Log; @@ -110,18 +109,7 @@ public class MainBoxPanel extends ContentPanel { if (dataView == null || dataView.getDataViewType() == null) { return; } - DataViewType dataViewType = dataView.getDataViewType(); - - switch (dataViewType) { - case TABULARRESOURCE: - doTabularResourceTab(event); - break; - case TABLE: - break; - default: - break; - - } + doTabularResourceTab(event); } protected void doTabularResourceTab(DataViewRequestEvent event) { diff --git a/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/tdx/TDXTabPanel.java b/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/tdx/TDXTabPanel.java index 7f766f7..61afeb6 100644 --- a/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/tdx/TDXTabPanel.java +++ b/src/main/java/org/gcube/portlets/user/td/mainboxwidget/client/tdx/TDXTabPanel.java @@ -64,16 +64,34 @@ public class TDXTabPanel extends TabPanel { public void open(TabularResourceDataView dataView) { gridPanel.open(dataView); resourcesPanel.open(dataView.getTrId()); - forceLayout(); + setCurrentWidgetActive(dataView); } public void update(TabularResourceDataView dataView) { gridPanel.update(dataView); resourcesPanel.open(dataView.getTrId()); - forceLayout(); + setCurrentWidgetActive(dataView); } + + protected void setCurrentWidgetActive(TabularResourceDataView dataView) { + if(dataView!=null&&dataView.getDataViewType()!=null){ + switch (dataView.getDataViewType()) { + case RESOURCES: + setActiveWidget(resourcesPanel); + break; + case GRID: + setActiveWidget(gridPanel); + break; + default: + break; + } + } + forceLayout(); + } + + public boolean isValidDataViewRequest( TabularResourceDataView dataViewRequest) {