2521: Explore the possibility to port the StatMan interface onto Dataminer
https://support.d4science.org/issues/2521 Updated shows results for computations git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@128562 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8944d6dd0a
commit
7ab1d64685
|
@ -72,14 +72,15 @@ public class ComputationsExecutedPanel extends FramedPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
setId("ComputationsPanel");
|
setItemId("ComputationsExecutedPanel");
|
||||||
forceLayoutOnResize = true;
|
forceLayoutOnResize = true;
|
||||||
setBodyBorder(true);
|
setBodyBorder(false);
|
||||||
|
setBorders(false);
|
||||||
setBodyStyle("backgroundColor:white;");
|
setBodyStyle("backgroundColor:white;");
|
||||||
setHeaderVisible(true);
|
setHeaderVisible(true);
|
||||||
setResize(true);
|
setResize(true);
|
||||||
setAnimCollapse(false);
|
setAnimCollapse(false);
|
||||||
setHeadingText("Computations");
|
setHeadingText("Computations Executed");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,10 +3,15 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.dataminermanager.client.computations;
|
package org.gcube.portlets.user.dataminermanager.client.computations;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
|
||||||
|
import org.gcube.portlets.user.dataminermanager.client.events.ComputationDataEvent;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -15,11 +20,15 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.Verti
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ComputationsPanel extends FramedPanel {
|
public class ComputationsPanel extends FramedPanel {
|
||||||
|
private ComputationsExecutedPanel computationsExecutedPanel;
|
||||||
|
private ComputationsViewerPanel computationsViewerPanel;
|
||||||
|
|
||||||
|
|
||||||
public ComputationsPanel() {
|
public ComputationsPanel() {
|
||||||
super();
|
super();
|
||||||
init();
|
init();
|
||||||
create();
|
create();
|
||||||
|
bind();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
|
@ -29,13 +38,48 @@ public class ComputationsPanel extends FramedPanel {
|
||||||
setHeaderVisible(true);
|
setHeaderVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void bind(){
|
||||||
|
EventBusProvider.INSTANCE.addHandler(ComputationDataEvent.getType(),
|
||||||
|
new ComputationDataEvent.ComputationDataEventHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onComputationData(ComputationDataEvent event) {
|
||||||
|
Log.debug("Catch ComputationDataEvent: " + event);
|
||||||
|
showComputationsViewer(event);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void showComputationsViewer(ComputationDataEvent event) {
|
||||||
|
if(computationsViewerPanel.isCollapsed()){
|
||||||
|
computationsViewerPanel.expand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void create() {
|
private void create() {
|
||||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
computationsExecutedPanel = new ComputationsExecutedPanel();
|
||||||
ComputationsExecutedPanel importedDataPanel = new ComputationsExecutedPanel();
|
computationsViewerPanel = new ComputationsViewerPanel();
|
||||||
ComputationsViewerPanel computedDataPanel = new ComputationsViewerPanel();
|
|
||||||
v.add(importedDataPanel, new VerticalLayoutData(1, 0.5, new Margins(0)));
|
MarginData centerData = new MarginData(0);
|
||||||
v.add(computedDataPanel, new VerticalLayoutData(1, 0.5, new Margins(0)));
|
|
||||||
add(v);
|
BorderLayoutData southData = new BorderLayoutData(0.5);
|
||||||
|
southData.setMargins(new Margins(0));
|
||||||
|
southData.setCollapsible(true);
|
||||||
|
southData.setSplit(true);
|
||||||
|
southData.setCollapsed(true);
|
||||||
|
|
||||||
|
BorderLayoutContainer borderLayoutContainer = new BorderLayoutContainer();
|
||||||
|
borderLayoutContainer.setCenterWidget(computationsExecutedPanel, centerData);
|
||||||
|
borderLayoutContainer.setSouthWidget(computationsViewerPanel, southData);
|
||||||
|
|
||||||
|
add(borderLayoutContainer, new MarginData(new Margins(0)));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.gcube.portlets.user.dataminermanager.client.computations;
|
package org.gcube.portlets.user.dataminermanager.client.computations;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
|
|
||||||
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
|
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
|
||||||
|
@ -12,10 +13,17 @@ import org.gcube.portlets.user.dataminermanager.shared.data.ComputationData;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.dom.client.Style.Unit;
|
import com.google.gwt.dom.client.Style.Unit;
|
||||||
|
import com.google.gwt.http.client.Request;
|
||||||
|
import com.google.gwt.http.client.RequestBuilder;
|
||||||
|
import com.google.gwt.http.client.RequestCallback;
|
||||||
|
import com.google.gwt.http.client.RequestException;
|
||||||
|
import com.google.gwt.http.client.Response;
|
||||||
|
import com.google.gwt.http.client.URL;
|
||||||
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.MarginData;
|
||||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
|
@ -34,6 +42,8 @@ public class ComputationsViewerPanel extends FramedPanel {
|
||||||
|
|
||||||
private VerticalLayoutContainer v;
|
private VerticalLayoutContainer v;
|
||||||
private ComputationData computationData;
|
private ComputationData computationData;
|
||||||
|
private ArrayList<String> urlList;
|
||||||
|
private LinkedHashMap<String, String> urlFileNameMap;
|
||||||
|
|
||||||
public ComputationsViewerPanel() {
|
public ComputationsViewerPanel() {
|
||||||
super();
|
super();
|
||||||
|
@ -47,9 +57,10 @@ public class ComputationsViewerPanel extends FramedPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() {
|
private void init() {
|
||||||
setId("ComputationsViewerPanel");
|
setItemId("ComputationsViewerPanel");
|
||||||
forceLayoutOnResize = true;
|
forceLayoutOnResize = true;
|
||||||
setBodyBorder(true);
|
setBodyBorder(false);
|
||||||
|
setBorders(false);
|
||||||
setBodyStyle("backgroundColor:white;");
|
setBodyStyle("backgroundColor:white;");
|
||||||
setHeaderVisible(true);
|
setHeaderVisible(true);
|
||||||
setResize(true);
|
setResize(true);
|
||||||
|
@ -166,7 +177,7 @@ public class ComputationsViewerPanel extends FramedPanel {
|
||||||
HtmlLayoutContainer title = new HtmlLayoutContainer(
|
HtmlLayoutContainer title = new HtmlLayoutContainer(
|
||||||
"<br><center>No computation selected.</center>");
|
"<br><center>No computation selected.</center>");
|
||||||
sectionTitle.add(title);
|
sectionTitle.add(title);
|
||||||
v.add(sectionTitle, new VerticalLayoutData(-1, -1, new Margins(15)));
|
v.add(sectionTitle, new VerticalLayoutData(-1, -1, new Margins(20)));
|
||||||
computationData = null;
|
computationData = null;
|
||||||
forceLayout();
|
forceLayout();
|
||||||
}
|
}
|
||||||
|
@ -177,29 +188,40 @@ public class ComputationsViewerPanel extends FramedPanel {
|
||||||
addComputationData();
|
addComputationData();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
private void addComputationData() {
|
private void addComputationData() {
|
||||||
if(computationData==null){
|
|
||||||
Log.error("ComputationData is null!");
|
|
||||||
UtilsGXT3.alert("Error", "No information on computation is retrieved!");
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void createView(){
|
||||||
|
if (computationData == null) {
|
||||||
|
Log.error("ComputationData is null!");
|
||||||
|
UtilsGXT3.alert("Error",
|
||||||
|
"No information on computation is retrieved!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SimpleContainer sectionTitle = new SimpleContainer();
|
SimpleContainer sectionTitle = new SimpleContainer();
|
||||||
// title
|
// title
|
||||||
HtmlLayoutContainer title = new HtmlLayoutContainer(
|
HtmlLayoutContainer title = new HtmlLayoutContainer(
|
||||||
".: Computation Report of <b>" + computationData.getComputationId().getId() + "</b>");
|
"<center>.: Computation Report of <b>"
|
||||||
sectionTitle.add(title);
|
+ computationData.getComputationId().getId()
|
||||||
|
+ "</b></center>");
|
||||||
|
sectionTitle.add(title, new MarginData());
|
||||||
|
sectionTitle.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||||
|
// v.add(sectionTitle, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
v.add(sectionTitle, new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||||
|
|
||||||
//v.add(sectionTitle, new VerticalLayoutData(1, -1, new Margins(15)));
|
if (computationData.getOutputParameters() != null
|
||||||
|
&& !computationData.getOutputParameters().isEmpty()) {
|
||||||
|
|
||||||
if(computationData.getOutputParameters()!=null&&!computationData.getOutputParameters().isEmpty()){
|
|
||||||
VerticalLayoutContainer outputVBox = new VerticalLayoutContainer();
|
VerticalLayoutContainer outputVBox = new VerticalLayoutContainer();
|
||||||
LinkedHashMap<String,String> output=computationData.getOutputParameters();
|
LinkedHashMap<String, String> output = computationData
|
||||||
|
.getOutputParameters();
|
||||||
for (String key : output.keySet()) {
|
for (String key : output.keySet()) {
|
||||||
TextField textField = new TextField();
|
TextField textField = new TextField();
|
||||||
textField.setValue(output.get(key));
|
textField.setValue(output.get(key));
|
||||||
|
@ -207,20 +229,24 @@ public class ComputationsViewerPanel extends FramedPanel {
|
||||||
FieldLabel fieldLabel = new FieldLabel(textField, key);
|
FieldLabel fieldLabel = new FieldLabel(textField, key);
|
||||||
fieldLabel.setLabelWidth(200);
|
fieldLabel.setLabelWidth(200);
|
||||||
fieldLabel.setLabelWordWrap(true);
|
fieldLabel.setLabelWordWrap(true);
|
||||||
outputVBox.add(fieldLabel,new VerticalLayoutData(1, -1, new Margins(4)));
|
outputVBox.add(fieldLabel, new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
FieldSet outputFieldSet = new FieldSet();
|
FieldSet outputFieldSet = new FieldSet();
|
||||||
outputFieldSet.setHeadingText("Output Result");
|
outputFieldSet.setHeadingText("Output Result");
|
||||||
outputFieldSet.setCollapsible(true);
|
outputFieldSet.setCollapsible(true);
|
||||||
outputFieldSet.add(outputVBox);
|
outputFieldSet.add(outputVBox);
|
||||||
outputFieldSet.getElement().getStyle().setMarginRight(15, Unit.PX);
|
outputFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||||
v.add(outputFieldSet, new VerticalLayoutData(1, -1, new Margins(15)));
|
v.add(outputFieldSet, new VerticalLayoutData(-1, -1,
|
||||||
|
new Margins(10)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(computationData.getInputParameters()!=null&&!computationData.getInputParameters().isEmpty()){
|
if (computationData.getInputParameters() != null
|
||||||
|
&& !computationData.getInputParameters().isEmpty()) {
|
||||||
VerticalLayoutContainer inputVBox = new VerticalLayoutContainer();
|
VerticalLayoutContainer inputVBox = new VerticalLayoutContainer();
|
||||||
LinkedHashMap<String,String> input=computationData.getInputParameters();
|
LinkedHashMap<String, String> input = computationData
|
||||||
|
.getInputParameters();
|
||||||
for (String key : input.keySet()) {
|
for (String key : input.keySet()) {
|
||||||
TextField textField = new TextField();
|
TextField textField = new TextField();
|
||||||
textField.setValue(input.get(key));
|
textField.setValue(input.get(key));
|
||||||
|
@ -228,15 +254,17 @@ public class ComputationsViewerPanel extends FramedPanel {
|
||||||
FieldLabel fieldLabel = new FieldLabel(textField, key);
|
FieldLabel fieldLabel = new FieldLabel(textField, key);
|
||||||
fieldLabel.setLabelWidth(200);
|
fieldLabel.setLabelWidth(200);
|
||||||
fieldLabel.setLabelWordWrap(true);
|
fieldLabel.setLabelWordWrap(true);
|
||||||
inputVBox.add(fieldLabel,new VerticalLayoutData(1, -1, new Margins(4)));
|
inputVBox.add(fieldLabel, new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(4)));
|
||||||
}
|
}
|
||||||
|
|
||||||
FieldSet inputFieldSet = new FieldSet();
|
FieldSet inputFieldSet = new FieldSet();
|
||||||
inputFieldSet.setHeadingText("Input Parameters");
|
inputFieldSet.setHeadingText("Input Parameters");
|
||||||
inputFieldSet.setCollapsible(true);
|
inputFieldSet.setCollapsible(true);
|
||||||
inputFieldSet.add(inputVBox);
|
inputFieldSet.add(inputVBox);
|
||||||
inputFieldSet.getElement().getStyle().setMarginRight(15, Unit.PX);
|
inputFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||||
v.add(inputFieldSet, new VerticalLayoutData(1, -1, new Margins(15)));
|
v.add(inputFieldSet,
|
||||||
|
new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||||
}
|
}
|
||||||
|
|
||||||
VerticalLayoutContainer detailsVBox = new VerticalLayoutContainer();
|
VerticalLayoutContainer detailsVBox = new VerticalLayoutContainer();
|
||||||
|
@ -246,7 +274,8 @@ public class ComputationsViewerPanel extends FramedPanel {
|
||||||
FieldLabel startDateLabel = new FieldLabel(startDateField, "Start Date");
|
FieldLabel startDateLabel = new FieldLabel(startDateField, "Start Date");
|
||||||
startDateLabel.setLabelWidth(200);
|
startDateLabel.setLabelWidth(200);
|
||||||
startDateLabel.setLabelWordWrap(true);
|
startDateLabel.setLabelWordWrap(true);
|
||||||
detailsVBox.add(startDateLabel,new VerticalLayoutData(1, -1, new Margins(4)));
|
detailsVBox.add(startDateLabel, new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(4)));
|
||||||
|
|
||||||
TextField endDateField = new TextField();
|
TextField endDateField = new TextField();
|
||||||
endDateField.setValue(computationData.getEndDate());
|
endDateField.setValue(computationData.getEndDate());
|
||||||
|
@ -254,7 +283,8 @@ public class ComputationsViewerPanel extends FramedPanel {
|
||||||
FieldLabel endDateLabel = new FieldLabel(endDateField, "End Date");
|
FieldLabel endDateLabel = new FieldLabel(endDateField, "End Date");
|
||||||
endDateLabel.setLabelWidth(200);
|
endDateLabel.setLabelWidth(200);
|
||||||
endDateLabel.setLabelWordWrap(true);
|
endDateLabel.setLabelWordWrap(true);
|
||||||
detailsVBox.add(endDateLabel,new VerticalLayoutData(1, -1, new Margins(4)));
|
detailsVBox.add(endDateLabel, new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(4)));
|
||||||
|
|
||||||
TextField statusField = new TextField();
|
TextField statusField = new TextField();
|
||||||
statusField.setValue(computationData.getStatus());
|
statusField.setValue(computationData.getStatus());
|
||||||
|
@ -262,7 +292,8 @@ public class ComputationsViewerPanel extends FramedPanel {
|
||||||
FieldLabel statusLabel = new FieldLabel(statusField, "Status");
|
FieldLabel statusLabel = new FieldLabel(statusField, "Status");
|
||||||
statusLabel.setLabelWidth(200);
|
statusLabel.setLabelWidth(200);
|
||||||
statusLabel.setLabelWordWrap(true);
|
statusLabel.setLabelWordWrap(true);
|
||||||
detailsVBox.add(statusLabel,new VerticalLayoutData(1, -1, new Margins(4)));
|
detailsVBox.add(statusLabel, new VerticalLayoutData(1, -1, new Margins(
|
||||||
|
4)));
|
||||||
|
|
||||||
TextField vreField = new TextField();
|
TextField vreField = new TextField();
|
||||||
vreField.setValue(computationData.getVre());
|
vreField.setValue(computationData.getVre());
|
||||||
|
@ -270,40 +301,174 @@ public class ComputationsViewerPanel extends FramedPanel {
|
||||||
FieldLabel vreLabel = new FieldLabel(vreField, "VRE");
|
FieldLabel vreLabel = new FieldLabel(vreField, "VRE");
|
||||||
vreLabel.setLabelWidth(200);
|
vreLabel.setLabelWidth(200);
|
||||||
vreLabel.setLabelWordWrap(true);
|
vreLabel.setLabelWordWrap(true);
|
||||||
detailsVBox.add(vreLabel,new VerticalLayoutData(1, -1, new Margins(4)));
|
detailsVBox
|
||||||
|
.add(vreLabel, new VerticalLayoutData(1, -1, new Margins(4)));
|
||||||
|
|
||||||
FieldSet detailsFieldSet = new FieldSet();
|
FieldSet detailsFieldSet = new FieldSet();
|
||||||
detailsFieldSet.setHeadingText("Computation Details");
|
detailsFieldSet.setHeadingText("Computation Details");
|
||||||
detailsFieldSet.setCollapsible(true);
|
detailsFieldSet.setCollapsible(true);
|
||||||
detailsFieldSet.add(detailsVBox);
|
detailsFieldSet.add(detailsVBox);
|
||||||
detailsFieldSet.getElement().getStyle().setMarginRight(15, Unit.PX);
|
detailsFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||||
v.add(detailsFieldSet, new VerticalLayoutData(1, -1, new Margins(15)));
|
v.add(detailsFieldSet, new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||||
|
|
||||||
VerticalLayoutContainer operatorVBox = new VerticalLayoutContainer();
|
VerticalLayoutContainer operatorVBox = new VerticalLayoutContainer();
|
||||||
TextField operatorNameField = new TextField();
|
TextField operatorNameField = new TextField();
|
||||||
operatorNameField.setValue(computationData.getComputationId().getOperatorName());
|
operatorNameField.setValue(computationData.getComputationId()
|
||||||
|
.getOperatorName());
|
||||||
operatorNameField.setReadOnly(true);
|
operatorNameField.setReadOnly(true);
|
||||||
FieldLabel operatorNameLabel=new FieldLabel(operatorNameField, "Operator Name");
|
FieldLabel operatorNameLabel = new FieldLabel(operatorNameField,
|
||||||
|
"Operator Name");
|
||||||
operatorNameLabel.setLabelWidth(200);
|
operatorNameLabel.setLabelWidth(200);
|
||||||
operatorNameLabel.setLabelWordWrap(true);
|
operatorNameLabel.setLabelWordWrap(true);
|
||||||
operatorVBox.add(operatorNameLabel,new VerticalLayoutData(1, -1, new Margins(4)));
|
operatorVBox.add(operatorNameLabel, new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(4)));
|
||||||
|
|
||||||
TextArea operatorDescriptionField = new TextArea();
|
TextArea operatorDescriptionField = new TextArea();
|
||||||
operatorDescriptionField.setHeight("50px");
|
operatorDescriptionField.setHeight(40);
|
||||||
operatorDescriptionField.setValue(computationData.getOperatorDescription());
|
operatorDescriptionField.setValue(computationData
|
||||||
|
.getOperatorDescription());
|
||||||
operatorDescriptionField.setReadOnly(true);
|
operatorDescriptionField.setReadOnly(true);
|
||||||
FieldLabel operatorDescriptionLabel=new FieldLabel(operatorDescriptionField, "Operator Description");
|
FieldLabel operatorDescriptionLabel = new FieldLabel(
|
||||||
|
operatorDescriptionField, "Operator Description");
|
||||||
operatorDescriptionLabel.setLabelWidth(200);
|
operatorDescriptionLabel.setLabelWidth(200);
|
||||||
operatorDescriptionLabel.setLabelWordWrap(true);
|
operatorDescriptionLabel.setLabelWordWrap(true);
|
||||||
operatorVBox.add(operatorDescriptionLabel,new VerticalLayoutData(1, -1, new Margins(5)));
|
operatorDescriptionLabel.setHeight(50);
|
||||||
|
operatorVBox.add(operatorDescriptionLabel, new VerticalLayoutData(1,
|
||||||
|
-1, new Margins(5)));
|
||||||
|
|
||||||
FieldSet operatorFieldSet = new FieldSet();
|
FieldSet operatorFieldSet = new FieldSet();
|
||||||
operatorFieldSet.setHeadingText("Operator Details");
|
operatorFieldSet.setHeadingText("Operator Details");
|
||||||
operatorFieldSet.setCollapsible(true);
|
operatorFieldSet.setCollapsible(true);
|
||||||
|
operatorFieldSet.setHeight(130);
|
||||||
operatorFieldSet.add(operatorVBox);
|
operatorFieldSet.add(operatorVBox);
|
||||||
operatorFieldSet.getElement().getStyle().setMarginRight(15, Unit.PX);
|
operatorFieldSet.getElement().getStyle().setMarginBottom(120, Unit.PX);
|
||||||
v.add(operatorFieldSet, new VerticalLayoutData(1, -1, new Margins(15)));
|
operatorFieldSet.getElement().getStyle().setMarginRight(20, Unit.PX);
|
||||||
|
v.add(operatorFieldSet, new VerticalLayoutData(-1, -1, new Margins(10)));
|
||||||
|
|
||||||
forceLayout();
|
forceLayout();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private void createUrlList() {
|
||||||
|
urlList = new ArrayList<String>();
|
||||||
|
urlFileNameMap = new LinkedHashMap<String, String>();
|
||||||
|
|
||||||
|
if (computationData.getOutputParameters() != null
|
||||||
|
&& !computationData.getOutputParameters().isEmpty()) {
|
||||||
|
LinkedHashMap<String, String> output = computationData
|
||||||
|
.getOutputParameters();
|
||||||
|
for (String key : output.keySet()) {
|
||||||
|
String value = output.get(key);
|
||||||
|
if (value != null && !value.isEmpty() && value.startsWith("http")) {
|
||||||
|
urlList.add(value);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (computationData.getInputParameters() != null
|
||||||
|
&& !computationData.getInputParameters().isEmpty()) {
|
||||||
|
LinkedHashMap<String, String> input = computationData
|
||||||
|
.getInputParameters();
|
||||||
|
for (String key : input.keySet()) {
|
||||||
|
String value = input.get(key);
|
||||||
|
if (value != null && !value.isEmpty()&& value.startsWith("http")) {
|
||||||
|
urlList.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!urlList.isEmpty()) {
|
||||||
|
retrieveUrlInformation(null);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void retrieveUrlInformation(String url) {
|
||||||
|
if (url == null) {
|
||||||
|
if (urlList != null && !urlList.isEmpty()) {
|
||||||
|
retrieveFileName(urlList.get(0));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
int index=urlList.indexOf(url);
|
||||||
|
if(index==-1){
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(index==urlList.size()-1){
|
||||||
|
|
||||||
|
} else {
|
||||||
|
retrieveFileName(urlList.get(index++));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void retrieveFileName(final String url) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
RequestBuilder builder = new RequestBuilder(RequestBuilder.HEAD,
|
||||||
|
URL.encode(url));
|
||||||
|
|
||||||
|
builder.sendRequest(null, new RequestCallback() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResponseReceived(Request request,
|
||||||
|
Response response) {
|
||||||
|
if (200 == response.getStatusCode()) {
|
||||||
|
String contentDisposition = response
|
||||||
|
.getHeader("Content-Disposition");
|
||||||
|
// ContentDisposition = "attachment; filename=abc.jpg"
|
||||||
|
if (contentDisposition != null
|
||||||
|
&& contentDisposition.indexOf("=") != -1) {
|
||||||
|
String fileName = contentDisposition.split("=")[1]; // getting
|
||||||
|
// value
|
||||||
|
// after
|
||||||
|
// '='
|
||||||
|
urlFileNameMap.put(url, fileName);
|
||||||
|
retrieveUrlInformation(url);
|
||||||
|
} else {
|
||||||
|
urlFileNameMap.put(url, null);
|
||||||
|
retrieveUrlInformation(url);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
urlFileNameMap.put(url, null);
|
||||||
|
retrieveUrlInformation(url);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onError(Request request, Throwable exception) {
|
||||||
|
Log.error(exception.getLocalizedMessage());
|
||||||
|
exception.printStackTrace();
|
||||||
|
urlFileNameMap.put(url, null);
|
||||||
|
retrieveUrlInformation(url);
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (RequestException e) {
|
||||||
|
Log.error(e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
UtilsGXT3.alert("Error", "Error retrieving file name from public url!");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* URL url = new URL("http://somesite/getFile?id=12345");
|
||||||
|
* HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||||
|
* conn.setRequestMethod("GET"); conn.setAllowUserInteraction(false);
|
||||||
|
* conn.setDoInput(true); conn.setDoOutput(true); conn.connect();
|
||||||
|
*
|
||||||
|
* String raw = conn.getHeaderField("Content-Disposition"); // raw =
|
||||||
|
* "attachment; filename=abc.jpg" if (raw != null && raw.indexOf("=") !=
|
||||||
|
* -1) { String fileName = raw.split("=")[1]; // getting value after '='
|
||||||
|
* } else { // fall back to random generated file name? }
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1240,8 +1240,8 @@ public class SClient4WPS extends SClient {
|
||||||
String operatorDescritpion = computationProperties
|
String operatorDescritpion = computationProperties
|
||||||
.get("operator_description");
|
.get("operator_description");
|
||||||
String vre = computationProperties.get("VRE");
|
String vre = computationProperties.get("VRE");
|
||||||
String startDate = computationProperties.get("startDate");
|
String startDate = computationProperties.get("start_date");
|
||||||
String endDate = computationProperties.get("endDate");
|
String endDate = computationProperties.get("end_date");
|
||||||
String status = computationProperties.get("status");
|
String status = computationProperties.get("status");
|
||||||
String executionType = computationProperties.get("execution_type");
|
String executionType = computationProperties.get("execution_type");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue