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
new file mode 100644
index 0000000..1e70ab4
--- /dev/null
+++ b/src/main/java/org/gcube/portlets/user/td/resourceswidget/client/ResourcesListViewDetailPanel.java
@@ -0,0 +1,128 @@
+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.StringResourceTD;
+import org.gcube.portlets.user.td.gwtservice.shared.tr.resources.TableResourceTD;
+import org.gcube.portlets.user.td.resourceswidget.client.resources.ResourceBundle;
+
+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.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.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.form.FieldLabel;
+import com.sencha.gxt.widget.core.client.form.FormPanel.LabelAlign;
+import com.sencha.gxt.widget.core.client.form.TextArea;
+import com.sencha.gxt.widget.core.client.form.TextField;
+
+/**
+ *
+ * @author giancarlo email: g.panichi@isti.cnr.it
+ *
+ */
+public class ResourcesListViewDetailPanel extends SimpleContainer {
+ private static final String DESCRIPTION_HEIGHT = "70px";
+
+
+ private Image thumbnail;
+ private TextField name;
+ private TextArea description;
+ private TextField creationDate;
+ private VerticalLayoutContainer v;
+
+ public ResourcesListViewDetailPanel() {
+ super();
+ init();
+
+ }
+ protected void init(){
+ addStyleName(ThemeStyles.get().style().border());
+ getElement().getStyle().setBackgroundColor("white");
+
+ }
+
+ public void setDescriptor(ResourceTDDescriptor descriptor){
+ if(v!=null){
+ remove(v);
+ }
+
+ if(descriptor==null){
+ forceLayout();
+ return;
+ }
+ SafeUri thumbnailPath = ResourceBundle.INSTANCE.resources32()
+ .getSafeUri();
+ ResourceTD resourceTD = descriptor.getResourceTD();
+
+ if (resourceTD instanceof InternalURITD) {
+ InternalURITD internalURITD = (InternalURITD) resourceTD;
+ if (internalURITD.getThumbnailTD() != null
+ && internalURITD.getThumbnailTD().getUrl() != null) {
+ thumbnailPath = UriUtils.fromTrustedString(internalURITD
+ .getThumbnailTD().getUrl());
+ }
+ } else {
+ if (resourceTD instanceof StringResourceTD) {
+ thumbnailPath = ResourceBundle.INSTANCE.resources32()
+ .getSafeUri();
+ } else {
+ if (resourceTD instanceof TableResourceTD) {
+ thumbnailPath = ResourceBundle.INSTANCE.resources32()
+ .getSafeUri();
+ }
+ }
+ }
+
+
+ thumbnail=new Image();
+
+
+ name=new TextField();
+ FieldLabel nameLabel=new FieldLabel(name, "Name");
+ nameLabel.setLabelAlign(LabelAlign.TOP);
+
+ description=new TextArea();
+ description.setHeight(DESCRIPTION_HEIGHT);
+ FieldLabel descriptionLabel=new FieldLabel(description, "Description");
+ descriptionLabel.setLabelAlign(LabelAlign.TOP);
+
+ creationDate=new TextField();
+ FieldLabel creationDateLabel=new FieldLabel(creationDate, "Creation Date");
+ creationDateLabel.setLabelAlign(LabelAlign.TOP);
+
+ v=new VerticalLayoutContainer();
+ v.setScrollMode(ScrollMode.AUTO);
+
+ HBoxLayoutContainer h=new HBoxLayoutContainer();
+ h.setPack(BoxLayoutPack.CENTER);
+ h.add(thumbnail);
+
+ 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)));
+
+
+ thumbnail.setUrl(thumbnailPath);
+ name.setValue(descriptor.getName());
+ description.setValue(descriptor.getDescription());
+ creationDate.setValue(descriptor.getCreationDate());
+ add(v);
+
+ forceLayout();
+
+ }
+
+
+
+
+}
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
index d597c66..0d4804c 100644
--- 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
@@ -1,6 +1,5 @@
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;
@@ -16,19 +15,17 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
*
*/
public class ResourcesListViewDialog extends Window {
- protected String WIDTH = "640px";
- protected String HEIGHT = "480px";
- protected TRId trId;
- protected EventBus eventBus;
- protected UserInfo userInfo;
+ private static final String WIDTH = "640px";
+ private static final String HEIGHT = "480px";
+ private ResourcesListViewPanel resourcesPanel;
- public ResourcesListViewDialog(TRId trId, EventBus eventBus) {
- this.trId = trId;
- this.eventBus = eventBus;
+ public ResourcesListViewDialog(EventBus eventBus) {
initWindow();
- ResourcesListViewPanel resourcesPanel = new ResourcesListViewPanel(
- trId, eventBus);
+ resourcesPanel = new ResourcesListViewPanel(
+ eventBus);
add(resourcesPanel);
+
+
}
protected void initWindow() {
@@ -40,6 +37,11 @@ public class ResourcesListViewDialog extends Window {
// getHeader().setIcon(Resources.IMAGES.side_list());
}
+ public void open(TRId trId){;
+ resourcesPanel.open(trId);
+
+ }
+
/**
* {@inheritDoc}
*/
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 7fd1527..f6bb63a 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
@@ -33,7 +33,6 @@ 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.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.cell.core.client.form.ComboBoxCell.TriggerAction;
@@ -45,7 +44,6 @@ 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;
@@ -87,6 +85,9 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
*/
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,
@@ -198,9 +199,10 @@ public class ResourcesListViewPanel extends FramedPanel {
}
// private Dialog chooser;
- private HTML details;
- private static DetailRenderer detailRenderer;
- private static ResourceListViewDetailCSS detailStyle;
+ // private HTML details;
+ private ResourcesListViewDetailPanel details;
+ // private static DetailRenderer detailRenderer;
+ // private static ResourceListViewDetailCSS detailStyle;
private TRId trId;
private EventBus eventBus;
@@ -208,26 +210,25 @@ public class ResourcesListViewPanel extends FramedPanel {
private ListStore store;
private ListLoader> loader;
- private boolean drawed = false;
-
private ListView view;
private SimpleComboBox comboSort;
- public ResourcesListViewPanel(TRId trId, EventBus eventBus) {
+ public ResourcesListViewPanel(EventBus eventBus) {
super();
- this.trId = trId;
this.eventBus = eventBus;
forceLayoutOnResize = true;
- retrieveCurrentTR();
+ init();
+ create();
}
- protected void draw() {
+ public void open(TRId trId) {
try {
- drawed = true;
- init();
- create();
+ this.trId = trId;
+ loader.load();
+ details.setDescriptor(null);
+ forceLayout();
} catch (Throwable e) {
- Log.error(e.getLocalizedMessage());
+ Log.error("Error open resources: "+e.getLocalizedMessage());
e.printStackTrace();
}
}
@@ -235,19 +236,21 @@ public class ResourcesListViewPanel extends FramedPanel {
protected void init() {
setHeaderVisible(false);
setBodyBorder(false);
- setResize(true);
- setWidth("630px");
- setHeight("470px");
+ setResize(true);
+ setWidth(WIDTH);
+ setHeight(HEIGHT);
}
protected void create() {
Log.debug("Create Resource List View");
- DetailRendererBundle.INSTANCE.css().ensureInjected();
- detailStyle = DetailRendererBundle.INSTANCE.css();
-
- detailRenderer = GWT.create(DetailRenderer.class);
+ /*
+ * DetailRendererBundle.INSTANCE.css().ensureInjected(); detailStyle =
+ * DetailRendererBundle.INSTANCE.css();
+ *
+ * detailRenderer = GWT.create(DetailRenderer.class);
+ */
RpcProxy