Implemented improvement #19695#note-4
This commit is contained in:
parent
2c4b91e835
commit
aec8ae3332
|
@ -208,6 +208,8 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
private WsTaskExecutorWidget taskExecutor = new WsTaskExecutorWidget();
|
private WsTaskExecutorWidget taskExecutor = new WsTaskExecutorWidget();
|
||||||
|
|
||||||
public static final int delayTime = 3000;
|
public static final int delayTime = 3000;
|
||||||
|
|
||||||
|
public static Map<String, List<String>> mapOfAllowedMimeTypesForPreview = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new app controller explorer.
|
* Instantiates a new app controller explorer.
|
||||||
|
@ -2130,7 +2132,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
sub.loadFolder(loadFolderEvent.getTargetFolder());
|
sub.loadFolder(loadFolderEvent.getTargetFolder());
|
||||||
} else if (event instanceof GetInfoEvent) {
|
} else if (event instanceof GetInfoEvent) {
|
||||||
GetInfoEvent getInfoEvent = (GetInfoEvent) event;
|
GetInfoEvent getInfoEvent = (GetInfoEvent) event;
|
||||||
sub.showDetails(getInfoEvent.getSourceFile());
|
sub.showDetails(getInfoEvent.getSourceFile(), mapOfAllowedMimeTypesForPreview);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2326,6 +2328,7 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
this.explorerPanel = new ExplorerPanel(true, true);
|
this.explorerPanel = new ExplorerPanel(true, true);
|
||||||
loadMyLogin();
|
loadMyLogin();
|
||||||
loadMyFirstName();
|
loadMyFirstName();
|
||||||
|
loadAllowedMimeTypesForPreview();
|
||||||
return this.explorerPanel;
|
return this.explorerPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2347,9 +2350,12 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
this.selectRootItem = selectRootItem;
|
this.selectRootItem = selectRootItem;
|
||||||
loadMyLogin();
|
loadMyLogin();
|
||||||
loadMyFirstName();
|
loadMyFirstName();
|
||||||
|
loadAllowedMimeTypesForPreview();
|
||||||
return this.explorerPanel;
|
return this.explorerPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Edi permissions.
|
* Edi permissions.
|
||||||
*
|
*
|
||||||
|
@ -2633,6 +2639,22 @@ public class AppControllerExplorer implements EventHandler, TreeAppControllerInt
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void loadAllowedMimeTypesForPreview() {
|
||||||
|
|
||||||
|
rpcWorkspaceService.getAllowedMimetypesForPreview(new AsyncCallback<Map<String,List<String>>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Map<String, List<String>> result) {
|
||||||
|
|
||||||
|
mapOfAllowedMimeTypesForPreview = result;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load my first name.
|
* Load my first name.
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.workspace.client.interfaces;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.ViewSwitchType;
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.ViewSwitchType;
|
||||||
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.WS_UPLOAD_TYPE;
|
import org.gcube.portlets.user.workspace.client.ConstantsExplorer.WS_UPLOAD_TYPE;
|
||||||
|
@ -204,8 +205,9 @@ public interface SubscriberInterface {
|
||||||
* Show details.
|
* Show details.
|
||||||
*
|
*
|
||||||
* @param fileModel the file model
|
* @param fileModel the file model
|
||||||
|
* @param mapAllowedMimeTypesForPreview the map allowed mime types for preview
|
||||||
*/
|
*/
|
||||||
void showDetails(FileModel fileModel);
|
void showDetails(FileModel fileModel, Map<String,List<String>> mapAllowedMimeTypesForPreview);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -418,7 +418,7 @@ public interface Icons extends ClientBundle {
|
||||||
@Source("icons/sync-icon-synched.png")
|
@Source("icons/sync-icon-synched.png")
|
||||||
ImageResource syncIconSynched();
|
ImageResource syncIconSynched();
|
||||||
|
|
||||||
@Source("icons/preview-not-available.png")
|
@Source("icons/no-preview-available.png")
|
||||||
ImageResource previewNotAvailable();
|
ImageResource previewNotAvailable();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 3.3 KiB |
|
@ -688,4 +688,11 @@ public interface GWTWorkspaceService extends RemoteService {
|
||||||
*/
|
*/
|
||||||
String updateDescriptionForItem(String itemId, String newDescription) throws Exception;
|
String updateDescriptionForItem(String itemId, String newDescription) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the allowed mimetypes for preview.
|
||||||
|
*
|
||||||
|
* @return the allowed mimetypes for preview
|
||||||
|
*/
|
||||||
|
Map<String, List<String>> getAllowedMimetypesForPreview();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -622,5 +622,14 @@ public interface GWTWorkspaceServiceAsync {
|
||||||
* @param callback the callback
|
* @param callback the callback
|
||||||
*/
|
*/
|
||||||
void updateDescriptionForItem(String itemId, String newDescription, AsyncCallback<String> callback);
|
void updateDescriptionForItem(String itemId, String newDescription, AsyncCallback<String> callback);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the allowed mimetypes for preview.
|
||||||
|
*
|
||||||
|
* @return the allowed mimetypes for preview
|
||||||
|
*/
|
||||||
|
void getAllowedMimetypesForPreview(AsyncCallback<Map<String, List<String>>> callback);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,6 @@ import org.gcube.portlets.user.workspace.client.event.FileDownloadEvent.Download
|
||||||
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
|
import org.gcube.portlets.user.workspace.client.interfaces.GXTFolderItemTypeEnum;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
import org.gcube.portlets.user.workspace.client.model.FileGridModel;
|
||||||
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
import org.gcube.portlets.user.workspace.client.model.FileModel;
|
||||||
import org.gcube.portlets.user.workspace.client.resources.Icons;
|
|
||||||
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.GWTWorkspaceItem;
|
import org.gcube.portlets.user.workspace.client.workspace.GWTWorkspaceItem;
|
||||||
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalImage;
|
import org.gcube.portlets.user.workspace.client.workspace.folder.item.GWTExternalImage;
|
||||||
|
@ -52,6 +51,7 @@ import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
import com.google.gwt.user.client.ui.Image;
|
import com.google.gwt.user.client.ui.Image;
|
||||||
import com.google.gwt.user.client.ui.NamedFrame;
|
import com.google.gwt.user.client.ui.NamedFrame;
|
||||||
import com.google.gwt.user.client.ui.Widget;
|
import com.google.gwt.user.client.ui.Widget;
|
||||||
|
import com.google.gwt.user.server.Base64Utils;
|
||||||
|
|
||||||
// TODO: Auto-generated Javadoc
|
// TODO: Auto-generated Javadoc
|
||||||
/**
|
/**
|
||||||
|
@ -62,6 +62,8 @@ import com.google.gwt.user.client.ui.Widget;
|
||||||
*/
|
*/
|
||||||
public class DialogGetInfoBootstrap extends Composite {
|
public class DialogGetInfoBootstrap extends Composite {
|
||||||
|
|
||||||
|
private static final int PREVIEW_WAITING_TIME = 10000;
|
||||||
|
|
||||||
private static DialogGetInfoBootstrapUiBinder uiBinder = GWT.create(DialogGetInfoBootstrapUiBinder.class);
|
private static DialogGetInfoBootstrapUiBinder uiBinder = GWT.create(DialogGetInfoBootstrapUiBinder.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -189,16 +191,24 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
|
|
||||||
private Long fileSize = null;
|
private Long fileSize = null;
|
||||||
|
|
||||||
|
private Map<String, List<String>> mapAllowedMimeTypesForPreview;
|
||||||
|
|
||||||
|
private Image spinnerImage = Resources.getIconLoading().createImage();
|
||||||
|
|
||||||
|
private Image noPreviewAvailable = new Image(Resources.getPreviewNotAvailable());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new dialog get info bootstrap.
|
* Instantiates a new dialog get info bootstrap.
|
||||||
*
|
*
|
||||||
* @param fileModel the file model
|
* @param fileModel the file model
|
||||||
* @param onCloseCommand the on close command
|
* @param onCloseCommand the on close command
|
||||||
|
* @param mapAllowedMimeTypesForPreview the map allowed mime types for preview
|
||||||
*/
|
*/
|
||||||
public DialogGetInfoBootstrap(final FileModel fileModel, final Command onCloseCommand) {
|
public DialogGetInfoBootstrap(final FileModel fileModel, final Command onCloseCommand, Map<String,List<String>> mapAllowedMimeTypesForPreview) {
|
||||||
initWidget(uiBinder.createAndBindUi(this));
|
initWidget(uiBinder.createAndBindUi(this));
|
||||||
this.fileModel = fileModel;
|
this.fileModel = fileModel;
|
||||||
this.onCloseCommand = onCloseCommand;
|
this.onCloseCommand = onCloseCommand;
|
||||||
|
this.mapAllowedMimeTypesForPreview = mapAllowedMimeTypesForPreview;
|
||||||
this.cgTxtMimeType.setVisible(true);
|
this.cgTxtMimeType.setVisible(true);
|
||||||
|
|
||||||
buttonClose.getElement().getStyle().setFloat(Float.RIGHT);
|
buttonClose.getElement().getStyle().setFloat(Float.RIGHT);
|
||||||
|
@ -340,111 +350,93 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
|
|
||||||
|
|
||||||
// SOLUTION BASED ON GOOGLE DOC VIEWER
|
// SOLUTION BASED ON GOOGLE DOC VIEWER
|
||||||
if (typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_PDF_FILE) ||
|
if (typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_PDF_FILE)
|
||||||
|
|| typeEnum.equals(GXTFolderItemTypeEnum.PDF_DOCUMENT)
|
||||||
typeEnum.equals(GXTFolderItemTypeEnum.PDF_DOCUMENT)
|
|| typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_FILE)
|
||||||
|| typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_FILE)) {
|
|| typeEnum.equals(GXTFolderItemTypeEnum.GCUBE_ITEM)
|
||||||
|
|| typeEnum.equals(GXTFolderItemTypeEnum.URL_DOCUMENT)
|
||||||
AppControllerExplorer.rpcWorkspaceService.getPublicLinkForFileItemId(fileModel.getIdentifier(), false,
|
|| typeEnum.equals(GXTFolderItemTypeEnum.METADATA)){
|
||||||
new AsyncCallback<PublicLink>() {
|
|
||||||
|
if(mapAllowedMimeTypesForPreview.containsKey(fileModel.getType())){
|
||||||
@Override
|
GWT.log("Mime type "+fileModel.getType()+" allowed for preview, try to display it");
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
}
|
AppControllerExplorer.rpcWorkspaceService.getPublicLinkForFileItemId(fileModel.getIdentifier(), false,
|
||||||
|
new AsyncCallback<PublicLink>() {
|
||||||
@Override
|
|
||||||
public void onSuccess(PublicLink result) {
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
GWT.log("The PublicLink link is: " + result);
|
}
|
||||||
|
|
||||||
if (result != null) {
|
@Override
|
||||||
|
public void onSuccess(PublicLink result) {
|
||||||
//if file size is null or greater than 25MB
|
|
||||||
long byteTo25MB = 1024*1024*25;
|
GWT.log("The PublicLink link is: " + result);
|
||||||
GWT.log("The file size is: "+fileSize);
|
|
||||||
if(fileSize==null || fileSize>byteTo25MB) {
|
if (result != null) {
|
||||||
GWT.log("The file size is null or greater than "+byteTo25MB+", returning");
|
|
||||||
//htmlPanelFilePreview.add(new Image(Resources.getPreviewNotAvailable()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// String pdfPreview = "<iframe frameBorder=\"0\" class=\"my-preview-doc\" "
|
|
||||||
// + "src=\"https://docs.google.com/viewer?url="
|
|
||||||
// + URL.encode(result.getCompleteURL()) + "&embedded=true\">" + "</iframe>";
|
|
||||||
|
|
||||||
String googleDocViewerURL = "https://docs.google.com/viewer?url="
|
|
||||||
+ URL.encode(result.getCompleteURL()) + "&embedded=true";
|
|
||||||
|
|
||||||
final HTML loadingPreviewHTML = new HTML();
|
|
||||||
setPlaceholder(loadingPreviewHTML, "loading preview...");
|
|
||||||
|
|
||||||
final Frame frame = instanceFrame(googleDocViewerURL, loadingPreviewHTML);
|
|
||||||
|
|
||||||
final long startTime = new Date().getTime();
|
|
||||||
Timer timer = new Timer() {
|
|
||||||
|
|
||||||
@Override
|
//if file size is null or greater than 25MB
|
||||||
public void run() {
|
long byteTo25MB = 1024*1024*25;
|
||||||
GWT.log("Checking if the iFrameGoogleDocViewer is ready");
|
GWT.log("The file size is: "+fileSize);
|
||||||
if(iFrameGoogleDocViewerLoaded) {
|
if(fileSize==null || fileSize>byteTo25MB) {
|
||||||
removePlaceHolder(loadingPreviewHTML);
|
GWT.log("The file size is null or greater than "+byteTo25MB+", returning");
|
||||||
GWT.log("iFrameGoogleDocViewer currently loaded, cancelling timer");
|
//htmlPanelFilePreview.add(new Image(Resources.getPreviewNotAvailable()));
|
||||||
cancel();
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
long checkTime = new Date().getTime();
|
// String pdfPreview = "<iframe frameBorder=\"0\" class=\"my-preview-doc\" "
|
||||||
long diff = checkTime - startTime;
|
// + "src=\"https://docs.google.com/viewer?url="
|
||||||
if(diff>5000) {//is greater than 5 sec
|
// + URL.encode(result.getCompleteURL()) + "&embedded=true\">" + "</iframe>";
|
||||||
try {
|
|
||||||
GWT.log("iFrameGoogleDocViewer not loaded within 5 sec, cancelling timer, removing iframe");
|
String googleDocViewerURL = "https://docs.google.com/viewer?url="
|
||||||
cancel();
|
+ URL.encode(result.getCompleteURL()) + "&embedded=true";
|
||||||
|
|
||||||
|
final HTML loadingPreviewHTML = new HTML();
|
||||||
|
setPlaceholder(loadingPreviewHTML, true, "loading preview...");
|
||||||
|
|
||||||
|
final Frame frame = instanceFrame(googleDocViewerURL, loadingPreviewHTML);
|
||||||
|
|
||||||
|
final long startTime = new Date().getTime();
|
||||||
|
Timer timer = new Timer() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
GWT.log("Checking if the iFrameGoogleDocViewer is ready");
|
||||||
|
if(iFrameGoogleDocViewerLoaded) {
|
||||||
removePlaceHolder(loadingPreviewHTML);
|
removePlaceHolder(loadingPreviewHTML);
|
||||||
htmlPanelFilePreview.add(new Image(Resources.getPreviewNotAvailable()));
|
GWT.log("iFrameGoogleDocViewer currently loaded, cancelling timer");
|
||||||
frame.setVisible(false);
|
cancel();
|
||||||
htmlPanelFilePreview.remove(frame);
|
return;
|
||||||
}catch (Exception e) {
|
}
|
||||||
//Silent
|
long checkTime = new Date().getTime();
|
||||||
|
long diff = checkTime - startTime;
|
||||||
|
if(diff>PREVIEW_WAITING_TIME) {//is greater than 10 sec
|
||||||
|
try {
|
||||||
|
GWT.log("iFrameGoogleDocViewer not loaded within 5 sec, cancelling timer, removing iframe");
|
||||||
|
cancel();
|
||||||
|
removePlaceHolder(loadingPreviewHTML);
|
||||||
|
htmlPanelFilePreview.add(noPreviewAvailable);
|
||||||
|
frame.setVisible(false);
|
||||||
|
htmlPanelFilePreview.remove(frame);
|
||||||
|
}catch (Exception e) {
|
||||||
|
//Silent
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
};
|
timer.scheduleRepeating(200);
|
||||||
timer.scheduleRepeating(200);
|
|
||||||
|
htmlPanelFilePreview.add(loadingPreviewHTML);
|
||||||
htmlPanelFilePreview.add(loadingPreviewHTML);
|
htmlPanelFilePreview.add(frame);
|
||||||
htmlPanelFilePreview.add(frame);
|
htmlPanelFilePreview.setVisible(true);
|
||||||
htmlPanelFilePreview.setVisible(true);
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}else {
|
||||||
|
GWT.log("Mime type "+fileModel.getType()+" NOT allowed for preview, displaying 'No preview available'");
|
||||||
|
htmlPanelFilePreview.add(noPreviewAvailable);
|
||||||
|
htmlPanelFilePreview.setVisible(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//SOLUTION BASED ON PDFOBEJCT
|
|
||||||
/*if(typeEnum.equals(GXTFolderItemTypeEnum.EXTERNAL_PDF_FILE) ||
|
|
||||||
typeEnum.equals(GXTFolderItemTypeEnum.PDF_DOCUMENT)) {
|
|
||||||
|
|
||||||
GWT.log("The file is a PDF");
|
|
||||||
|
|
||||||
AppControllerExplorer.rpcWorkspaceService.getPublicLinkForFileItemId(fileModel.getIdentifier(), false, new AsyncCallback<PublicLink>() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onFailure(Throwable caught) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSuccess(PublicLink result) {
|
|
||||||
|
|
||||||
GWT.log("The PublicLink link is: "+result);
|
|
||||||
|
|
||||||
if(result!=null) {
|
|
||||||
|
|
||||||
String pdfPreview = "<div id=\"pdfPrewiewDiv\" class=\"my-preview-doc\"> </div>";
|
|
||||||
htmlPanelFilePreview.add(new HTML(pdfPreview));
|
|
||||||
showPDFPreview(result.getCompleteURL(), "pdfPrewiewDiv");
|
|
||||||
htmlPanelFilePreview.setVisible(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
addHandlers();
|
addHandlers();
|
||||||
|
@ -602,7 +594,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
*/
|
*/
|
||||||
private void loadLocation(FileModel fileModel) {
|
private void loadLocation(FileModel fileModel) {
|
||||||
|
|
||||||
setPlaceholder(txtLocation, "loading...");
|
setPlaceholder(txtLocation, false, "loading...");
|
||||||
AppControllerExplorer.rpcWorkspaceService.getListParentsByItemIdentifier(fileModel.getIdentifier(), false,
|
AppControllerExplorer.rpcWorkspaceService.getListParentsByItemIdentifier(fileModel.getIdentifier(), false,
|
||||||
new AsyncCallback<List<FileModel>>() {
|
new AsyncCallback<List<FileModel>>() {
|
||||||
|
|
||||||
|
@ -641,7 +633,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
*/
|
*/
|
||||||
private void loadSize(final String itemId) {
|
private void loadSize(final String itemId) {
|
||||||
GWT.log("Load size");
|
GWT.log("Load size");
|
||||||
setPlaceholder(txtSize, "loading...");
|
setPlaceholder(txtSize, false, "loading...");
|
||||||
fileSize = new Long(-1); //means is loading
|
fileSize = new Long(-1); //means is loading
|
||||||
AppControllerExplorer.rpcWorkspaceService.loadSizeByItemId(itemId, new AsyncCallback<Long>() {
|
AppControllerExplorer.rpcWorkspaceService.loadSizeByItemId(itemId, new AsyncCallback<Long>() {
|
||||||
|
|
||||||
|
@ -673,7 +665,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
*/
|
*/
|
||||||
private void loadCreationDate(final String itemId) {
|
private void loadCreationDate(final String itemId) {
|
||||||
|
|
||||||
setPlaceholder(txtCreated, "loading...");
|
setPlaceholder(txtCreated, false, "loading...");
|
||||||
AppControllerExplorer.rpcWorkspaceService.getItemCreationDateById(itemId, new AsyncCallback<Date>() {
|
AppControllerExplorer.rpcWorkspaceService.getItemCreationDateById(itemId, new AsyncCallback<Date>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -701,7 +693,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
*/
|
*/
|
||||||
private void loadLastModificationDate(final String itemId) {
|
private void loadLastModificationDate(final String itemId) {
|
||||||
|
|
||||||
setPlaceholder(txtLastMofication, "loading...");
|
setPlaceholder(txtLastMofication, false, "loading...");
|
||||||
AppControllerExplorer.rpcWorkspaceService.loadLastModificationDateById(itemId, new AsyncCallback<Date>() {
|
AppControllerExplorer.rpcWorkspaceService.loadLastModificationDateById(itemId, new AsyncCallback<Date>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -794,7 +786,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
*/
|
*/
|
||||||
private void loadACLsDescriptionForSharedFolder(String sharedId) {
|
private void loadACLsDescriptionForSharedFolder(String sharedId) {
|
||||||
|
|
||||||
setPlaceholder(txtSharedWith, "loading...");
|
setPlaceholder(txtSharedWith, true, "loading...");
|
||||||
|
|
||||||
WorkspaceSharingServiceAsync.INSTANCE.getACLsDescriptionForSharedFolderId(sharedId,
|
WorkspaceSharingServiceAsync.INSTANCE.getACLsDescriptionForSharedFolderId(sharedId,
|
||||||
new AsyncCallback<String>() {
|
new AsyncCallback<String>() {
|
||||||
|
@ -827,7 +819,7 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
htmlPanelImagePreview.setVisible(true);
|
htmlPanelImagePreview.setVisible(true);
|
||||||
final HTML txtLoadingPreview = new HTML();
|
final HTML txtLoadingPreview = new HTML();
|
||||||
htmlPanelImagePreview.add(txtLoadingPreview);
|
htmlPanelImagePreview.add(txtLoadingPreview);
|
||||||
setPlaceholder(txtLoadingPreview, "loading preview...");
|
setPlaceholder(txtLoadingPreview, true, "loading preview...");
|
||||||
|
|
||||||
AppControllerExplorer.rpcWorkspaceService.getImageById(fileModel.getIdentifier(),
|
AppControllerExplorer.rpcWorkspaceService.getImageById(fileModel.getIdentifier(),
|
||||||
fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT), false,
|
fileModel.getGXTFolderItemType().equals(GXTFolderItemTypeEnum.IMAGE_DOCUMENT), false,
|
||||||
|
@ -863,8 +855,12 @@ public class DialogGetInfoBootstrap extends Composite {
|
||||||
* @param html the html
|
* @param html the html
|
||||||
* @param placeholder the placeholder
|
* @param placeholder the placeholder
|
||||||
*/
|
*/
|
||||||
private void setPlaceholder(HTML html, String placeholder) {
|
private void setPlaceholder(HTML html, boolean spinner, String placeholder) {
|
||||||
html.setHTML(placeholder);
|
String loadingHMTL = placeholder;
|
||||||
|
if(spinner) {
|
||||||
|
loadingHMTL = "<span><img src=\""+spinnerImage.getUrl()+"\" style=\"padding-right:5px;\">"+placeholder+"</span>";
|
||||||
|
}
|
||||||
|
html.setHTML(loadingHMTL);
|
||||||
html.getElement().addClassName("placeholder-loading");
|
html.getElement().addClassName("placeholder-loading");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -399,7 +399,7 @@ IN THE 'DETAILS' PANEL*/
|
||||||
}
|
}
|
||||||
|
|
||||||
.placeholder-loading {
|
.placeholder-loading {
|
||||||
color: #E8E8E8;
|
color: rgb(142, 142, 142);
|
||||||
}
|
}
|
||||||
|
|
||||||
.shared-with-style{
|
.shared-with-style{
|
||||||
|
|
|
@ -53,6 +53,7 @@ import org.gcube.portlets.user.workspace.server.reader.ApplicationProfileReader;
|
||||||
import org.gcube.portlets.user.workspace.server.tostoragehub.FormatterUtil;
|
import org.gcube.portlets.user.workspace.server.tostoragehub.FormatterUtil;
|
||||||
import org.gcube.portlets.user.workspace.server.tostoragehub.ObjectStorageHubToWorkpaceMapper;
|
import org.gcube.portlets.user.workspace.server.tostoragehub.ObjectStorageHubToWorkpaceMapper;
|
||||||
import org.gcube.portlets.user.workspace.server.tostoragehub.StorageHubToWorkpaceConverter;
|
import org.gcube.portlets.user.workspace.server.tostoragehub.StorageHubToWorkpaceConverter;
|
||||||
|
import org.gcube.portlets.user.workspace.server.util.MimeTypeUtility;
|
||||||
import org.gcube.portlets.user.workspace.server.util.PortalContextInfo;
|
import org.gcube.portlets.user.workspace.server.util.PortalContextInfo;
|
||||||
import org.gcube.portlets.user.workspace.server.util.StringUtil;
|
import org.gcube.portlets.user.workspace.server.util.StringUtil;
|
||||||
import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
import org.gcube.portlets.user.workspace.server.util.WsUtil;
|
||||||
|
@ -3077,6 +3078,14 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update description for item.
|
||||||
|
*
|
||||||
|
* @param itemId the item id
|
||||||
|
* @param newDescription the new description
|
||||||
|
* @return the string
|
||||||
|
* @throws Exception the exception
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String updateDescriptionForItem(String itemId, String newDescription) throws Exception {
|
public String updateDescriptionForItem(String itemId, String newDescription) throws Exception {
|
||||||
workspaceLogger.info("Called updateDescriptionForItem for itemID: " + itemId);
|
workspaceLogger.info("Called updateDescriptionForItem for itemID: " + itemId);
|
||||||
|
@ -3101,4 +3110,24 @@ public class GWTWorkspaceServiceImpl extends RemoteServiceServlet implements GWT
|
||||||
return newDescription;
|
return newDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the allowed mimetypes for preview.
|
||||||
|
*
|
||||||
|
* @return the allowed mimetypes for preview
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, List<String>> getAllowedMimetypesForPreview(){
|
||||||
|
workspaceLogger.info("Called getAllowedMimetypesForPreview");
|
||||||
|
|
||||||
|
Map<String, List<String>> map = MimeTypeUtility.getPreviewMimetypeExtensionMap();
|
||||||
|
|
||||||
|
workspaceLogger.debug("Returning allowed mimetypes for preview: "+map.keySet());
|
||||||
|
|
||||||
|
return map;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.tika.mime.MediaType;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
// TODO: Auto-generated Javadoc
|
||||||
/**
|
/**
|
||||||
* The Class MimeTypeUtil.
|
* The Class MimeTypeUtil.
|
||||||
*
|
*
|
||||||
|
@ -48,15 +49,19 @@ public class MimeTypeUtility {
|
||||||
|
|
||||||
protected static final Map<String, List<String>> mimetype_extension_map = new LinkedHashMap<String, List<String>>();
|
protected static final Map<String, List<String>> mimetype_extension_map = new LinkedHashMap<String, List<String>>();
|
||||||
protected static final Map<String, String> extension_mimetype_map = new LinkedHashMap<String, String>();
|
protected static final Map<String, String> extension_mimetype_map = new LinkedHashMap<String, String>();
|
||||||
|
protected static final Map<String, List<String>> preview_mimetype_extension_map = new LinkedHashMap<String, List<String>>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
InputStream extensionToMimetype = MimeTypeUtility.class
|
InputStream extensionToMimetype = MimeTypeUtility.class
|
||||||
.getResourceAsStream("/WsExtensionToMimeTypeMap.properties");
|
.getResourceAsStream("/WsExtensionToMimeTypeMap.properties");
|
||||||
InputStream mimetypeToExtension = MimeTypeUtility.class
|
InputStream mimetypeToExtension = MimeTypeUtility.class
|
||||||
.getResourceAsStream("/WsMimeTypeToExtensionMap.properties");
|
.getResourceAsStream("/WsMimeTypeToExtensionMap.properties");
|
||||||
|
InputStream previewMimeTypeToExtension = MimeTypeUtility.class
|
||||||
|
.getResourceAsStream("/PreviewMimeTypeToExtensionMap.properties");
|
||||||
try {
|
try {
|
||||||
loadExtensions(extensionToMimetype);
|
loadExtensions(extensionToMimetype);
|
||||||
loadMimeTypes(mimetypeToExtension);
|
loadMimeTypes(mimetypeToExtension);
|
||||||
|
loadPreviewMimeTypes(previewMimeTypeToExtension);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -114,6 +119,35 @@ public class MimeTypeUtility {
|
||||||
}
|
}
|
||||||
br.close();
|
br.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load preview mime types.
|
||||||
|
*
|
||||||
|
* @param is the is
|
||||||
|
* @throws IOException Signals that an I/O exception has occurred.
|
||||||
|
*/
|
||||||
|
protected static void loadPreviewMimeTypes(InputStream is) throws IOException {
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(is));
|
||||||
|
|
||||||
|
String line = br.readLine();
|
||||||
|
|
||||||
|
while (line != null) {
|
||||||
|
String[] split = line.split("=");
|
||||||
|
if (split.length == 2) {
|
||||||
|
String mimeType = split[0];
|
||||||
|
String extension = split[1];
|
||||||
|
List<String> toExtensions = preview_mimetype_extension_map.get(mimeType);
|
||||||
|
if (toExtensions == null) {
|
||||||
|
toExtensions = new ArrayList<String>();
|
||||||
|
}
|
||||||
|
toExtensions.add(extension);
|
||||||
|
preview_mimetype_extension_map.put(mimeType, toExtensions);
|
||||||
|
}
|
||||||
|
line = br.readLine();
|
||||||
|
}
|
||||||
|
br.close();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the extension.
|
* Gets the extension.
|
||||||
|
@ -279,5 +313,16 @@ public class MimeTypeUtility {
|
||||||
public static Map<String, String> getExtensionToMimeTypeMap() {
|
public static Map<String, String> getExtensionToMimeTypeMap() {
|
||||||
return extension_mimetype_map;
|
return extension_mimetype_map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the preview mimetype extension map with the
|
||||||
|
* mime types allowed for preview displaying
|
||||||
|
*
|
||||||
|
* @return the preview mimetype extension map
|
||||||
|
*/
|
||||||
|
public static Map<String, List<String>> getPreviewMimetypeExtensionMap() {
|
||||||
|
return preview_mimetype_extension_map;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
application/msword=doc
|
||||||
|
application/pdf=pdf
|
||||||
|
application/rtf=rtf
|
||||||
|
application/vnd.ms-excel=xls
|
||||||
|
application/vnd.ms-powerpoint=ppt
|
||||||
|
application/vnd.openxmlformats-officedocument.wordprocessingml.document=docx
|
||||||
|
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet=xlsx
|
||||||
|
application/vnd.openxmlformats-officedocument.presentationml.presentation=pptx
|
||||||
|
application/x-javascript=js
|
||||||
|
application/json=json
|
||||||
|
audio/mid=mid
|
||||||
|
audio/mpeg=mp3
|
||||||
|
audio/x-wav=wav
|
||||||
|
image/bmp=bmp
|
||||||
|
image/gif=gif
|
||||||
|
image/ief=ief
|
||||||
|
image/jpeg=jpe
|
||||||
|
image/jpeg=jpeg
|
||||||
|
image/jpeg=jpg
|
||||||
|
image/pipeg=jfif
|
||||||
|
image/svg+xml=svg
|
||||||
|
image/tiff=tif
|
||||||
|
image/tiff=tiff
|
||||||
|
image/x-cmu-raster=ras
|
||||||
|
image/x-cmx=cmx
|
||||||
|
image/x-icon=ico
|
||||||
|
image/x-rgb=rgb
|
||||||
|
text/css=css
|
||||||
|
text/html=htm
|
||||||
|
text/html=stm
|
||||||
|
text/html=html
|
||||||
|
text/plain=bas
|
||||||
|
text/plain=c
|
||||||
|
text/plain=h
|
||||||
|
text/plain=txt
|
||||||
|
text/richtext=rtx
|
||||||
|
text/scriptlet=sct
|
||||||
|
text/tab-separated-values=tsv
|
||||||
|
text/uri-list=txt
|
||||||
|
text/webviewhtml=htt
|
||||||
|
text/x-component=htc
|
||||||
|
video/mpeg=mp2
|
||||||
|
video/mpeg=mpa
|
||||||
|
video/mpeg=mpe
|
||||||
|
video/mpeg=mpeg
|
||||||
|
video/mpeg=mpg
|
||||||
|
video/mpeg=mpv2
|
||||||
|
video/quicktime=mov
|
||||||
|
video/quicktime=qt
|
||||||
|
video/x-la-asf=lsf
|
||||||
|
video/x-la-asf=lsx
|
||||||
|
video/x-ms-asf=asf
|
||||||
|
video/x-ms-asf=asr
|
||||||
|
video/x-ms-asf=asx
|
||||||
|
video/x-msvideo=avi
|
||||||
|
video/x-sgi-movie=movie
|
||||||
|
x-world/x-vrml=flr
|
||||||
|
x-world/x-vrml=vrml
|
||||||
|
x-world/x-vrml=wrl
|
||||||
|
x-world/x-vrml=wrz
|
||||||
|
x-world/x-vrml=xaf
|
||||||
|
x-world/x-vrml=xof
|
Loading…
Reference in New Issue