refs 2521: Explore the possibility to port the StatMan interface onto Dataminer

https://support.d4science.org/issues/2521

Added download to file parameters of algorithm

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@128801 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-05-24 14:16:41 +00:00
parent 4855c842ab
commit e83336757a
30 changed files with 519 additions and 163 deletions

View File

@ -106,7 +106,8 @@
<artifactId>home-library-model</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Authorization -->
<dependency>
<groupId>org.gcube.common</groupId>
<artifactId>common-authorization</artifactId>

View File

@ -16,7 +16,7 @@ public class ComputationStatus implements Serializable {
private static final long serialVersionUID = -1943128398882978439L;
public enum Status {
ACCEPTED, RUNNING, COMPLETE, FAILED
ACCEPTED, RUNNING, COMPLETE, FAILED, CANCELLED;
};
private double percentage;
@ -40,12 +40,12 @@ public class ComputationStatus implements Serializable {
this.percentage = percentage;
this.status = status;
}
public ComputationStatus(DataMinerServiceException error) {
super();
this.percentage = 100f;
this.status = Status.FAILED;
this.error=error;
this.error = error;
}
public boolean isComplete() {
@ -63,14 +63,19 @@ public class ComputationStatus implements Serializable {
public boolean isAccepted() {
return this.status == Status.ACCEPTED;
}
public boolean isCancelled() {
return this.status == Status.CANCELLED;
}
public boolean isPaused() {
return false;
//return this.status == Status.FAILED;
// return this.status == Status.FAILED;
}
public boolean isTerminated() {
return status == Status.COMPLETE || status == Status.FAILED;
return status == Status.COMPLETE || status == Status.FAILED
|| status == Status.CANCELLED;
}
public double getPercentage() {

View File

@ -65,7 +65,7 @@ public class ComputationValueImagePanel extends SimpleContainer {
v.add(saveImageBtn, new VerticalLayoutData(-1, -1, new Margins(0)));
final Image img = new Image(computationValueImage.getValue());
img.setPixelSize(480, 320);
img.setPixelSize(640, 480);
v.add(img, new VerticalLayoutData(1, -1, new Margins(0)));
}

View File

@ -0,0 +1,50 @@
/**
*
*/
.progressWrapOrange {
border: 1px solid #ffd075;
overflow: hidden;
}
@sprite .progressInnerOrange {
background-color: #f3ede0;
gwt-image: 'innerBarOrange';
height: auto;
position: relative;
}
@sprite .progressBarOrange {
background-color: #ffdf9f;
gwt-image: 'barOrange';
background-repeat: repeat-x;
background-position: left center;
height: 18px;
border-top-color: #fdefd1;
border-bottom-color: #f9d793;
border-right-color: #ffdd97;
}
.progressTextOrange {
color: #fff;
text-align: center;
font-size: 11px;
font-weight: bold;
font-family: sans-serif;
padding: 1px 5px;
overflow: hidden;
position: absolute;
z-index: 99;
}
.progressTextBackOrange {
color: #ffaf0d!important;
z-index: 9 !important;
}
@if user.agent ie6 ie8 ie9 {
.progressTextBackOrange {
line-height: 15px;
color: #ffaa00!important;
z-index: 9 !important;
}
}

View File

@ -0,0 +1,12 @@
<div class="{style.progressWrapOrange}" style="{wrapStyles}">
<div class="{style.progressInnerOrange}">
<div class="{style.progressBarOrange}" style="{progressBarStyles}">
<div class="{style.progressTextOrange}" style="{progressTextStyles}">
<div style="{widthStyles}">{text}</div>
</div>
<div class="{style.progressTextOrange} {style.progressTextBackOrange}">
<div style="{widthStyles}">{text}</div>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,18 @@
package org.gcube.portlets.user.dataminermanager.client.custom.progress;
import com.sencha.gxt.cell.core.client.ProgressBarCell;
import com.sencha.gxt.widget.core.client.ProgressBar;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class OrangeProgressBar extends ProgressBar {
public OrangeProgressBar() {
super(new ProgressBarCell(new OrangeProgressBarAppearance()));
}
}

View File

@ -0,0 +1,132 @@
package org.gcube.portlets.user.dataminermanager.client.custom.progress;
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.CssResource;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.resources.client.ImageResource.RepeatStyle;
import com.google.gwt.safecss.shared.SafeStyles;
import com.google.gwt.safecss.shared.SafeStylesUtils;
import com.google.gwt.safehtml.shared.SafeHtml;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.sencha.gxt.cell.core.client.ProgressBarCell.ProgressBarAppearance;
import com.sencha.gxt.cell.core.client.ProgressBarCell.ProgressBarAppearanceOptions;
import com.sencha.gxt.core.client.GXT;
import com.sencha.gxt.core.client.XTemplates;
import com.sencha.gxt.core.client.util.Format;
/**
*
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class OrangeProgressBarAppearance implements ProgressBarAppearance {
public interface OrangeProgressBarResources {
ImageResource barOrange();
ImageResource innerBarOrange();
OrangeProgressBarStyle style();
}
public interface OrangeProgressBarStyle extends CssResource {
String progressBarOrange();
String progressInnerOrange();
String progressTextOrange();
String progressTextBackOrange();
String progressWrapOrange();
}
public interface OrangeProgressBarTemplate extends XTemplates {
@XTemplate(source = "OrangeProgressBar.html")
SafeHtml render(SafeHtml text, OrangeProgressBarStyle style,
SafeStyles wrapStyles, SafeStyles progressBarStyles,
SafeStyles progressTextStyles, SafeStyles widthStyles);
}
public interface OrangeProgressBarDefaultResources extends
OrangeProgressBarResources, ClientBundle {
@Source({ "OrangeProgressBar.css" })
@Override
OrangeProgressBarStyle style();
@Source("orange-progress-bg.gif")
@ImageOptions(repeatStyle = RepeatStyle.Horizontal)
@Override
ImageResource barOrange();
@Source("orange-bg.gif")
@ImageOptions(repeatStyle = RepeatStyle.Horizontal)
@Override
ImageResource innerBarOrange();
}
private final OrangeProgressBarStyle style;
private OrangeProgressBarTemplate template;
public OrangeProgressBarAppearance() {
this(
GWT.<OrangeProgressBarDefaultResources> create(OrangeProgressBarDefaultResources.class),
GWT.<OrangeProgressBarTemplate> create(OrangeProgressBarTemplate.class));
}
public OrangeProgressBarAppearance(OrangeProgressBarResources resources,
OrangeProgressBarTemplate template) {
this.style = resources.style();
this.style.ensureInjected();
this.template = template;
}
@Override
public void render(SafeHtmlBuilder sb, Double value,
ProgressBarAppearanceOptions options) {
value = value == null ? 0 : value;
double valueWidth = value * options.getWidth();
int vw = new Double(valueWidth).intValue();
String text = options.getProgressText();
if (text != null) {
int v = (int) Math.round(value * 100);
text = Format.substitute(text, v);
}
SafeHtml txt;
if (text == null) {
txt = SafeHtmlUtils.fromSafeConstant("&#160;");
} else {
txt = SafeHtmlUtils.fromString(text);
}
int adj = GXT.isIE() ? 4 : 2;
SafeStyles wrapStyles = SafeStylesUtils.fromTrustedString("width:"
+ (options.getWidth() - adj) + "px;");
SafeStyles progressBarStyles = SafeStylesUtils
.fromTrustedString("width:" + vw + "px;");
SafeStyles progressTextStyles = SafeStylesUtils
.fromTrustedString("width:" + Math.max(vw - 8, 0) + "px;");
SafeStyles widthStyles = SafeStylesUtils.fromTrustedString("width:"
+ (Math.max(0, options.getWidth() - adj)) + "px;");
sb.append(template.render(txt, style, wrapStyles, progressBarStyles,
progressTextStyles, widthStyles));
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 B

View File

@ -379,7 +379,7 @@ public class InputDataSetsPanel extends FramedPanel {
}
} catch (Throwable e) {
Log.error("Error in ImputDataSetsPanel: " + e.getLocalizedMessage());
Log.error("Error in InputDataSetsPanel: " + e.getLocalizedMessage());
e.printStackTrace();
}
}

View File

@ -7,6 +7,7 @@ import org.gcube.portlets.user.dataminermanager.client.bean.ComputationStatus;
import org.gcube.portlets.user.dataminermanager.client.bean.ComputationStatus.Status;
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminermanager.client.custom.progress.GreenProgressBar;
import org.gcube.portlets.user.dataminermanager.client.custom.progress.OrangeProgressBar;
import org.gcube.portlets.user.dataminermanager.client.custom.progress.RedProgressBar;
import org.gcube.portlets.user.dataminermanager.client.events.CancelComputationExecutionRequestEvent;
import org.gcube.portlets.user.dataminermanager.client.rpc.DataMinerPortletServiceAsync;
@ -86,24 +87,25 @@ public class ComputationStatusPanel extends SimpleContainer {
vert.add(new HtmlLayoutContainer("<p>Created, the id is "
+ computationId.getId() + " [<a href='"
+ computationId.getUrlId() + "' >link</a>]</p>"));
TextButton equivalentRequestBtn=new TextButton();
TextButton equivalentRequestBtn = new TextButton();
equivalentRequestBtn.setText("Show");
equivalentRequestBtn.addSelectHandler(new SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
showEquivalentRequestDialog();
}
});
FieldLabel equivalentRequestLabel=new FieldLabel(equivalentRequestBtn,"Equivalent Get Request");
FieldLabel equivalentRequestLabel = new FieldLabel(
equivalentRequestBtn, "Equivalent Get Request");
equivalentRequestLabel.setLabelWidth(140);
vert.add(equivalentRequestLabel, new VerticalLayoutData(-1, -1, new Margins(0)));
vert.add(equivalentRequestLabel, new VerticalLayoutData(-1, -1,
new Margins(0)));
progressBar = new ProgressBar();
progressBar.updateProgress(0, "Starting...");
vert.add(progressBar, new VerticalLayoutData(1, -1, new Margins(20)));
@ -130,8 +132,9 @@ public class ComputationStatusPanel extends SimpleContainer {
}
private void showEquivalentRequestDialog() {
EquivalentRequestDialog equivalentRequestDialog=new EquivalentRequestDialog(computationId);
equivalentRequestDialog.show();
EquivalentRequestDialog equivalentRequestDialog = new EquivalentRequestDialog(
computationId);
equivalentRequestDialog.show();
}
private void cancelComputation() {
@ -172,7 +175,8 @@ public class ComputationStatusPanel extends SimpleContainer {
if (computationStatus.getError() == null) {
errorMessage = new String("Computation Failed!");
} else {
errorMessage = computationStatus.getError().getLocalizedMessage();
errorMessage = computationStatus.getError()
.getLocalizedMessage();
}
Info.display("Failed",
"The computation " + computationId.getId() + " of "
@ -191,6 +195,26 @@ public class ComputationStatusPanel extends SimpleContainer {
.setMarginBottom(36, Unit.PX);
vert.insert(progressBar, index, new VerticalLayoutData(1, -1,
new Margins(20)));
} else if (computationStatus.isCancelled()) {
Log.debug("Computation Cancelled");
String errorMessage;
errorMessage = new String("Computation Cancelled!");
Info.display("Info", "The computation " + computationId.getId()
+ " of " + computationId.getOperatorName()
+ " has been cancelled.");
UtilsGXT3.info("Info",
"The computation " + computationId.getId() + " of "
+ computationId.getOperatorName()
+ " has been cancelled.</br>" + errorMessage);
int index = vert.getWidgetIndex(progressBar);
vert.remove(index);
// TODO
progressBar = new OrangeProgressBar();
progressBar.updateProgress(1, "Computation Cancelled");
progressBar.getElement().getStyle()
.setMarginBottom(36, Unit.PX);
vert.insert(progressBar, index, new VerticalLayoutData(1, -1,
new Margins(20)));
}
}
@ -198,8 +222,6 @@ public class ComputationStatusPanel extends SimpleContainer {
forceLayout();
}
/**
*
*/
@ -218,23 +240,21 @@ public class ComputationStatusPanel extends SimpleContainer {
}
/**
* @param computationStatus
*/
private void updateStatus(ComputationStatus computationStatus) {
Log.debug("Conputation Status Panel ::Update Status "+computationStatus);
if (computationStatus.getStatus().compareTo(Status.ACCEPTED)==0)
Log.debug("Conputation Status Panel ::Update Status "
+ computationStatus);
if (computationStatus.getStatus().compareTo(Status.ACCEPTED) == 0)
progressBar.updateText("Accepted...");
else {
double percentage = computationStatus.getPercentage();
if(percentage==0){
if (percentage == 0) {
progressBar.updateText("Running, 0% Complete");
} else {
progressBar.updateProgress(percentage/100, "Running, "
+ percentage
+ "% Complete");
progressBar.updateProgress(percentage / 100, "Running, "
+ percentage + "% Complete");
}
}
forceLayout();
@ -267,12 +287,15 @@ public class ComputationStatusPanel extends SimpleContainer {
@Override
public void onSuccess(
ComputationStatus computationStatus) {
if (computationStatus.isTerminated()) {
ComputationTimer.this.cancel();
computationTerminated(computationId,
computationStatus);
} else
updateStatus(computationStatus);
Log.debug("ComputationStatus: "+computationStatus);
if (computationStatus != null) {
if (computationStatus.isTerminated()) {
ComputationTimer.this.cancel();
computationTerminated(computationId,
computationStatus);
} else
updateStatus(computationStatus);
}
}
});
}

View File

@ -8,6 +8,8 @@ import java.util.Arrays;
import java.util.List;
import org.gcube.portlets.user.dataminermanager.client.DataMinerManager;
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminermanager.client.events.SessionExpiredEvent;
import org.gcube.portlets.user.dataminermanager.client.rpc.DataMinerPortletServiceAsync;
import org.gcube.portlets.user.dataminermanager.client.util.UtilsGXT3;
import org.gcube.portlets.user.dataminermanager.shared.exception.ExpiredSessionServiceException;
@ -20,6 +22,7 @@ import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.core.client.dom.XDOM;
@ -37,8 +40,8 @@ import com.sencha.gxt.widget.core.client.form.TextField;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class FileFld extends AbstractFld {
@ -56,23 +59,25 @@ public class FileFld extends AbstractFld {
private HBoxLayoutContainer horiz;
private TextButton downloadButton;
/**
* @param parameter
*/
public FileFld(Parameter parameter) {
super(parameter);
super(parameter);
fileParameter = (FileParameter) parameter;
SimpleContainer tabContainer=new SimpleContainer();
vp=new VerticalLayoutContainer();
SimpleContainer tabContainer = new SimpleContainer();
vp = new VerticalLayoutContainer();
init();
tabContainer.add(vp, new MarginData(new Margins(0)));
fieldContainer = new SimpleContainer();
horiz = new HBoxLayoutContainer();
horiz.setPack(BoxLayoutPack.START);
horiz.setEnableOverflow(false);
HtmlLayoutContainer descr;
if (fileParameter.getDescription() == null) {
@ -90,11 +95,10 @@ public class FileFld extends AbstractFld {
fieldContainer.add(horiz);
showNoSelectionField();
}
private void init(){
private void init() {
List<ItemType> selectableTypes = new ArrayList<ItemType>();
selectableTypes.add(ItemType.EXTERNAL_FILE);
@ -114,7 +118,6 @@ public class FileFld extends AbstractFld {
} else {
retrieveFileInformation(item);
}
}
@ -142,23 +145,21 @@ public class FileFld extends AbstractFld {
wselectDialog.setZIndex(XDOM.getTopZIndex());
selectButton = new TextButton("Select File");
selectButton.setIcon(DataMinerManager.resources.folderExplore());
selectButton.setIcon(DataMinerManager.resources.folderExplore());
selectButton.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
wselectDialog.show();
}
});
selectButton.setToolTip("Select File");
selectButton2 = new TextButton("");
selectButton2 = new TextButton("");
selectButton2.setIcon(DataMinerManager.resources.folderExplore());
selectButton2.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
wselectDialog.show();
@ -169,21 +170,31 @@ public class FileFld extends AbstractFld {
cancelButton = new TextButton("");
cancelButton.setIcon(DataMinerManager.resources.cancel());
cancelButton.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
selectedFileItem = null;
showNoSelectionField();
}
});
downloadButton = new TextButton("");
downloadButton.setIcon(DataMinerManager.resources.fileDownload());
downloadButton.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
downloadFile();
}
});
}
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>() {
@ -196,8 +207,7 @@ public class FileFld extends AbstractFld {
UtilsGXT3.alert("Error", "Expired Session");
} else {
UtilsGXT3.alert(
"Error",
UtilsGXT3.alert("Error",
"Error retrieving file informations: "
+ caught.getLocalizedMessage());
}
@ -214,10 +224,41 @@ public class FileFld extends AbstractFld {
}
});
}
private void downloadFile() {
if (selectedFileItem != null) {
DataMinerPortletServiceAsync.INSTANCE.getPublicLink(
selectedFileItem, new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
if (caught instanceof ExpiredSessionServiceException) {
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(), "");
}
});
} else {
UtilsGXT3.info("Attention", "Select a file!");
}
}
private void showNoSelectionField() {
vp.clear();
@ -228,24 +269,25 @@ public class FileFld extends AbstractFld {
private void showFieldWithSelection() {
String fileName = selectedFileItem.getName();
if(fileName==null|| fileName.isEmpty()){
fileName="NoName";
if (fileName == null || fileName.isEmpty()) {
fileName = "NoName";
}
TextField tableDescription=new TextField();
TextField tableDescription = new TextField();
tableDescription.setValue(fileName);
tableDescription.setReadOnly(true);
HBoxLayoutContainer h=new HBoxLayoutContainer();
h.add(tableDescription,new BoxLayoutData(new Margins()));
h.add(selectButton2,new BoxLayoutData(new Margins()));
h.add(cancelButton,new BoxLayoutData(new Margins()));
HBoxLayoutContainer h = new HBoxLayoutContainer();
h.add(tableDescription, new BoxLayoutData(new Margins()));
h.add(selectButton2, new BoxLayoutData(new Margins()));
h.add(downloadButton, new BoxLayoutData(new Margins()));
h.add(cancelButton, new BoxLayoutData(new Margins()));
vp.clear();
vp.add(h);
vp.forceLayout();
fieldContainer.forceLayout();
}
/**
@ -263,7 +305,8 @@ public class FileFld extends AbstractFld {
@Override
public String getValue() {
return (selectedFileItem == null) ? null : selectedFileItem.getPublicLink();
return (selectedFileItem == null) ? null : selectedFileItem
.getPublicLink();
}
}

View File

@ -5,17 +5,21 @@ import java.util.Arrays;
import java.util.List;
import org.gcube.portlets.user.dataminermanager.client.DataMinerManager;
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminermanager.client.events.SessionExpiredEvent;
import org.gcube.portlets.user.dataminermanager.client.rpc.DataMinerPortletServiceAsync;
import org.gcube.portlets.user.dataminermanager.client.util.UtilsGXT3;
import org.gcube.portlets.user.dataminermanager.shared.data.TableItemSimple;
import org.gcube.portlets.user.dataminermanager.shared.exception.ExpiredSessionServiceException;
import org.gcube.portlets.user.dataminermanager.shared.parameters.TabularParameter;
import org.gcube.portlets.user.dataminermanager.shared.workspace.ItemDescription;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.sencha.gxt.core.client.dom.XDOM;
import com.sencha.gxt.core.client.util.Margins;
@ -40,6 +44,8 @@ public class TabItem extends HBoxLayoutContainer {
private TextButton removeBtn;
private TextField tableDescription;
private WorkspaceExplorerSelectDialog wselectDialog;
private TextButton downloadButton;
private ItemDescription itemDescriptionSelected;
/**
*
@ -74,6 +80,8 @@ public class TabItem extends HBoxLayoutContainer {
selectButton.setToolTip("Select Data Set");
selectButton2 = new TextButton("");
selectButton2.setIcon(DataMinerManager.resources.folderExplore());
selectButton2.setToolTip("Select Another Data Set");
selectButton2.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
@ -81,15 +89,23 @@ public class TabItem extends HBoxLayoutContainer {
wselectDialog.show();
}
});
selectButton2.setIcon(DataMinerManager.resources.folderExplore());
selectButton2.setToolTip("Select Another Data Set");
selectButton2.setVisible(false);
downloadButton = new TextButton("");
downloadButton.setIcon(DataMinerManager.resources.fileDownload());
downloadButton.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
downloadFile();
}
});
downloadButton.setVisible(false);
addBtn = new TextButton("");
addBtn.setIcon(DataMinerManager.resources.add());
addBtn.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
@ -101,7 +117,6 @@ public class TabItem extends HBoxLayoutContainer {
removeBtn = new TextButton("");
removeBtn.setIcon(DataMinerManager.resources.cancel());
removeBtn.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
@ -113,18 +128,18 @@ public class TabItem extends HBoxLayoutContainer {
});
removeBtn.setVisible(!first);
setPack(BoxLayoutPack.START);
setEnableOverflow(false);
add(tableDescription, new BoxLayoutData(new Margins()));
add(selectButton, new BoxLayoutData(new Margins()));
add(selectButton2, new BoxLayoutData(new Margins()));
add(downloadButton, new BoxLayoutData(new Margins()));
add(addBtn, new BoxLayoutData(new Margins()));
add(removeBtn, new BoxLayoutData(new Margins()));
forceLayout();
}
@ -198,6 +213,11 @@ public class TabItem extends HBoxLayoutContainer {
}
private void retrieveTableInformation(Item item) {
Log.debug("Retrieved: " + item);
itemDescriptionSelected = new ItemDescription(
item.getId(), item.getName(), item.getOwner(), item.getPath(),
item.getType().name());
DataMinerPortletServiceAsync.INSTANCE.retrieveTableInformation(item,
new AsyncCallback<TableItemSimple>() {
@ -226,6 +246,41 @@ public class TabItem extends HBoxLayoutContainer {
});
}
private void downloadFile() {
if (itemDescriptionSelected != null) {
DataMinerPortletServiceAsync.INSTANCE.getPublicLink(
itemDescriptionSelected, new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
if (caught instanceof ExpiredSessionServiceException) {
EventBusProvider.INSTANCE
.fireEvent(new SessionExpiredEvent());
} else {
Log.error("Error downloading table: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
caught.getLocalizedMessage());
}
caught.printStackTrace();
}
@Override
public void onSuccess(String link) {
Log.debug("Retrieved link: " + link);
Window.open(link, itemDescriptionSelected.getName(), "");
}
});
} else {
UtilsGXT3.info("Attention", "Select a Table!");
}
}
/**
*
*/
@ -242,6 +297,7 @@ public class TabItem extends HBoxLayoutContainer {
tableDescription.setVisible(true);
selectButton.setVisible(false);
selectButton2.setVisible(true);
downloadButton.setVisible(true);
parent.forceLayout();
} catch (Throwable e) {

View File

@ -8,6 +8,8 @@ import java.util.Arrays;
import java.util.List;
import org.gcube.portlets.user.dataminermanager.client.DataMinerManager;
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
import org.gcube.portlets.user.dataminermanager.client.events.SessionExpiredEvent;
import org.gcube.portlets.user.dataminermanager.client.events.TabularFldChangeEvent;
import org.gcube.portlets.user.dataminermanager.client.events.TabularFldChangeEvent.HasTabularFldChangeEventHandler;
import org.gcube.portlets.user.dataminermanager.client.events.TabularFldChangeEvent.TabularFldChangeEventHandler;
@ -17,6 +19,7 @@ import org.gcube.portlets.user.dataminermanager.shared.data.TableItemSimple;
import org.gcube.portlets.user.dataminermanager.shared.exception.ExpiredSessionServiceException;
import org.gcube.portlets.user.dataminermanager.shared.parameters.Parameter;
import org.gcube.portlets.user.dataminermanager.shared.parameters.TabularParameter;
import org.gcube.portlets.user.dataminermanager.shared.workspace.ItemDescription;
import org.gcube.portlets.widgets.wsexplorer.client.notification.WorkspaceExplorerSelectNotification.WorskpaceExplorerSelectNotificationListener;
import org.gcube.portlets.widgets.wsexplorer.client.select.WorkspaceExplorerSelectDialog;
import org.gcube.portlets.widgets.wsexplorer.shared.Item;
@ -25,6 +28,7 @@ import org.gcube.portlets.widgets.wsexplorer.shared.ItemType;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.core.client.dom.XDOM;
@ -55,10 +59,13 @@ public class TabularFld extends AbstractFld implements
private VerticalLayoutContainer vp;
private WorkspaceExplorerSelectDialog wselectDialog;
private TextButton selectButton, selectButton2, cancelButton;
private TextButton selectButton, selectButton2, cancelButton,
downloadButton;
private HtmlLayoutContainer templatesList;
private TableItemSimple selectedTableItem = null;
private ItemDescription itemDescriptionSelected;
private TabularParameter tabularParameter;
/**
* @param parameter
@ -78,7 +85,8 @@ public class TabularFld extends AbstractFld implements
showNoSelectionField();
} catch (Throwable e) {
Log.error("TabularField: " + e.getLocalizedMessage());
UtilsGXT3.alert("Error", "Error creating Tabular Field: "+e.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error creating Tabular Field: " + e.getLocalizedMessage());
e.printStackTrace();
}
}
@ -231,6 +239,7 @@ public class TabularFld extends AbstractFld implements
selectButton2.setToolTip("Select Another Data Set");
cancelButton = new TextButton("");
cancelButton.setIcon(DataMinerManager.resources.cancel());
cancelButton.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
@ -241,7 +250,15 @@ public class TabularFld extends AbstractFld implements
}
});
cancelButton.setIcon(DataMinerManager.resources.cancel());
downloadButton = new TextButton("");
downloadButton.setIcon(DataMinerManager.resources.fileDownload());
downloadButton.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
downloadFile();
}
});
} catch (Throwable e) {
Log.error("TabularField init: " + e.getLocalizedMessage());
e.printStackTrace();
@ -250,6 +267,12 @@ public class TabularFld extends AbstractFld implements
}
private void retrieveTableInformation(Item item) {
Log.debug("Retrieved: " + item);
itemDescriptionSelected = new ItemDescription(
item.getId(), item.getName(), item.getOwner(), item.getPath(),
item.getType().name());
DataMinerPortletServiceAsync.INSTANCE.retrieveTableInformation(item,
new AsyncCallback<TableItemSimple>() {
@ -277,6 +300,40 @@ public class TabularFld extends AbstractFld implements
}
});
}
private void downloadFile() {
if (itemDescriptionSelected != null) {
DataMinerPortletServiceAsync.INSTANCE.getPublicLink(
itemDescriptionSelected, new AsyncCallback<String>() {
@Override
public void onFailure(Throwable caught) {
if (caught instanceof ExpiredSessionServiceException) {
EventBusProvider.INSTANCE
.fireEvent(new SessionExpiredEvent());
} else {
Log.error("Error downloading table: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
caught.getLocalizedMessage());
}
caught.printStackTrace();
}
@Override
public void onSuccess(String link) {
Log.debug("Retrieved link: " + link);
Window.open(link, itemDescriptionSelected.getName(), "");
}
});
} else {
UtilsGXT3.info("Attention", "Select a Table!");
}
}
/**
*
@ -306,6 +363,7 @@ public class TabularFld extends AbstractFld implements
HBoxLayoutContainer h = new HBoxLayoutContainer();
h.add(tableDescription, new BoxLayoutData(new Margins()));
h.add(selectButton2, new BoxLayoutData(new Margins()));
h.add(downloadButton, new BoxLayoutData(new Margins()));
h.add(cancelButton, new BoxLayoutData(new Margins()));
vp.clear();
vp.add(h);

View File

@ -1,23 +1,19 @@
package org.gcube.portlets.user.dataminermanager.client.resources;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
/**
*
* @author Giancarlo Panichi
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* @author Giancarlo Panichi email: <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public interface Resources extends ClientBundle {
@Source("logo.png")
ImageResource logo();
@Source("logoLittle.png")
ImageResource logoLittle();
@Source("goBack.png")
ImageResource goBack();
@ -30,15 +26,9 @@ public interface Resources extends ClientBundle {
@Source("inputSpace.png")
ImageResource inputSpaceIcon();
@Source("application_side_expand.png")
ImageResource addOperator();
@Source("connector1.png")
ImageResource workflowConnector1();
@Source("connector2.png")
ImageResource workflowConnector2();
@Source("triangle.png")
ImageResource startComputation();
@ -60,70 +50,31 @@ public interface Resources extends ClientBundle {
@Source("add.png")
ImageResource add();
@Source("table.png")
ImageResource table();
@Source("refresh.png")
ImageResource refresh();
@Source("details.png")
ImageResource details();
@Source("tableResult.png")
ImageResource tableResult();
@Source("menuItemComputations.png")
ImageResource menuItemComputations();
@Source("menuItemExperiment.png")
ImageResource menuItemExperiment();
@Source("menuItemDataspace.png")
ImageResource menuItemInputspace();
@Source("table.png")
ImageResource fileDownload(); // TODO change
@Source("ajax-loader.gif")
ImageResource loader();
@Source("ajax-loader-big.gif")
ImageResource loaderBig();
@Source("ajax-complete.gif")
ImageResource loadingComplete();
@Source("inputSpaceImporter.png")
ImageResource inputSpaceImporter();
@Source("inputSpaceMonitor.png")
ImageResource inputSpaceMonitor();
@Source("save.png")
ImageResource save();
@Source("alert.png")
ImageResource error();
@Source("arrow_out.png")
ImageResource expand();
@Source("arrow_in.png")
ImageResource collapse();
@Source("application_view_list.png")
ImageResource groupBy();
@Source("map.png")
ImageResource map();
@Source("user_green.png")
ImageResource userPerspective();
@Source("monitor.png")
ImageResource computationPerspective();
@Source("arrow_redo.png")
ImageResource resubmit();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 696 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 804 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 947 B

View File

@ -368,10 +368,7 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session);
logger.debug("CancelComputation(): " + itemDescription);
Map<String, String> properties = StorageUtil.getProperties(
aslSession.getUsername(), itemDescription.getId());
logger.debug("Properties: " + properties);
String compId = properties.get("computation_id");
String compId = itemDescription.getName();
if(compId==null){
throw new ServiceException("Computation Id not found!");
} else {

View File

@ -868,8 +868,7 @@ public class SClient4WPS extends SClient {
.getExecuteResponse().getStatus();
if (statusType == null) {
logger.debug("WPS FAILURE: Status Type is null");
computationStatus = new ComputationStatus(
Status.FAILED, 100f);
computationStatus = null;
} else {
String failure = statusType.getProcessFailed() == null ? null
@ -935,9 +934,20 @@ public class SClient4WPS extends SClient {
Status.RUNNING,
statusd);
} else {
logger.debug("WPS STATUS: Not Started, "
+ statusType
.getProcessStarted());
if (status == -1) {
logger.debug("WPS STATUS: Computation cancelled, "
+ statusType
.getProcessStarted());
computationStatus = new ComputationStatus(
Status.CANCELLED,
-1);
} else {
logger.debug("WPS STATUS: Not Started, "
+ statusType
.getProcessStarted());
}
}
}
}
@ -1234,10 +1244,10 @@ public class SClient4WPS extends SClient {
}
if (userInputs.isEmpty()) {
logger.error("Attention no imputs parameters retrieved for this computation: "
logger.error("Attention no inputs parameters retrieved for this computation: "
+ computationProperties);
throw new Exception(
"Attention no imputs parameters retrieved for this computation: "
"Attention no inputs parameters retrieved for this computation: "
+ computationProperties);
}

View File

@ -43,7 +43,7 @@ public class StorageUtil {
public static InputStream getStorageClientInputStream(String url)
throws Exception {
/*
* try { logger.debug("Get ImputStream from: "+url); SMPUrl smsHome =
* try { logger.debug("Get InputStream from: "+url); SMPUrl smsHome =
* new SMPUrl(url); logger.debug("smsHome: [host:" + smsHome.getHost() +
* " path:" + smsHome.getPath() + " ref:" + smsHome.getRef() +
* " userinfo:" + smsHome.getUserInfo() + " ]"); URLConnection uc =
@ -51,9 +51,9 @@ public class StorageUtil {
* uc.getInputStream(); return is;
*
* } catch (Exception e) {
* logger.error("Error retrieving imput stream from storage: ", e);
* logger.error("Error retrieving input stream from storage: ", e);
* e.printStackTrace(); throw new Exception(
* "Error retrieving imput stream from storage: " +
* "Error retrieving input stream from storage: " +
* e.getLocalizedMessage(), e); }
*/
@ -150,7 +150,7 @@ public class StorageUtil {
throw new ServiceException("Folder is not valid!");
}
return getImputStream(user, workSpaceItem);
return getInputStream(user, workSpaceItem);
} catch (WorkspaceFolderNotFoundException | InternalErrorException
| HomeNotFoundException | ItemNotFoundException e) {
@ -169,7 +169,7 @@ public class StorageUtil {
* @return InputStream
* @throws StatAlgoImporterServiceException
*/
private static InputStream getImputStream(String user, WorkspaceItem wi)
private static InputStream getInputStream(String user, WorkspaceItem wi)
throws ServiceException {
InputStream is = null;
try {