diff --git a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetail.css b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetail.css
deleted file mode 100644
index 54d9095..0000000
--- a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetail.css
+++ /dev/null
@@ -1,26 +0,0 @@
-@CHARSET "UTF-8";
-
-.details {
- padding: 10px;
- text-align: center;
-}
-
-.detailsInfo {
- border-top: 1px solid #ccc;
- font: 11px Arial, Helvetica, sans-serif;
- margin-top: 5px;
- padding-top: 5px;
- text-align: left;
-}
-
-.detailsTable {
- border: none;
-}
-
-.detailsHead {
- font-weight: bold;
-}
-
-.detailsData {
- padding-left: 5px;
-}
\ 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
deleted file mode 100644
index 3995886..0000000
--- a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetail.html
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
- 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/ResourcesListViewDetailPanel.java b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetailPanel.java
index 1e70ab4..260430b 100644
--- a/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetailPanel.java
+++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetailPanel.java
@@ -3,6 +3,7 @@ package org.gcube.portlets.user.td.resourceswidget.client;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.InternalURITD;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTD;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDDescriptor;
+import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDType;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.StringResourceTD;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.TableResourceTD;
import org.gcube.portlets.user.td.resourceswidget.client.resources.ResourceBundle;
@@ -10,14 +11,19 @@ import org.gcube.portlets.user.td.resourceswidget.client.resources.ResourceBundl
import com.google.gwt.safehtml.shared.SafeUri;
import com.google.gwt.safehtml.shared.UriUtils;
import com.google.gwt.user.client.ui.Image;
+import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
import com.sencha.gxt.core.client.resources.ThemeStyles;
import com.sencha.gxt.core.client.util.Margins;
+import com.sencha.gxt.widget.core.client.button.TextButton;
+import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
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.event.SelectEvent;
+import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.form.FieldLabel;
import com.sencha.gxt.widget.core.client.form.FormPanel.LabelAlign;
import com.sencha.gxt.widget.core.client.form.TextArea;
@@ -30,32 +36,48 @@ import com.sencha.gxt.widget.core.client.form.TextField;
*
*/
public class ResourcesListViewDetailPanel extends SimpleContainer {
+ private static final String THUMBNAIL_WIDTH = "160px";
+ private static final String THUMBNAIL_HEIGHT = "160px";
private static final String DESCRIPTION_HEIGHT = "70px";
-
private Image thumbnail;
private TextField name;
private TextArea description;
private TextField creationDate;
private VerticalLayoutContainer v;
- public ResourcesListViewDetailPanel() {
+ private ResourceTDDescriptor descriptor;
+
+ private TextButton removeButton;
+
+ private TextButton saveButton;
+
+ private TextButton openButton;
+
+ private ResourcesListViewPanel parent;
+
+ private HBoxLayoutContainer buttonMenu;
+
+ public ResourcesListViewDetailPanel(ResourcesListViewPanel parent) {
super();
+ this.parent = parent;
init();
-
+
}
- protected void init(){
+
+ protected void init() {
addStyleName(ThemeStyles.get().style().border());
- getElement().getStyle().setBackgroundColor("white");
-
+ // getElement().getStyle().setBackgroundColor("white");
+
}
-
- public void setDescriptor(ResourceTDDescriptor descriptor){
- if(v!=null){
+
+ public void setDescriptor(ResourceTDDescriptor descriptor) {
+ this.descriptor = descriptor;
+ if (v != null) {
remove(v);
}
-
- if(descriptor==null){
+
+ if (descriptor == null) {
forceLayout();
return;
}
@@ -81,48 +103,173 @@ public class ResourcesListViewDetailPanel extends SimpleContainer {
}
}
}
-
-
- thumbnail=new Image();
-
-
- name=new TextField();
- FieldLabel nameLabel=new FieldLabel(name, "Name");
+
+ thumbnail = new Image();
+ thumbnail.setWidth(THUMBNAIL_WIDTH);
+ thumbnail.setHeight(THUMBNAIL_HEIGHT);
+
+ name = new TextField();
+ FieldLabel nameLabel = new FieldLabel(name, "Name");
nameLabel.setLabelAlign(LabelAlign.TOP);
-
- description=new TextArea();
+
+ description = new TextArea();
description.setHeight(DESCRIPTION_HEIGHT);
- FieldLabel descriptionLabel=new FieldLabel(description, "Description");
+ FieldLabel descriptionLabel = new FieldLabel(description, "Description");
descriptionLabel.setLabelAlign(LabelAlign.TOP);
-
- creationDate=new TextField();
- FieldLabel creationDateLabel=new FieldLabel(creationDate, "Creation Date");
+
+ creationDate = new TextField();
+ FieldLabel creationDateLabel = new FieldLabel(creationDate,
+ "Creation Date");
creationDateLabel.setLabelAlign(LabelAlign.TOP);
-
- v=new VerticalLayoutContainer();
+
+ v = new VerticalLayoutContainer();
v.setScrollMode(ScrollMode.AUTO);
-
- HBoxLayoutContainer h=new HBoxLayoutContainer();
+
+ HBoxLayoutContainer h = new HBoxLayoutContainer();
h.setPack(BoxLayoutPack.CENTER);
h.add(thumbnail);
-
- v.add(h, new VerticalLayoutData(1,-1, new Margins(20,0,10,0)));
+
+ createMenu();
+
+ v.add(h, new VerticalLayoutData(1, -1, new Margins(20, 0, 10, 0)));
v.add(nameLabel, new VerticalLayoutData(1, -1, new Margins(1)));
v.add(descriptionLabel, new VerticalLayoutData(1, -1, new Margins(1)));
v.add(creationDateLabel, new VerticalLayoutData(1, -1, new Margins(1)));
-
-
+ v.add(buttonMenu, new VerticalLayoutData(1, -1, new Margins(0)));
+
thumbnail.setUrl(thumbnailPath);
name.setValue(descriptor.getName());
description.setValue(descriptor.getDescription());
creationDate.setValue(descriptor.getCreationDate());
add(v);
-
+
forceLayout();
-
+
+ }
+
+ protected void createMenu() {
+ if (descriptor == null || descriptor.getResourceType() == null) {
+ return;
+ }
+
+ openButton = new TextButton("Open");
+ openButton.setIcon(ResourceBundle.INSTANCE.resources());
+ openButton.setIconAlign(IconAlign.RIGHT);
+ openButton.setToolTip("Open");
+ SelectHandler openHandler = new SelectHandler() {
+
+ public void onSelect(SelectEvent event) {
+ requestOpen();
+
+ }
+ };
+ openButton.addSelectHandler(openHandler);
+
+ saveButton = new TextButton("Save");
+ saveButton.setIcon(ResourceBundle.INSTANCE.save());
+ saveButton.setIconAlign(IconAlign.RIGHT);
+ saveButton.setToolTip("Save");
+ SelectHandler saveHandler = new SelectHandler() {
+
+ public void onSelect(SelectEvent event) {
+ requestSave();
+
+ }
+ };
+ saveButton.addSelectHandler(saveHandler);
+
+ removeButton = new TextButton("Delete");
+ removeButton.setIcon(ResourceBundle.INSTANCE.delete());
+ removeButton.setIconAlign(IconAlign.RIGHT);
+ removeButton.setToolTip("Save");
+ SelectHandler removeHandler = new SelectHandler() {
+
+ public void onSelect(SelectEvent event) {
+ requestRemove();
+
+ }
+ };
+ removeButton.addSelectHandler(removeHandler);
+
+ ResourceTDType resourceTDType = descriptor.getResourceType();
+ switch (resourceTDType) {
+ case CHART:
+ openButton.setIcon(ResourceBundle.INSTANCE.chart());
+ openButton.setVisible(true);
+ saveButton.setVisible(true);
+ removeButton.setVisible(true);
+ break;
+ case CODELIST:
+ openButton.setVisible(false);
+ saveButton.setVisible(false);
+ removeButton.setVisible(true);
+ break;
+ case CSV:
+ openButton.setVisible(false);
+ saveButton.setVisible(true);
+ removeButton.setVisible(true);
+ break;
+ case GENERIC_FILE:
+ openButton.setIcon(ResourceBundle.INSTANCE.file());
+ openButton.setVisible(true);
+ saveButton.setVisible(true);
+ removeButton.setVisible(true);
+ break;
+ case GENERIC_TABLE:
+ openButton.setVisible(false);
+ saveButton.setVisible(false);
+ removeButton.setVisible(true);
+ break;
+ case GUESSER:
+ openButton.setVisible(false);
+ saveButton.setVisible(false);
+ removeButton.setVisible(true);
+ break;
+ case JSON:
+ openButton.setVisible(false);
+ saveButton.setVisible(true);
+ removeButton.setVisible(true);
+ break;
+ case MAP:
+ openButton.setIcon(ResourceBundle.INSTANCE.gis());
+ openButton.setVisible(true);
+ saveButton.setVisible(false);
+ removeButton.setVisible(true);
+ break;
+ case SDMX:
+ openButton.setVisible(false);
+ saveButton.setVisible(false);
+ removeButton.setVisible(true);
+ break;
+ default:
+ openButton.setVisible(false);
+ saveButton.setVisible(false);
+ removeButton.setVisible(true);
+ break;
+
+ }
+
+ buttonMenu = new HBoxLayoutContainer();
+ buttonMenu.setPack(BoxLayoutPack.CENTER);
+ buttonMenu.add(openButton, new BoxLayoutData(new Margins(5, 2, 5, 2)));
+ buttonMenu.add(saveButton, new BoxLayoutData(new Margins(5, 2, 5, 2)));
+ buttonMenu
+ .add(removeButton, new BoxLayoutData(new Margins(5, 2, 5, 2)));
+
+ }
+
+ private void requestOpen() {
+ parent.requestOpen(descriptor);
+ }
+
+ private void requestSave() {
+ parent.requestSave(descriptor);
+
+ }
+
+ private void requestRemove() {
+ parent.requestRemove(descriptor);
+
}
-
-
-
}
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
index f6bb63a..ba28c90 100644
--- 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
@@ -9,18 +9,28 @@ 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.InternalURITD;
+import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.RemoveResourceSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTD;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDDescriptor;
+import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.ResourceTDType;
+import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.SaveResourceSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.StringResourceTD;
import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.TableResourceTD;
+import org.gcube.portlets.user.td.gwtservice.shared.uriresolver.UriResolverSession;
+import org.gcube.portlets.user.td.resourceswidget.client.charts.ChartViewerDialog;
import org.gcube.portlets.user.td.resourceswidget.client.resources.ResourceBundle;
+import org.gcube.portlets.user.td.resourceswidget.client.save.SaveResourceWizard;
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 org.gcube.portlets.user.td.widgetcommonevent.shared.mime.MimeTypeSupport;
+import org.gcube.portlets.user.td.widgetcommonevent.shared.uriresolver.ApplicationType;
+import org.gcube.portlets.user.td.wizardwidget.client.WizardListener;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.RunAsyncCallback;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.event.logical.shared.SelectionEvent;
@@ -32,6 +42,7 @@ import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeUri;
import com.google.gwt.safehtml.shared.UriUtils;
import com.google.gwt.text.shared.AbstractSafeHtmlRenderer;
+import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.cell.core.client.SimpleSafeHtmlCell;
@@ -53,9 +64,6 @@ 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.StringLabelProvider;
-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;
@@ -66,8 +74,13 @@ import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderL
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.event.BeforeShowContextMenuEvent;
+import com.sencha.gxt.widget.core.client.event.BeforeShowContextMenuEvent.BeforeShowContextMenuHandler;
import com.sencha.gxt.widget.core.client.form.SimpleComboBox;
import com.sencha.gxt.widget.core.client.form.StoreFilterField;
+import com.sencha.gxt.widget.core.client.menu.Item;
+import com.sencha.gxt.widget.core.client.menu.Menu;
+import com.sencha.gxt.widget.core.client.menu.MenuItem;
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;
@@ -88,19 +101,7 @@ public class ResourcesListViewPanel extends FramedPanel {
private static final String HEIGHT = "470px";
private static final String WIDTH = "630px";
- public interface DetailRenderer extends XTemplates {
- @XTemplate(source = "ResourcesListViewDetail.html")
- public SafeHtml render(ResourceTDDescriptor resourceTDDescriptor,
- SafeUri thumbnailPath, ResourceListViewDetailCSS style);
- }
-
- public interface DetailRendererBundle extends ClientBundle {
- public static final DetailRendererBundle INSTANCE = GWT
- .create(DetailRendererBundle.class);
-
- @Source("ResourcesListViewDetail.css")
- ResourceListViewDetailCSS css();
- }
+
@FormatterFactories(@FormatterFactory(factory = ShortenFactory.class, name = "shorten"))
public interface Renderer extends XTemplates {
@@ -117,18 +118,7 @@ public class ResourcesListViewPanel extends FramedPanel {
ResourceListViewCSS css();
}
- public interface ResourceListViewDetailCSS extends CssResource {
- String details();
-
- String detailsInfo();
-
- String detailsTable();
-
- String detailsHead();
-
- String detailsData();
-
- }
+
public interface ResourceListViewCSS extends CssResource {
String over();
@@ -198,20 +188,24 @@ public class ResourcesListViewPanel extends FramedPanel {
}
- // private Dialog chooser;
- // private HTML details;
+
private ResourcesListViewDetailPanel details;
- // private static DetailRenderer detailRenderer;
- // private static ResourceListViewDetailCSS detailStyle;
-
+
private TRId trId;
private EventBus eventBus;
private ListStore store;
- private ListLoader> loader;
-
- private ListView view;
+ //private ListLoader