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