Release gCube 4.8
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@158452 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
dc60b5a056
commit
83bdf26878
|
@ -67,7 +67,8 @@ public class FileFld extends AbstractFld {
|
|||
private TextButton netcdfButton;
|
||||
|
||||
/**
|
||||
* @param parameter parameter
|
||||
* @param parameter
|
||||
* parameter
|
||||
*/
|
||||
public FileFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
|
@ -85,14 +86,20 @@ public class FileFld extends AbstractFld {
|
|||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (fileParameter.getDescription() == null) {
|
||||
if (fileParameter.getDescription() == null || fileParameter.getDescription().isEmpty()) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'>"
|
||||
+ fileParameter.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
if (fileParameter.isNetcdf()) {
|
||||
String des = fileParameter.getDescription().replaceFirst("\\[NETCDF\\]", "");
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'>" + des + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
} else {
|
||||
descr = new HtmlLayoutContainer(
|
||||
"<p style='margin-left:5px !important;'>" + fileParameter.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
}
|
||||
|
||||
horiz.add(tabContainer, new BoxLayoutData(new Margins()));
|
||||
|
@ -129,8 +136,7 @@ public class FileFld extends AbstractFld {
|
|||
|
||||
@Override
|
||||
public void onFailed(Throwable throwable) {
|
||||
Log.error("Error in create project: "
|
||||
+ throwable.getLocalizedMessage());
|
||||
Log.error("Error in create project: " + throwable.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", throwable.getLocalizedMessage());
|
||||
throwable.printStackTrace();
|
||||
}
|
||||
|
@ -192,7 +198,7 @@ public class FileFld extends AbstractFld {
|
|||
downloadFile();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
netcdfButton = new TextButton("");
|
||||
netcdfButton.setIcon(DataMinerManager.resources.netcdf());
|
||||
netcdfButton.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
@ -207,92 +213,83 @@ public class FileFld extends AbstractFld {
|
|||
|
||||
private void retrieveFileInformation(final Item item) {
|
||||
Log.debug("Retrieved: " + item);
|
||||
final ItemDescription itemDescription = new ItemDescription(
|
||||
item.getId(), item.getName(), item.getOwner(), item.getPath(),
|
||||
item.getType().name());
|
||||
final ItemDescription itemDescription = new ItemDescription(item.getId(), item.getName(), item.getOwner(),
|
||||
item.getPath(), item.getType().name());
|
||||
|
||||
DataMinerPortletServiceAsync.INSTANCE.getPublicLink(itemDescription,
|
||||
new AsyncCallback<String>() {
|
||||
DataMinerPortletServiceAsync.INSTANCE.getPublicLink(itemDescription, new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.error("Error in retrieveFileInformation: "
|
||||
+ caught.getMessage());
|
||||
if (caught instanceof SessionExpiredServiceException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session");
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.error("Error in retrieveFileInformation: " + caught.getMessage());
|
||||
if (caught instanceof SessionExpiredServiceException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session");
|
||||
|
||||
} else {
|
||||
UtilsGXT3.alert("Error",
|
||||
"Error retrieving file informations: "
|
||||
+ caught.getLocalizedMessage());
|
||||
}
|
||||
} else {
|
||||
UtilsGXT3.alert("Error", "Error retrieving file informations: " + caught.getLocalizedMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
itemDescription.setPublicLink(result);
|
||||
selectedFileItem = itemDescription;
|
||||
Log.debug("SelectedFileItem: " + selectedFileItem);
|
||||
showFieldWithSelection();
|
||||
@Override
|
||||
public void onSuccess(String result) {
|
||||
itemDescription.setPublicLink(result);
|
||||
selectedFileItem = itemDescription;
|
||||
Log.debug("SelectedFileItem: " + selectedFileItem);
|
||||
showFieldWithSelection();
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private void downloadFile() {
|
||||
if (selectedFileItem != null) {
|
||||
DataMinerPortletServiceAsync.INSTANCE.getPublicLink(
|
||||
selectedFileItem, new AsyncCallback<String>() {
|
||||
DataMinerPortletServiceAsync.INSTANCE.getPublicLink(selectedFileItem, new AsyncCallback<String>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof SessionExpiredServiceException) {
|
||||
EventBusProvider.INSTANCE
|
||||
.fireEvent(new SessionExpiredEvent());
|
||||
} else {
|
||||
Log.error("Error downloading file: "
|
||||
+ caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error",
|
||||
caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
if (caught instanceof SessionExpiredServiceException) {
|
||||
EventBusProvider.INSTANCE.fireEvent(new SessionExpiredEvent());
|
||||
} else {
|
||||
Log.error("Error downloading file: " + caught.getLocalizedMessage());
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
}
|
||||
caught.printStackTrace();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(String link) {
|
||||
Log.debug("Retrieved link: " + link);
|
||||
Window.open(link, selectedFileItem.getName(), "");
|
||||
}
|
||||
@Override
|
||||
public void onSuccess(String link) {
|
||||
Log.debug("Retrieved link: " + link);
|
||||
Window.open(link, selectedFileItem.getName(), "");
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
} else {
|
||||
UtilsGXT3.info("Attention", "Select a file!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void showNetCDFFile() {
|
||||
if (selectedFileItem != null) {
|
||||
GWT.log("NetcdfBasicWidgetsManager");
|
||||
|
||||
|
||||
// Example
|
||||
SelectVariableEventHandler handler=new SelectVariableEventHandler() {
|
||||
|
||||
SelectVariableEventHandler handler = new SelectVariableEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onResponse(SelectVariableEvent event) {
|
||||
GWT.log("SelectVariable Response: "+event);
|
||||
|
||||
GWT.log("SelectVariable Response: " + event);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
NetCDFPreviewDialog netcdfDialog=new NetCDFPreviewDialog(selectedFileItem.getPublicLink());
|
||||
|
||||
NetCDFPreviewDialog netcdfDialog = new NetCDFPreviewDialog(selectedFileItem.getPublicLink());
|
||||
netcdfDialog.addSelectVariableEventHandler(handler);
|
||||
netcdfDialog.setZIndex(XDOM.getTopZIndex());
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -318,7 +315,7 @@ public class FileFld extends AbstractFld {
|
|||
h.add(tableDescription, new BoxLayoutData(new Margins()));
|
||||
h.add(selectButton2, new BoxLayoutData(new Margins()));
|
||||
h.add(downloadButton, new BoxLayoutData(new Margins()));
|
||||
if(fileParameter.isNetcdf()){
|
||||
if (fileParameter.isNetcdf()) {
|
||||
h.add(netcdfButton, new BoxLayoutData(new Margins()));
|
||||
}
|
||||
h.add(cancelButton, new BoxLayoutData(new Margins()));
|
||||
|
@ -344,8 +341,7 @@ public class FileFld extends AbstractFld {
|
|||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return (selectedFileItem == null) ? null : selectedFileItem
|
||||
.getPublicLink();
|
||||
return (selectedFileItem == null) ? null : selectedFileItem.getPublicLink();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -298,7 +298,6 @@ public class WPS2DM {
|
|||
} else {
|
||||
if (title.contains("[a http link to a file")) {
|
||||
if (title.contains("[NETCDF]")) {
|
||||
title.replaceFirst("[NETCDF]", "");
|
||||
converted = new FileParameter(id, title, mimeType, supportedMimeTypes, true);
|
||||
} else {
|
||||
converted = new FileParameter(id, title, mimeType, supportedMimeTypes, false);
|
||||
|
@ -323,7 +322,6 @@ public class WPS2DM {
|
|||
supportedMimeTypes);
|
||||
} else {
|
||||
if (title.contains("[NETCDF]")) {
|
||||
title.replaceFirst("[NETCDF]", "");
|
||||
converted = new FileParameter(id, title, mimeType, supportedMimeTypes, true);
|
||||
} else {
|
||||
converted = new FileParameter(id, title, mimeType, supportedMimeTypes, false);
|
||||
|
@ -331,7 +329,6 @@ public class WPS2DM {
|
|||
}
|
||||
} else {
|
||||
if (title.contains("[NETCDF]")) {
|
||||
title.replaceFirst("[NETCDF]", "");
|
||||
converted = new FileParameter(id, title, mimeType, supportedMimeTypes, true);
|
||||
} else {
|
||||
converted = new FileParameter(id, title, mimeType, supportedMimeTypes, false);
|
||||
|
|
Loading…
Reference in New Issue