Added icons for: .odt, .ods, .ott, .odg, .odp

Updated pom version at 6.11.0

git-svn-id: http://svn.d4science-ii.research-infrastructures.eu/gcube/trunk/portlets/user/workspace-tree-widget@124528 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Francesco Mangiacrapa 2016-02-24 10:00:19 +00:00
parent 2fe12b9bbe
commit bd9966c5ac
14 changed files with 594 additions and 523 deletions

View File

@ -16,7 +16,7 @@ Author
Version and Release Date Version and Release Date
------------------------ ------------------------
v. 6.11.0 January 2016 v. 6.11.1 February 2016
Description Description

View File

@ -1,4 +1,9 @@
<ReleaseNotes> <ReleaseNotes>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-11-1"
date="2016-02-24">
<Change>Added icons for: .odt, .ods, .ott, .odg, .odp
</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-11-0" <Changeset component="org.gcube.portlets-user.workspace-portlet-tree.6-11-0"
date="2016-01-20"> date="2016-01-20">
<Change>[Feature #1925] Added, new public link format: <Change>[Feature #1925] Added, new public link format:

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.11.0-SNAPSHOT</version> <version>6.11.1-SNAPSHOT</version>
<name>gCube Workspace Tree Widget</name> <name>gCube Workspace Tree Widget</name>
<description> <description>
gCube Workspace Tree Widget. gCube Workspace Tree Widget.

View File

@ -188,9 +188,21 @@ public interface Icons extends ClientBundle {
@Source("icons/paste.png") @Source("icons/paste.png")
ImageResource paste(); ImageResource paste();
@Source("icons/icon-odp.gif") @Source("icons/odp.png")
ImageResource odp(); ImageResource odp();
@Source("icons/odt.png")
ImageResource odt();
@Source("icons/ods.png")
ImageResource ods();
@Source("icons/odg.png")
ImageResource odg();
@Source("icons/ott.png")
ImageResource ott();
@Source("icons/refresh.gif") @Source("icons/refresh.gif")
ImageResource refresh(); ImageResource refresh();

View File

@ -40,6 +40,10 @@ public class Resources {
private static final String PPTX = "vnd.openxmlformats-officedocument.presentationml.presentation"; private static final String PPTX = "vnd.openxmlformats-officedocument.presentationml.presentation";
private static final String XSLX = "vnd.openxmlformats-officedocument.spreadsheetml.sheet"; private static final String XSLX = "vnd.openxmlformats-officedocument.spreadsheetml.sheet";
private static final String ODP = "vnd.oasis.opendocument.presentation"; private static final String ODP = "vnd.oasis.opendocument.presentation";
private static final String ODT = "vnd.oasis.opendocument.text";
private static final String ODS = "vnd.oasis.opendocument.spreadsheet";
private static final String OTT = "vnd.oasis.opendocument.text-template";
private static final String ODG = "application/vnd.oasis.opendocument.graphics";
private static final String XTEX = "x-tex"; private static final String XTEX = "x-tex";
private static final String ZIP = "zip"; private static final String ZIP = "zip";
private static final String SEVEN_ZIP = "x-7z-compressed"; private static final String SEVEN_ZIP = "x-7z-compressed";
@ -146,6 +150,48 @@ public class Resources {
return AbstractImagePrototype.create(ICONS.odp()); return AbstractImagePrototype.create(ICONS.odp());
} }
/**
* Gets the icon odp.
*
* @return the icon odp
*/
public static AbstractImagePrototype getIconOds(){
return AbstractImagePrototype.create(ICONS.ods());
}
/**
* Gets the icon odp.
*
* @return the icon odp
*/
public static AbstractImagePrototype getIconOdg(){
return AbstractImagePrototype.create(ICONS.odg());
}
/**
* Gets the icon odp.
*
* @return the icon odp
*/
public static AbstractImagePrototype getIconOtt(){
return AbstractImagePrototype.create(ICONS.ott());
}
/**
* Gets the icon odp.
*
* @return the icon odp
*/
public static AbstractImagePrototype getIconOdt(){
return AbstractImagePrototype.create(ICONS.odt());
}
/** /**
* Gets the icon table. * Gets the icon table.
* *
@ -1334,8 +1380,6 @@ public class Resources {
return ICONS.attach(); return ICONS.attach();
} }
/** /**
* Gets the icon by media type name. * Gets the icon by media type name.
* *
@ -1377,6 +1421,14 @@ public class Resources {
return Resources.getIconPpt(); return Resources.getIconPpt();
} else if(mediaTypeName.contains(ODP)){ } else if(mediaTypeName.contains(ODP)){
return Resources.getIconOdp(); return Resources.getIconOdp();
} else if(mediaTypeName.contains(ODS)){
return Resources.getIconOds();
} else if(mediaTypeName.contains(ODG)){
return Resources.getIconOdg();
} else if(mediaTypeName.contains(OTT)){
return Resources.getIconOtt();
}else if(mediaTypeName.contains(ODT)){
return Resources.getIconOdt();
}else if (mediaTypeName.contains(EXCEL) || mediaTypeName.contains(XSLX)) { }else if (mediaTypeName.contains(EXCEL) || mediaTypeName.contains(XSLX)) {
return Resources.getIconExcel(); return Resources.getIconExcel();
}else if (mediaTypeName.contains(ZIP) || mediaTypeName.contains(SEVEN_ZIP)) { }else if (mediaTypeName.contains(ZIP) || mediaTypeName.contains(SEVEN_ZIP)) {
@ -1402,7 +1454,6 @@ public class Resources {
return Resources.getIconTable(); return Resources.getIconTable();
} }
/** /**
* Gets the icon by folder item type. * Gets the icon by folder item type.
* *

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 923 B

View File

@ -64,9 +64,9 @@ public class DownloadServlet extends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
String itemId = req.getParameter("id"); String itemId = req.getParameter("id");
boolean viewContent = (req.getParameter("viewContent")==null)?false:req.getParameter("viewContent").equals("true"); boolean viewContent = req.getParameter("viewContent")==null?false:req.getParameter("viewContent").equals("true");
boolean isValidItem = (req.getParameter(ConstantsExplorer.VALIDATEITEM)==null)?false:req.getParameter(ConstantsExplorer.VALIDATEITEM).equals("true"); boolean isValidItem = req.getParameter(ConstantsExplorer.VALIDATEITEM)==null?false:req.getParameter(ConstantsExplorer.VALIDATEITEM).equals("true");
boolean urlRedirectOnError = (req.getParameter(ConstantsExplorer.REDIRECTONERROR)==null)?false:req.getParameter(ConstantsExplorer.REDIRECTONERROR).equals("true"); boolean urlRedirectOnError = req.getParameter(ConstantsExplorer.REDIRECTONERROR)==null?false:req.getParameter(ConstantsExplorer.REDIRECTONERROR).equals("true");
logger.trace("Input Params [id: "+itemId + ", viewContent: "+viewContent+", "+ConstantsExplorer.VALIDATEITEM +": " +isValidItem+", urlRedirectOnError:" +urlRedirectOnError+"]"); logger.trace("Input Params [id: "+itemId + ", viewContent: "+viewContent+", "+ConstantsExplorer.VALIDATEITEM +": " +isValidItem+", urlRedirectOnError:" +urlRedirectOnError+"]");
if(itemId==null || itemId.isEmpty()){ if(itemId==null || itemId.isEmpty()){
@ -164,7 +164,7 @@ public class DownloadServlet extends HttpServlet{
itemName = "." + Extensions.REPORT_TEMPLATE.getName(); itemName = "." + Extensions.REPORT_TEMPLATE.getName();
logger.trace("case REPORT_TEMPLATE itemName is" +extension); logger.trace("case REPORT_TEMPLATE itemName is" +extension);
String contentDisposition = (viewContent)?"inline":"attachment"; String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" ); resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType("application/zip"); resp.setContentType("application/zip");
@ -196,7 +196,7 @@ public class DownloadServlet extends HttpServlet{
itemName = "." + Extensions.REPORT.getName(); itemName = "." + Extensions.REPORT.getName();
logger.trace("case REPORT itemName is" +extension); logger.trace("case REPORT itemName is" +extension);
String contentDisposition = (viewContent)?"inline":"attachment"; String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" ); resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType("application/zip"); resp.setContentType("application/zip");
@ -228,7 +228,7 @@ public class DownloadServlet extends HttpServlet{
String mimeType = externalFile.getMimeType(); String mimeType = externalFile.getMimeType();
logger.trace("EXTERNAL_FILE DOWNLOAD FOR "+externalFile.getId()); logger.trace("EXTERNAL_FILE DOWNLOAD FOR "+externalFile.getId());
String contentDisposition = (viewContent)?"inline":"attachment"; String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + item.getName() + "\"" ); resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + item.getName() + "\"" );
resp.setContentType(mimeType); resp.setContentType(mimeType);
resp = setContentLength(resp, externalFile.getLength()); resp = setContentLength(resp, externalFile.getLength());
@ -255,7 +255,7 @@ public class DownloadServlet extends HttpServlet{
String mimeType = externalImage.getMimeType(); String mimeType = externalImage.getMimeType();
String itemName = MimeTypeUtil.getNameWithExtension(item.getName(), mimeType); String itemName = MimeTypeUtil.getNameWithExtension(item.getName(), mimeType);
String contentDisposition = (viewContent)?"inline":"attachment"; String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" ); resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType(externalImage.getMimeType()); resp.setContentType(externalImage.getMimeType());
resp = setContentLength(resp, externalImage.getLength()); resp = setContentLength(resp, externalImage.getLength());
@ -277,7 +277,7 @@ public class DownloadServlet extends HttpServlet{
ExternalUrl externalUrl = (ExternalUrl)folderItem; ExternalUrl externalUrl = (ExternalUrl)folderItem;
String itemName = MimeTypeUtil.getNameWithExtension(externalUrl.getName(), "text/uri-list"); String itemName = MimeTypeUtil.getNameWithExtension(externalUrl.getName(), "text/uri-list");
String contentDisposition = (viewContent)?"inline":"attachment"; String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" ); resp.setHeader("Content-Disposition", contentDisposition+"; filename=\"" + itemName + "\"" );
resp.setContentType("text/uri-list"); resp.setContentType("text/uri-list");
resp = setContentLength(resp, externalUrl.getLength()); resp = setContentLength(resp, externalUrl.getLength());
@ -323,7 +323,7 @@ public class DownloadServlet extends HttpServlet{
TimeSeries ts = (TimeSeries)folderItem; TimeSeries ts = (TimeSeries)folderItem;
File tmpZip = ZipUtil.zipTimeSeries(ts); File tmpZip = ZipUtil.zipTimeSeries(ts);
String contentDisposition = (viewContent)?"inline":"attachment"; String contentDisposition = viewContent?"inline":"attachment";
resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + item.getName() + ".zip\"" ); resp.setHeader( "Content-Disposition", contentDisposition+"; filename=\"" + item.getName() + ".zip\"" );
resp.setContentType("application/zip"); resp.setContentType("application/zip");
resp = setContentLength(resp, tmpZip.length()); resp = setContentLength(resp, tmpZip.length());
@ -523,7 +523,7 @@ public class DownloadServlet extends HttpServlet{
StringBuffer url = new StringBuffer(); StringBuffer url = new StringBuffer();
url.append(scheme).append("://").append(serverName); url.append(scheme).append("://").append(serverName);
if ((serverPort != 80) && (serverPort != 443)) { if (serverPort != 80 && serverPort != 443) {
url.append(":").append(serverPort); url.append(":").append(serverPort);
} }

View File

@ -31,9 +31,9 @@ public class ItemRetrieve {
// public static String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps"; //PRODUCTION // public static String DEFAULT_SCOPE = "/d4science.research-infrastructures.eu/gCubeApps"; //PRODUCTION
public static String DEFAULT_SCOPE = "/gcube/devsec"; //DEV public static String DEFAULT_SCOPE = "/gcube/devsec"; //DEV
public static String TEST_USER = "giancarlo.panichi"; public static String TEST_USER = "francesco.mangiacrapa";
// public static String ITEMID = "63832213-098d-42d1-8774-89b6349764c0"; //Activity T3.4 working drafts/T2-EC-IMAR-HO-14-015 iMarine Sustainability WP - Business Model tools.pdf // public static String ITEMID = "63832213-098d-42d1-8774-89b6349764c0"; //Activity T3.4 working drafts/T2-EC-IMAR-HO-14-015 iMarine Sustainability WP - Business Model tools.pdf
public static String ITEMID = "79b2490b-43aa-40b0-98ec-e073cf7d4887"; // public static String ITEMID = "79b2490b-43aa-40b0-98ec-e073cf7d4887";
// d81d3a64-603f-4907-ae74-be8353211807 // d81d3a64-603f-4907-ae74-be8353211807
protected static Logger logger = Logger.getLogger(ItemRetrieve.class); protected static Logger logger = Logger.getLogger(ItemRetrieve.class);
@ -48,14 +48,14 @@ public class ItemRetrieve {
Workspace ws = getWorkspace(); Workspace ws = getWorkspace();
// retrieveFirstLevel(ws, null); retrieveFirstLevel(ws, null);
retrieveFirstLevel(ws, ITEMID); // retrieveFirstLevel(ws, ITEMID);
System.out.println("get workspace -> OK"); System.out.println("get workspace -> OK");
WorkspaceItem item = ws.getItem(ITEMID); // WorkspaceItem item = ws.getItem(ITEMID);
System.out.println("get item id: "+item.getId()+", name: "+item.getName() +", parent: "+item.getParent()); // System.out.println("get item id: "+item.getId()+", name: "+item.getName() +", parent: "+item.getParent());
System.out.println(item); // System.out.println(item);
}catch(Exception e){ }catch(Exception e){
e.printStackTrace(); e.printStackTrace();
} }
@ -100,9 +100,14 @@ public class ItemRetrieve {
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
System.out.println("Start foundFolder at time: "+startTime); System.out.println("Start foundFolder at time: "+startTime);
// WorkspaceItem root = ws.getItem(ITEMID); // WorkspaceItem root = ws.getItem(ITEMID);
WorkspaceItem fd = ws.getItem(foundFolder); WorkspaceItem fd;
System.out.println("foundFolder id: "+foundFolder); if(foundFolder!=null){
System.out.println("start get children"); fd = ws.getItem(foundFolder);
System.out.println("foundFolder id: "+foundFolder);
System.out.println("start get children");
}else
fd = ws.getRoot();
List<? extends WorkspaceItem> children = fd.getChildren(); List<? extends WorkspaceItem> children = fd.getChildren();
System.out.println("tree getChildren() returning "+children.size()+" elements in " + time); System.out.println("tree getChildren() returning "+children.size()+" elements in " + time);

View File

@ -3,7 +3,6 @@
*/ */
package org.gcube.portlets.user.workspace; package org.gcube.portlets.user.workspace;
import java.io.BufferedInputStream;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -22,7 +21,6 @@ import org.gcube.common.homelibrary.home.workspace.exceptions.ItemAlreadyExistEx
import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException; import org.gcube.common.homelibrary.home.workspace.exceptions.WorkspaceFolderNotFoundException;
import org.gcube.common.homelibrary.home.workspace.exceptions.WrongDestinationException; import org.gcube.common.homelibrary.home.workspace.exceptions.WrongDestinationException;
import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile; import org.gcube.common.homelibrary.home.workspace.folder.items.ExternalFile;
import org.gcube.common.homelibrary.util.MimeTypeUtil;
import org.gcube.common.homelibrary.util.WorkspaceUtil; import org.gcube.common.homelibrary.util.WorkspaceUtil;
import org.gcube.common.scope.api.ScopeProvider; import org.gcube.common.scope.api.ScopeProvider;
import org.gcube.common.scope.impl.ScopeBean; import org.gcube.common.scope.impl.ScopeBean;
@ -48,7 +46,7 @@ public class UploadServletTest {
String filePath = "/home/francesco-mangiacrapa"; String filePath = "/home/francesco-mangiacrapa";
String fileName = "ASFIS 6 languages_2013.csv"; String fileName = "Geo Explorer 2016-01-15 18-51-51.png";
String fullPath = filePath + "/" + fileName; String fullPath = filePath + "/" + fileName;
@ -65,16 +63,16 @@ public class UploadServletTest {
// ExternalImage file = (ExternalImage) root.find(name); // ExternalImage file = (ExternalImage) root.find(name);
// UPLOAD FILE // UPLOAD FILE
String contentType = MimeTypeUtil.getMimeType(fileName, new BufferedInputStream( // String contentType = MimeTypeUtil.getMimeType(fileName, new BufferedInputStream(
new FileInputStream(new File(fullPath)))); // new FileInputStream(new File(fullPath))));
String itemName = WorkspaceUtil.getUniqueName(fileName, root); String itemName = WorkspaceUtil.getUniqueName(fileName, root);
System.out.println("Storing data...."); System.out.println("Storing data....");
System.out.println("content type " + contentType); System.out.println("content type " + null);
System.out.println("itemName " + itemName); System.out.println("itemName " + itemName);
ExternalFile file = (ExternalFile) WorkspaceUtil.createExternalFile( ExternalFile file = (ExternalFile) WorkspaceUtil.createExternalFile(
root, itemName, "", contentType, new FileInputStream(new File( root, itemName, "", null, new FileInputStream(new File(
fullPath))); fullPath)));
System.out.println("Storing data - OK" + "File [id: " + file.getId() System.out.println("Storing data - OK" + "File [id: " + file.getId()
@ -95,7 +93,7 @@ public class UploadServletTest {
InputStream inputStream = file.getData(); InputStream inputStream = file.getData();
// write the inputStream to a FileOutputStream // write the inputStream to a FileOutputStream
OutputStream out = new FileOutputStream(new File( OutputStream out = new FileOutputStream(new File(
"/home/francesco-mangiacrapa/Desktop/result")); "/home/francesco-mangiacrapa/Desktop/download/"+fileName));
int read = 0; int read = 0;
byte[] bytes = new byte[1024]; byte[] bytes = new byte[1024];