diff --git a/pom.xml b/pom.xml
index d4debf0..716e277 100644
--- a/pom.xml
+++ b/pom.xml
@@ -79,6 +79,34 @@
1.0.1
runtime
+
+
+ org.gcube.data.analysis.tabulardata
+ service-client-impl
+ [2.0.0-SNAPSHOT,3.0.0-SNAPSHOT)
+
+
+ org.gcube.core
+ common-scope-maps
+ [1.0.2-SNAPSHOT,2.0.0-SNAPSHOT)
+ compile
+
+
+ org.gcube.applicationsupportlayer
+ aslsocial
+
+
+ org.gcube.portal
+ custom-portal-handler
+
+
+ org.gcube.applicationsupportlayer
+ aslcore
+
+
+ org.gcube.applicationsupportlayer
+ accesslogger
+
diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListView.css b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListView.css
new file mode 100644
index 0000000..b0c4833
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListView.css
@@ -0,0 +1,41 @@
+@CHARSET "UTF-8";
+
+.thumb {
+ background: none repeat scroll 0 0 #DDDDDD;
+ padding: 3px;
+}
+
+.thumb img {
+ height: 60px;
+ width: 80px;
+}
+
+.thumbWrap {
+ border: 1px solid white;
+ float: left;
+ margin: 4px 0 4px 4px;
+ padding: 5px;
+ font: 11px Arial, Helvetica, sans-serif;
+}
+
+.thumbWrap span {
+ display: block;
+ overflow: hidden;
+ text-align: center;
+}
+
+.over {
+ background: repeat-x scroll left top #EFEFEF;
+ border: 1px solid #ddd !important;
+ padding: 5px;
+}
+
+.select {
+ background: none repeat scroll 0 50% #DFE8F6;
+ border: 1px dotted #A3BAE9 !important;
+ cursor: pointer;
+}
+
+.select .thumb {
+ background: none repeat scroll 0 0 transparent;
+}
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListView.html b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListView.html
new file mode 100644
index 0000000..91e06b7
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListView.html
@@ -0,0 +1,4 @@
+
+
+
+{resourceTDDescriptor.name:shorten(18)}
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetail.html b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetail.html
new file mode 100644
index 0000000..cd9fbb0
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetail.html
@@ -0,0 +1,8 @@
+
+
+
+ Name: {resourceTDDescriptor.name} Description:
+ {resourceTDDescriptor.description} Creation Date: {resourceTDDescriptor.creationDate}
+
+
\ No newline at end of file
diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDialog.java b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDialog.java
new file mode 100644
index 0000000..d597c66
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDialog.java
@@ -0,0 +1,64 @@
+package org.gcube.portlets.user.td.resourceswidget.client;
+
+import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo;
+import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
+
+import com.google.web.bindery.event.shared.EventBus;
+import com.sencha.gxt.widget.core.client.Window;
+import com.sencha.gxt.widget.core.client.event.SelectEvent;
+import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
+
+/**
+ * Delete Column Dialog
+ *
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
+ *
+ */
+public class ResourcesListViewDialog extends Window {
+ protected String WIDTH = "640px";
+ protected String HEIGHT = "480px";
+ protected TRId trId;
+ protected EventBus eventBus;
+ protected UserInfo userInfo;
+
+ public ResourcesListViewDialog(TRId trId, EventBus eventBus) {
+ this.trId = trId;
+ this.eventBus = eventBus;
+ initWindow();
+ ResourcesListViewPanel resourcesPanel = new ResourcesListViewPanel(
+ trId, eventBus);
+ add(resourcesPanel);
+ }
+
+ protected void initWindow() {
+ setWidth(WIDTH);
+ setHeight(HEIGHT);
+ setBodyBorder(false);
+ setResizable(false);
+ setHeadingText("Resources List View");
+ // getHeader().setIcon(Resources.IMAGES.side_list());
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ protected void initTools() {
+ super.initTools();
+
+ closeBtn.addSelectHandler(new SelectHandler() {
+
+ public void onSelect(SelectEvent event) {
+ close();
+ }
+ });
+
+ }
+
+ public void close() {
+ hide();
+
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewPanel.java b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewPanel.java
new file mode 100644
index 0000000..0b42d05
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewPanel.java
@@ -0,0 +1,438 @@
+package org.gcube.portlets.user.td.resourceswidget.client;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+
+import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
+import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
+import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
+import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDDescriptor;
+import org.gcube.portlets.user.td.resourceswidget.client.utils.UtilsGXT3;
+import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
+import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
+import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
+
+import com.allen_sauer.gwt.log.client.Log;
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.core.client.Scheduler.ScheduledCommand;
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.CssResource;
+import com.google.gwt.safehtml.shared.SafeHtml;
+import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
+import com.google.gwt.text.shared.AbstractSafeHtmlRenderer;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.HTML;
+import com.google.web.bindery.event.shared.EventBus;
+import com.sencha.gxt.cell.core.client.SimpleSafeHtmlCell;
+import com.sencha.gxt.core.client.IdentityValueProvider;
+import com.sencha.gxt.core.client.Style.SelectionMode;
+import com.sencha.gxt.core.client.XTemplates;
+import com.sencha.gxt.core.client.XTemplates.Formatter;
+import com.sencha.gxt.core.client.XTemplates.FormatterFactories;
+import com.sencha.gxt.core.client.XTemplates.FormatterFactory;
+import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
+import com.sencha.gxt.core.client.resources.CommonStyles;
+import com.sencha.gxt.core.client.resources.ThemeStyles;
+import com.sencha.gxt.core.client.util.Format;
+import com.sencha.gxt.core.client.util.Margins;
+import com.sencha.gxt.data.client.loader.RpcProxy;
+import com.sencha.gxt.data.shared.ListStore;
+import com.sencha.gxt.data.shared.ModelKeyProvider;
+import com.sencha.gxt.data.shared.SortDir;
+import com.sencha.gxt.data.shared.Store;
+import com.sencha.gxt.data.shared.Store.StoreSortInfo;
+import com.sencha.gxt.data.shared.loader.ListLoadConfig;
+import com.sencha.gxt.data.shared.loader.ListLoadResult;
+import com.sencha.gxt.data.shared.loader.ListLoader;
+import com.sencha.gxt.data.shared.loader.ListStoreBinding;
+import com.sencha.gxt.data.shared.loader.Loader;
+import com.sencha.gxt.theme.base.client.listview.ListViewCustomAppearance;
+import com.sencha.gxt.widget.core.client.Dialog;
+import com.sencha.gxt.widget.core.client.Dialog.PredefinedButton;
+import com.sencha.gxt.widget.core.client.FramedPanel;
+import com.sencha.gxt.widget.core.client.ListView;
+import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
+import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData;
+import com.sencha.gxt.widget.core.client.container.MarginData;
+import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
+import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
+import com.sencha.gxt.widget.core.client.form.StoreFilterField;
+import com.sencha.gxt.widget.core.client.selection.SelectionChangedEvent;
+import com.sencha.gxt.widget.core.client.selection.SelectionChangedEvent.SelectionChangedHandler;
+import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
+import com.sencha.gxt.widget.core.client.toolbar.SeparatorToolItem;
+import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
+
+/**
+ *
+ * ResourcesPanel shows the resources
+ *
+ *
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
+ *
+ */
+public class ResourcesListViewPanel extends FramedPanel {
+
+ public interface DetailRenderer extends XTemplates {
+ @XTemplate(source = "ResourcesListViewDetail.html")
+ public SafeHtml render(ResourceTDDescriptor resourceTDDescriptor);
+ }
+
+ @FormatterFactories(@FormatterFactory(factory = ShortenFactory.class, name = "shorten"))
+ public interface Renderer extends XTemplates {
+ @XTemplate(source = "ResourcesListView.html")
+ public SafeHtml renderItem(ResourceTDDescriptor resourceTDDescriptor,
+ ResourceListViewCSS style);
+ }
+
+ public interface ResourcesListViewBundle extends ClientBundle {
+ public static final ResourcesListViewBundle INSTANCE = GWT
+ .create(ResourcesListViewBundle.class);
+
+ @Source("ResourcesListView.css")
+ ResourceListViewCSS css();
+ }
+
+ public interface ResourceListViewCSS extends CssResource {
+ String over();
+
+ String select();
+
+ String thumb();
+
+ String thumbWrap();
+ }
+
+ static class Shorten implements Formatter {
+ private int length;
+
+ public Shorten(int length) {
+ this.length = length;
+ }
+
+ @Override
+ public String format(String data) {
+ return Format.ellipse(data, length);
+ }
+ }
+
+ static class ShortenFactory {
+ public static Shorten getFormat(int length) {
+ return new Shorten(length);
+ }
+ }
+
+ private Dialog chooser;
+ private HTML details;
+ private DetailRenderer detailRenderer;
+
+ private TRId trId;
+ private EventBus eventBus;
+
+ private ListStore store;
+ private ListLoader> loader;
+
+ private boolean drawed = false;
+
+ private ListView view;
+
+ public ResourcesListViewPanel(TRId trId, EventBus eventBus) {
+ super();
+ this.trId = trId;
+ this.eventBus = eventBus;
+ forceLayoutOnResize = true;
+ retrieveCurrentTR();
+ }
+
+ protected void draw() {
+ try {
+ drawed = true;
+ init();
+ create();
+ } catch (Throwable e) {
+ Log.error(e.getLocalizedMessage());
+ e.printStackTrace();
+ }
+ }
+
+ protected void init() {
+ setHeaderVisible(false);
+ setBodyBorder(false);
+ setResize(true);
+ setWidth("630px");
+ setHeight("470px");
+
+ }
+
+ protected void create() {
+ Log.debug("Create Resource List View");
+
+ detailRenderer = GWT.create(DetailRenderer.class);
+
+ RpcProxy> proxy = new RpcProxy>() {
+ @Override
+ public void load(Object loadConfig,
+ AsyncCallback> callback) {
+ loadData(callback);
+ }
+ };
+
+ ModelKeyProvider keyProvider = new ModelKeyProvider() {
+ @Override
+ public String getKey(ResourceTDDescriptor item) {
+ return String.valueOf(item.getId());
+ }
+ };
+
+ store = new ListStore(keyProvider);
+ store.addSortInfo(new StoreSortInfo(
+ new Comparator() {
+ @Override
+ public int compare(ResourceTDDescriptor o1,
+ ResourceTDDescriptor o2) {
+ /*
+ * String v = comboSort.getCurrentValue(); if
+ * (v.equals("Name")) { return
+ * o1.getName().compareToIgnoreCase(o2.getName()); }
+ * else if (v.equals("File Size")) { return o1.getSize()
+ * < o2.getSize() ? -1 : 1; } else {
+ * o1.getDate().compareTo(o2.getDate()); }
+ */
+ return 0;
+ }
+ }, SortDir.ASC));
+
+ final Loader> loader = new Loader>(
+ proxy);
+ loader.addLoadHandler(new ListStoreBinding>(
+ store));
+
+ // ToolBar
+
+ StoreFilterField filterField = new StoreFilterField() {
+ @Override
+ protected boolean doSelect(Store store,
+ ResourceTDDescriptor parent, ResourceTDDescriptor item,
+ String filter) {
+ String name = item.getName().toLowerCase();
+ if (name.indexOf(filter.toLowerCase()) != -1) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected void onFilter() {
+ super.onFilter();
+ view.getSelectionModel().select(0, false);
+ }
+ };
+ filterField.setWidth(100);
+ filterField.bind(store);
+
+ ToolBar toolbar = new ToolBar();
+ toolbar.add(new LabelToolItem("Filter:"));
+ toolbar.add(filterField);
+ toolbar.add(new SeparatorToolItem());
+ toolbar.add(new LabelToolItem("Sort By:"));
+ /*
+ * comboSort = new SimpleComboBox(new
+ * StringLabelProvider());
+ * comboSort.setTriggerAction(TriggerAction.ALL);
+ * comboSort.setEditable(false); comboSort.setForceSelection(true);
+ * comboSort.setWidth(120); comboSort.add("Name");
+ * comboSort.add("File Size"); comboSort.add("Last Modified");
+ * comboSort.setValue("Name"); comboSort.addSelectionHandler(new
+ * SelectionHandler() {
+ *
+ * @Override public void onSelection(SelectionEvent event) {
+ * store.applySort(false); } }); toolbar.add(comboSort);
+ */
+
+ //
+ ResourcesListViewBundle.INSTANCE.css().ensureInjected();
+
+ final ResourceListViewCSS style = ResourcesListViewBundle.INSTANCE
+ .css();
+
+ final Renderer renderer = GWT.create(Renderer.class);
+
+ ListViewCustomAppearance appearance = new ListViewCustomAppearance(
+ "." + style.thumbWrap(), style.over(), style.select()) {
+ @Override
+ public void renderEnd(SafeHtmlBuilder builder) {
+ String markup = new StringBuilder("
")
+ .toString();
+ builder.appendHtmlConstant(markup);
+ }
+
+ @Override
+ public void renderItem(SafeHtmlBuilder builder, SafeHtml content) {
+ builder.appendHtmlConstant("");
+ builder.append(content);
+ builder.appendHtmlConstant("
");
+ }
+ };
+
+ view = new ListView(store,
+ new IdentityValueProvider() {
+ @Override
+ public void setValue(ResourceTDDescriptor object,
+ ResourceTDDescriptor value) {
+ }
+ }, appearance) {
+
+ @Override
+ protected void onAfterFirstAttach() {
+ super.onAfterFirstAttach();
+
+ Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+
+ public void execute() {
+ loader.load();
+ }
+ });
+ }
+
+ };
+ view.setLoader(loader);
+ view.setCell(new SimpleSafeHtmlCell(
+ new AbstractSafeHtmlRenderer() {
+ @Override
+ public SafeHtml render(ResourceTDDescriptor object) {
+ return renderer.renderItem(object, style);
+ }
+ }));
+ view.getSelectionModel().setSelectionMode(SelectionMode.SINGLE);
+ view.getSelectionModel().addSelectionChangedHandler(
+ new SelectionChangedHandler() {
+ @Override
+ public void onSelectionChanged(
+ SelectionChangedEvent event) {
+ ResourcesListViewPanel.this.onSelectionChange(event);
+ }
+ });
+ view.setBorders(false);
+
+ VerticalLayoutContainer main = new VerticalLayoutContainer();
+ main.setScrollMode(ScrollMode.AUTO);
+ main.setAdjustForScroll(true);
+ main.setBorders(true);
+ main.add(toolbar, new VerticalLayoutData(1, -1));
+ main.add(view, new VerticalLayoutData(1, 1));
+
+ /*
+ * details = new HTML();
+ * details.addStyleName(ThemeStyles.get().style().border());
+ * details.getElement().getStyle().setBackgroundColor("white");
+ *
+ * BorderLayoutData eastData = new BorderLayoutData(200);
+ * eastData.setSplit(true);
+ *
+ * BorderLayoutData centerData = new BorderLayoutData();
+ * centerData.setMargins(new Margins(0, 5, 0, 0));
+ *
+ * BorderLayoutContainer con = new BorderLayoutContainer();
+ * con.setCenterWidget(main, centerData); con.setEastWidget(details,
+ * eastData);
+ */
+
+ add(main, new MarginData(0));
+ }
+
+ private void onSelectionChange(
+ SelectionChangedEvent se) {
+ if (se.getSelection().size() > 0) {
+ details.setHTML(detailRenderer.render(se.getSelection().get(0))
+ .asString());
+ chooser.getButton(PredefinedButton.OK).enable();
+ } else {
+ chooser.getButton(PredefinedButton.OK).disable();
+ details.setHTML("");
+ }
+ }
+
+ protected void loadData(
+ final AsyncCallback> callback) {
+ Log.debug("Called loadData");
+ TDGWTServiceAsync.INSTANCE.getResourcesTD(trId,
+ new AsyncCallback>() {
+
+ public void onFailure(Throwable caught) {
+ if (caught instanceof TDGWTSessionExpiredException) {
+ eventBus.fireEvent(new SessionExpiredEvent(
+ SessionExpiredType.EXPIREDONSERVER));
+ } else {
+ if (caught instanceof TDGWTIsLockedException) {
+ Log.error(caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error Locked",
+ caught.getLocalizedMessage());
+ } else {
+ Log.error("Error Retrieving Resources: "
+ + caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error retrieving resources",
+ "Error retrieving resources");
+ }
+ }
+ callback.onFailure(caught);
+ }
+
+ public void onSuccess(ArrayList result) {
+ Log.debug("Resources loaded " + result.size());
+ try {
+ callback.onSuccess(result);
+ } catch (Throwable e) {
+ Log.debug("Error: " + e.getLocalizedMessage());
+ e.printStackTrace();
+ }
+ }
+
+ });
+
+ }
+
+ public void update() {
+ retrieveCurrentTR();
+ loader.load();
+ forceLayout();
+ }
+
+ protected void retrieveCurrentTR() {
+ TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback() {
+
+ public void onFailure(Throwable caught) {
+ if (caught instanceof TDGWTSessionExpiredException) {
+ eventBus.fireEvent(new SessionExpiredEvent(
+ SessionExpiredType.EXPIREDONSERVER));
+ } else {
+ if (caught instanceof TDGWTIsLockedException) {
+ Log.error(caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error Locked",
+ caught.getLocalizedMessage());
+ } else {
+ Log.error("Error retrieving current TRId: "
+ + caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error",
+ "Error retrieving current tabular resource id");
+ }
+ }
+ }
+
+ public void onSuccess(TRId result) {
+ Log.debug("retrieved " + result);
+ trId = result;
+ if (!drawed) {
+ draw();
+ }
+
+ }
+
+ });
+ }
+
+}
diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesWidgetEntry.java b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesWidgetEntry.java
index bb93191..ddee274 100644
--- a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesWidgetEntry.java
+++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesWidgetEntry.java
@@ -1,44 +1,147 @@
package org.gcube.portlets.user.td.resourceswidget.client;
-
-
-import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDDescriptor;
-import org.gcube.portlets.user.td.resourceswidget.client.charts.ChartViewerDialog;
+import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
+import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
+import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
+import org.gcube.portlets.user.td.gwtservice.shared.user.UserInfo;
+import org.gcube.portlets.user.td.resourceswidget.client.utils.UtilsGXT3;
+import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
+import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
-import com.google.web.bindery.event.shared.EventBus;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.SimpleEventBus;
/**
*
- * @author "Giancarlo Panichi"
- * g.panichi@isti.cnr.it
+ * @author "Giancarlo Panichi" g.panichi@isti.cnr.it
*
*/
-public class ResourcesWidgetEntry implements EntryPoint {
+public class ResourcesWidgetEntry implements EntryPoint {
-
- private ResourceTDDescriptor resourceTDDescriptor;
+ // private ResourceTDDescriptor resourceTDDescriptor;
+
+ private SimpleEventBus eventBus;
+ private TRId trId;
+ private TabResource tabResource;
public void onModuleLoad() {
- EventBus eventBus= new SimpleEventBus();
-
-
- TRId trId=new TRId();
- //For example Tabular Resource 7 and table 402
- trId.setId("7");
- trId.setTableId("402");
-
- //ResourcesDialog dialog=new ResourcesDialog(trId,eventBus);
- //dialog.show();
-
- resourceTDDescriptor=new ResourceTDDescriptor();
- resourceTDDescriptor.setName("Test Chart");
- ChartViewerDialog chartDialog=new ChartViewerDialog(resourceTDDescriptor, trId, eventBus, true);
- chartDialog.show();
-
Log.info("Hello!");
+ eventBus = new SimpleEventBus();
+ trId = new TRId();
+ //TabularResource: [ id=202, type=STANDARD, lastTable=[ id=4901, type=Generic]]
+ //TabularResource: [ id=68, type=STANDARD, lastTable=[ id=4884, type=Dataset]]
+
+ trId.setId("68");
+ trId.setTableType("STANDARD");
+ trId.setTableId("4884");
+ retrieveUserInfo();
}
+
+ private void start() {
+ try {
+ // ResourcesDialog dialog=new ResourcesDialog(trId,eventBus);
+ // dialog.show();
+
+ /*
+ * resourceTDDescriptor=new ResourceTDDescriptor();
+ * resourceTDDescriptor.setName("Test Chart"); ChartViewerDialog
+ * chartDialog=new ChartViewerDialog(resourceTDDescriptor, trId,
+ * eventBus, true); chartDialog.show();
+ */
+
+ ResourcesListViewDialog resourcesListViewDialog = new ResourcesListViewDialog(
+ trId, eventBus);
+ resourcesListViewDialog.show();
+ } catch (Throwable e) {
+ Log.error(e.getLocalizedMessage());
+ }
+ }
+
+ protected void retrieveUserInfo() {
+ TDGWTServiceAsync.INSTANCE.hello(new AsyncCallback() {
+
+ public void onFailure(Throwable caught) {
+ if (caught instanceof TDGWTSessionExpiredException) {
+ eventBus.fireEvent(new SessionExpiredEvent(
+ SessionExpiredType.EXPIREDONSERVER));
+ } else {
+
+ Log.error("Error Retrieving User Info: "
+ + caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error", "Error retrieving User Info");
+
+ }
+ }
+
+ public void onSuccess(UserInfo userInfo) {
+ Log.debug("User Info: " + userInfo);
+ getTabularResource();
+ }
+
+ });
+ }
+
+
+ protected void getTabularResource(){
+ TDGWTServiceAsync.INSTANCE.getTabResourceInformation(trId, new AsyncCallback() {
+
+
+
+ @Override
+ public void onFailure(Throwable caught) {
+ if (caught instanceof TDGWTSessionExpiredException) {
+ eventBus.fireEvent(new SessionExpiredEvent(
+ SessionExpiredType.EXPIREDONSERVER));
+ } else {
+
+ Log.error("Error get TR information: "
+ + caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error", "Error get TR information");
+
+ }
+
+ }
+
+ @Override
+ public void onSuccess(TabResource result) {
+ Log.debug("TabResource:"+result);
+ tabResource=result;
+ setCurrentTabularResource();
+
+ }
+ });
+ }
+
+ protected void setCurrentTabularResource() {
+ TDGWTServiceAsync.INSTANCE.setTabResource(tabResource,
+ new AsyncCallback() {
+
+ @Override
+ public void onFailure(Throwable caught) {
+ if (caught instanceof TDGWTSessionExpiredException) {
+ eventBus.fireEvent(new SessionExpiredEvent(
+ SessionExpiredType.EXPIREDONSERVER));
+ } else {
+
+ Log.error("Error setting Active TR: "
+ + caught.getLocalizedMessage());
+ UtilsGXT3.alert("Error", "Error setting Active TR");
+
+ }
+
+ }
+
+ @Override
+ public void onSuccess(Void result) {
+ Log.debug("Tab Resource set");
+ start();
+ }
+ });
+
+ }
+
}
diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/ResourceBundle.java b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/ResourceBundle.java
index 1447405..9cd9868 100644
--- a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/ResourceBundle.java
+++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/resources/ResourceBundle.java
@@ -14,7 +14,6 @@ import com.google.gwt.resources.client.ImageResource;
public interface ResourceBundle extends ClientBundle {
public static final ResourceBundle INSTANCE=GWT.create(ResourceBundle.class);
-
@Source("testImage.jpg")
ImageResource testImage();
diff --git a/src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListView.css b/src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListView.css
new file mode 100644
index 0000000..b0c4833
--- /dev/null
+++ b/src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListView.css
@@ -0,0 +1,41 @@
+@CHARSET "UTF-8";
+
+.thumb {
+ background: none repeat scroll 0 0 #DDDDDD;
+ padding: 3px;
+}
+
+.thumb img {
+ height: 60px;
+ width: 80px;
+}
+
+.thumbWrap {
+ border: 1px solid white;
+ float: left;
+ margin: 4px 0 4px 4px;
+ padding: 5px;
+ font: 11px Arial, Helvetica, sans-serif;
+}
+
+.thumbWrap span {
+ display: block;
+ overflow: hidden;
+ text-align: center;
+}
+
+.over {
+ background: repeat-x scroll left top #EFEFEF;
+ border: 1px solid #ddd !important;
+ padding: 5px;
+}
+
+.select {
+ background: none repeat scroll 0 50% #DFE8F6;
+ border: 1px dotted #A3BAE9 !important;
+ cursor: pointer;
+}
+
+.select .thumb {
+ background: none repeat scroll 0 0 transparent;
+}
\ No newline at end of file
diff --git a/src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListView.html b/src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListView.html
new file mode 100644
index 0000000..91e06b7
--- /dev/null
+++ b/src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListView.html
@@ -0,0 +1,4 @@
+
+
+
+{resourceTDDescriptor.name:shorten(18)}
\ No newline at end of file
diff --git a/src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetail.html b/src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetail.html
new file mode 100644
index 0000000..cd9fbb0
--- /dev/null
+++ b/src/main/resources/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetail.html
@@ -0,0 +1,8 @@
+
+
+
+ Name: {resourceTDDescriptor.name} Description:
+ {resourceTDDescriptor.description} Creation Date: {resourceTDDescriptor.creationDate}
+
+
\ No newline at end of file