Feature #5207 completed

Updated pom version at 6.17.0

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@148922 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2017-05-22 09:48:01 +00:00
parent 9f542d3b99
commit 8ef26bdf7a
6 changed files with 83 additions and 50 deletions

View File

@ -1,9 +1,14 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-17-0"
date="2017-05-22">
<Change>[Feature #5207] Integrate Image Preview Widget</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-16-1" <Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-16-1"
date="2017-04-11"> date="2017-04-11">
<Change>Quick fix to set folder as public</Change> <Change>Quick fix to set folder as public</Change>
<Change>Updated messages to history including version of file if it is <Change>Updated messages to history including version of file if it is
present</Change> present
</Change>
</Changeset> </Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-16-0" <Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-16-0"
date="2017-03-03"> date="2017-03-03">

13
pom.xml
View File

@ -10,7 +10,7 @@
<groupId>org.gcube.portlets.user</groupId> <groupId>org.gcube.portlets.user</groupId>
<artifactId>workspace-tree-widget</artifactId> <artifactId>workspace-tree-widget</artifactId>
<version>6.16.1-SNAPSHOT</version> <version>6.17.0-SNAPSHOT</version>
<name>gCube Workspace Tree Widget</name> <name>gCube Workspace Tree Widget</name>
<description> <description>
gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace gCube Workspace Tree Widget is a widget to navigate and interact with gCube Workspace
@ -132,12 +132,11 @@
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- Auth Framework --> <dependency>
<!-- <dependency> --> <groupId>org.gcube.portlets.widgets</groupId>
<!-- <groupId>org.gcube.common</groupId> --> <artifactId>image-previewer-widget</artifactId>
<!-- <artifactId>authorization-client</artifactId> --> <version>[1.0.0-SNAPSHOT,)</version>
<!-- <scope>provided</scope> --> </dependency>
<!-- </dependency> -->
<!-- HOME LIBRARY --> <!-- HOME LIBRARY -->
<dependency> <dependency>

View File

@ -11,18 +11,24 @@
<!-- Moduel GXT --> <!-- Moduel GXT -->
<inherits name='com.extjs.gxt.ui.GXT' /> <inherits name='com.extjs.gxt.ui.GXT' />
<inherits name='org.gcube.portal.clientcontext.GCubeClientContext' /> <inherits name='org.gcube.portal.clientcontext.GCubeClientContext' />
<inherits name="org.gcube.portlets.widgets.workspacesharingwidget.WorkspaceSharingWidget" />
<servlet path="/WorkspaceService" class="org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl" /> <inherits
<inherits name="org.gcube.portlets.widgets.workspaceuploader.WorkspaceUploader"></inherits> name="org.gcube.portlets.widgets.workspacesharingwidget.WorkspaceSharingWidget" />
<inherits name='org.gcube.portlets.widgets.ckandatapublisherwidget.CKanMetadataPublisher' />
<servlet path="/WorkspaceService"
class="org.gcube.portlets.user.workspace.server.GWTWorkspaceServiceImpl" />
<inherits
name="org.gcube.portlets.widgets.workspaceuploader.WorkspaceUploader"></inherits>
<inherits
name='org.gcube.portlets.widgets.ckandatapublisherwidget.CKanMetadataPublisher' />
<servlet path="/DownloadService" <servlet path="/DownloadService"
class="org.gcube.portlets.user.workspace.server.DownloadServlet" /> class="org.gcube.portlets.user.workspace.server.DownloadServlet" />
<servlet path="/ImageService" <servlet path="/ImageService"
class="org.gcube.portlets.user.workspace.server.ImageServlet" /> class="org.gcube.portlets.user.workspace.server.ImageServlet" />
<inherits name="org.gcube.portlets.widgets.imagepreviewerwidget.ImagePreviewer" />
<!-- Specify the application specific style sheet. --> <!-- Specify the application specific style sheet. -->
<stylesheet src='workspacetree.css' /> <stylesheet src='workspacetree.css' />

View File

@ -1519,7 +1519,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override @Override
public void onSuccess(GWTWorkspaceItem item) { public void onSuccess(GWTWorkspaceItem item) {
GWT.log("Image loaded: "+item.toString()); GWT.log("Image loaded: "+item.getName() + " label: "+item.getLabel());
if(fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT)) if(fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT))
new WindowImagePreview(fileModel.getName(), (GWTImageDocument) item, positionX, positionY); new WindowImagePreview(fileModel.getName(), (GWTImageDocument) item, positionX, positionY);
else else

View File

@ -1,9 +1,14 @@
package org.gcube.portlets.user.workspace.client.view.windows; package org.gcube.portlets.user.workspace.client.view.windows;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.workspace.client.ConstantsExplorer; import org.gcube.portlets.user.workspace.client.ConstantsExplorer;
import org.gcube.portlets.user.workspace.client.resources.Resources; import org.gcube.portlets.user.workspace.client.resources.Resources;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalImage; import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalImage;
import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTImageDocument; import org.gcube.portlets.user.workspace.client.workspace.folder.item.gcube.GWTImageDocument;
import org.gcube.portlets.widgets.imagepreviewerwidget.client.EnhancedImage;
import org.gcube.portlets.widgets.imagepreviewerwidget.client.ui.Carousel;
import com.extjs.gxt.ui.client.widget.Window; import com.extjs.gxt.ui.client.widget.Window;
import com.google.gwt.core.shared.GWT; import com.google.gwt.core.shared.GWT;
@ -36,9 +41,10 @@ public class WindowImagePreview {
initWindow(name, positionX, positionY); initWindow(name, positionX, positionY);
window.add(loader); window.add(loader);
Image img = new Image(image.getThumbnailUrl()); Image img = new Image(image.getThumbnailUrl());
img.setWidth(String.valueOf(image.getThumbnailWidth())); img.setWidth(String.valueOf(image.getThumbnailWidth()));
img.setHeight(String.valueOf(image.getThumbnailHeight())); img.setHeight(String.valueOf(image.getThumbnailHeight()));
log("Thumbnail URL: "+image.getThumbnailUrl()); GWT.log("Thumbnail URL 1: "+image.getThumbnailUrl());
Image loadImg = new Image(image.getThumbnailUrl()); Image loadImg = new Image(image.getThumbnailUrl());
loadImg.addLoadHandler(new LoadHandler() { loadImg.addLoadHandler(new LoadHandler() {
@ -71,11 +77,14 @@ public class WindowImagePreview {
// System.out.println("postionX.................." + positionX); // System.out.println("postionX.................." + positionX);
// System.out.println("positionY.................." + positionY); // System.out.println("positionY.................." + positionY);
Image img = new Image(image.getThumbnailUrl()); // Image img = new Image(image.getThumbnailUrl());
img.setWidth(String.valueOf(image.getThumbnailWidth())); // GWT.log("Thumbnail URL 2: "+image.getThumbnailUrl());
img.setHeight(String.valueOf(image.getThumbnailHeight())); //// img.setWidth(String.valueOf(image.getThumbnailWidth()));
window.add(new Image(image.getThumbnailUrl())); //// img.setHeight(String.valueOf(image.getThumbnailHeight()));
window.show(); // window.add(img);
// window.show();
showCarousel(name, image.getThumbnailUrl(), positionX, positionY);
} }
@ -97,6 +106,18 @@ public class WindowImagePreview {
window.setPosition(positionX, positionY); window.setPosition(positionX, positionY);
} }
private void showCarousel(
String imageTitle, String imageURL, int positionX, int positionY) {
Carousel carousel = new Carousel();
List<EnhancedImage> list = new ArrayList<EnhancedImage>();
GWT.log("Generating imageURL: "+imageURL);
EnhancedImage myimg = new EnhancedImage(imageURL, imageTitle, imageTitle);
list.add(myimg);
carousel.updateImages(list);
carousel.hideArrows();
carousel.show();
}
/** /**
* Log. * Log.
* *

View File

@ -1,5 +1,5 @@
/** /**
* *
*/ */
package org.gcube.portlets.user.workspace.client.workspace; package org.gcube.portlets.user.workspace.client.workspace;
@ -14,7 +14,7 @@ import com.google.gwt.user.client.rpc.IsSerializable;
* *
*/ */
public abstract class GWTWorkspaceItem implements IsSerializable { public abstract class GWTWorkspaceItem implements IsSerializable {
protected String id; protected String id;
protected GWTProperties properties; protected GWTProperties properties;
protected String name; protected String name;
@ -24,16 +24,16 @@ public abstract class GWTWorkspaceItem implements IsSerializable {
protected Date lastModificationTime; protected Date lastModificationTime;
protected GWTWorkspaceItemAction lastAction; protected GWTWorkspaceItemAction lastAction;
protected GWTWorkspaceFolder parent; protected GWTWorkspaceFolder parent;
protected boolean isLoading = false; protected boolean isLoading = false;
protected GWTWorkspaceItem() protected GWTWorkspaceItem()
{} {}
public GWTWorkspaceItem(GWTWorkspaceFolder parent, String id, String name, public GWTWorkspaceItem(GWTWorkspaceFolder parent, String id, String name,
String description, String owner, Date creationTime, String description, String owner, Date creationTime,
GWTProperties properties, Date lastModificationTime, GWTWorkspaceItemAction lastAction) { GWTProperties properties, Date lastModificationTime, GWTWorkspaceItemAction lastAction) {
this.parent = parent; this.parent = parent;
this.creationTime = creationTime; this.creationTime = creationTime;
this.id = id; this.id = id;
@ -48,7 +48,7 @@ public abstract class GWTWorkspaceItem implements IsSerializable {
public String getId(){ public String getId(){
return id; return id;
} }
public GWTWorkspaceFolder getParent() public GWTWorkspaceFolder getParent()
{ {
return parent; return parent;
@ -57,11 +57,11 @@ public abstract class GWTWorkspaceItem implements IsSerializable {
public Date getCreationTime(){ public Date getCreationTime(){
return creationTime; return creationTime;
} }
public GWTProperties getProperties(){ public GWTProperties getProperties(){
return properties; return properties;
} }
public String getName(){ public String getName(){
return name; return name;
} }
@ -69,7 +69,7 @@ public abstract class GWTWorkspaceItem implements IsSerializable {
public String getOwner(){ public String getOwner(){
return owner; return owner;
} }
public String getDescription() { public String getDescription() {
return description; return description;
} }
@ -81,51 +81,51 @@ public abstract class GWTWorkspaceItem implements IsSerializable {
public GWTWorkspaceItemAction getLastAction() { public GWTWorkspaceItemAction getLastAction() {
return lastAction; return lastAction;
} }
public abstract GWTItemDescription getItemDescription(); public abstract GWTItemDescription getItemDescription();
public String getLabel() public String getLabel()
{ {
return getItemDescription().getLabel(); return getItemDescription().getLabel();
} }
public String getIconClass(){ public String getIconClass(){
return getItemDescription().getIconClass(); return getItemDescription().getIconClass();
} }
public abstract GWTWorkspaceItemType getType(); public abstract GWTWorkspaceItemType getType();
public abstract List<? extends GWTWorkspaceItem> getChildren(); public abstract List<? extends GWTWorkspaceItem> getChildren();
protected void setParent(GWTWorkspaceFolder parent) protected void setParent(GWTWorkspaceFolder parent)
{ {
this.parent = parent; this.parent = parent;
} }
public int countSubTreeChildren() public int countSubTreeChildren()
{ {
int total = 0; int total = 0;
for (GWTWorkspaceItem child : getChildren()){ for (GWTWorkspaceItem child : getChildren()){
total += 1 + child.countSubTreeChildren(); total += 1 + child.countSubTreeChildren();
} }
return total; return total;
} }
public int countSubTreeChildren(GWTWorkspaceItemType type) public int countSubTreeChildren(GWTWorkspaceItemType type)
{ {
int total = 0; int total = 0;
for (GWTWorkspaceItem child : getChildren()){ for (GWTWorkspaceItem child : getChildren()){
total += child.countSubTreeChildren(type); total += child.countSubTreeChildren(type);
if (child.getType() == type) total++; if (child.getType() == type) total++;
} }
return total; return total;
} }
protected void setName(String name) protected void setName(String name)
{ {
this.name = name; this.name = name;
@ -134,7 +134,7 @@ public abstract class GWTWorkspaceItem implements IsSerializable {
protected void setDescription(String description) { protected void setDescription(String description) {
this.description = description; this.description = description;
} }
public boolean isRoot() public boolean isRoot()
{ {
return getParent() == null; return getParent() == null;
@ -150,19 +150,19 @@ public abstract class GWTWorkspaceItem implements IsSerializable {
if (!(obj instanceof GWTWorkspaceItem)) return false; if (!(obj instanceof GWTWorkspaceItem)) return false;
return this.id.equals(((GWTWorkspaceItem)obj).getId()); return this.id.equals(((GWTWorkspaceItem)obj).getId());
} }
public String getPath() public String getPath()
{ {
if (isRoot()) return "/"+name; if (isRoot()) return "/"+name;
return getParent().getPath()+"/"+name; return getParent().getPath()+"/"+name;
} }
public boolean isAncestor(GWTWorkspaceItem item) public boolean isAncestor(GWTWorkspaceItem item)
{ {
if (id.equals(item.getId())) return true; if (id.equals(item.getId())) return true;
if (isRoot()) return false; if (isRoot()) return false;
return getParent().isAncestor(item); return getParent().isAncestor(item);
} }
@ -173,4 +173,6 @@ public abstract class GWTWorkspaceItem implements IsSerializable {
return isLoading; return isLoading;
} }
} }