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>
<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"
date="2017-04-11">
<Change>Quick fix to set folder as public</Change>
<Change>Updated messages to history including version of file if it is
present</Change>
present
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-16-0"
date="2017-03-03">

13
pom.xml
View File

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

View File

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

View File

@ -1519,7 +1519,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
@Override
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))
new WindowImagePreview(fileModel.getName(), (GWTImageDocument) item, positionX, positionY);
else

View File

@ -1,9 +1,14 @@
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.resources.Resources;
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.widgets.imagepreviewerwidget.client.EnhancedImage;
import org.gcube.portlets.widgets.imagepreviewerwidget.client.ui.Carousel;
import com.extjs.gxt.ui.client.widget.Window;
import com.google.gwt.core.shared.GWT;
@ -36,9 +41,10 @@ public class WindowImagePreview {
initWindow(name, positionX, positionY);
window.add(loader);
Image img = new Image(image.getThumbnailUrl());
img.setWidth(String.valueOf(image.getThumbnailWidth()));
img.setHeight(String.valueOf(image.getThumbnailHeight()));
log("Thumbnail URL: "+image.getThumbnailUrl());
GWT.log("Thumbnail URL 1: "+image.getThumbnailUrl());
Image loadImg = new Image(image.getThumbnailUrl());
loadImg.addLoadHandler(new LoadHandler() {
@ -71,11 +77,14 @@ public class WindowImagePreview {
// System.out.println("postionX.................." + positionX);
// System.out.println("positionY.................." + positionY);
Image img = new Image(image.getThumbnailUrl());
img.setWidth(String.valueOf(image.getThumbnailWidth()));
img.setHeight(String.valueOf(image.getThumbnailHeight()));
window.add(new Image(image.getThumbnailUrl()));
window.show();
// Image img = new Image(image.getThumbnailUrl());
// GWT.log("Thumbnail URL 2: "+image.getThumbnailUrl());
//// img.setWidth(String.valueOf(image.getThumbnailWidth()));
//// img.setHeight(String.valueOf(image.getThumbnailHeight()));
// window.add(img);
// window.show();
showCarousel(name, image.getThumbnailUrl(), positionX, positionY);
}
@ -97,6 +106,18 @@ public class WindowImagePreview {
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.
*

View File

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