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

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

Updated TableListParameter Support

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@128416 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-05-02 17:58:14 +00:00
parent 8b73acb942
commit c964cc69ad
27 changed files with 1240 additions and 255 deletions

771
log.txt Normal file

File diff suppressed because one or more lines are too long

View File

@ -245,7 +245,6 @@ public class DataMinerManagerController {
final StartComputationExecutionRequestEvent event) {
DataMinerPortletServiceAsync.INSTANCE.startComputation(event.getOp(),
event.getComputationTitle(), event.getComputationDescription(),
new AsyncCallback<ComputationId>() {
@Override
public void onSuccess(ComputationId computationId) {

View File

@ -20,8 +20,6 @@ public class ComputationReadyEvent extends
public static Type<ComputationReadyEventHandler> TYPE = new Type<ComputationReadyEventHandler>();
private Operator operator;
private String computationTitle;
private String computationDescription;
public interface ComputationReadyEventHandler extends EventHandler {
void onReady(ComputationReadyEvent event);
@ -32,12 +30,9 @@ public class ComputationReadyEvent extends
ComputationReadyEventHandler handler);
}
public ComputationReadyEvent(Operator operator, String computationTitle,
String computationDescription) {
public ComputationReadyEvent(Operator operator) {
super();
this.operator = operator;
this.computationTitle = computationTitle;
this.computationDescription = computationDescription;
}
@Override
@ -66,19 +61,10 @@ public class ComputationReadyEvent extends
return operator;
}
public String getComputationTitle() {
return computationTitle;
}
public String getComputationDescription() {
return computationDescription;
}
@Override
public String toString() {
return "ComputationReadyEvent [operator=" + operator
+ ", computationTitle=" + computationTitle
+ ", computationDescription=" + computationDescription + "]";
return "ComputationReadyEvent [operator=" + operator + "]";
}
}

View File

@ -21,24 +21,22 @@ public class StartComputationExecutionRequestEvent
public static Type<StartComputationExecutionRequestEventHandler> TYPE = new Type<StartComputationExecutionRequestEventHandler>();
private Operator op;
private String computationTitle;
private String computationDescription;
private int computationStatusPanelIndex;
public interface StartComputationExecutionRequestEventHandler extends EventHandler {
public interface StartComputationExecutionRequestEventHandler extends
EventHandler {
void onStart(StartComputationExecutionRequestEvent event);
}
public interface HasStartComputationExecutionRequestEventHandler extends HasHandlers {
public interface HasStartComputationExecutionRequestEventHandler extends
HasHandlers {
public HandlerRegistration addStartComputationExecutionRequestEventHandler(
StartComputationExecutionRequestEventHandler handler);
}
public StartComputationExecutionRequestEvent(Operator op, String computationTitle,
String computationDescription, int computationStatusPanelIndex) {
public StartComputationExecutionRequestEvent(Operator op,
int computationStatusPanelIndex) {
this.op = op;
this.computationTitle = computationTitle;
this.computationDescription = computationDescription;
this.computationStatusPanelIndex = computationStatusPanelIndex;
}
@ -66,14 +64,6 @@ public class StartComputationExecutionRequestEvent
return op;
}
public String getComputationTitle() {
return computationTitle;
}
public String getComputationDescription() {
return computationDescription;
}
public int getComputationStatusPanelIndex() {
return computationStatusPanelIndex;
}
@ -81,12 +71,8 @@ public class StartComputationExecutionRequestEvent
@Override
public String toString() {
return "StartComputationExecutionRequestEvent [op=" + op
+ ", computationTitle=" + computationTitle
+ ", computationDescription=" + computationDescription
+ ", computationStatusPanelIndex="
+ computationStatusPanelIndex + "]";
}
}

View File

@ -72,29 +72,33 @@ public class ComputationExecutionPanel extends FramedPanel {
}
private void bind() {
EventBusProvider.INSTANCE.addHandler(
ResubmitComputationExecutionEvent.getType(),
new ResubmitComputationExecutionEvent.ResubmitComputationExecutionEventHandler() {
@Override
public void onResubmit(ResubmitComputationExecutionEvent event) {
resubmitComputation(event);
}
});
EventBusProvider.INSTANCE
.addHandler(
ResubmitComputationExecutionEvent.getType(),
new ResubmitComputationExecutionEvent.ResubmitComputationExecutionEventHandler() {
@Override
public void onResubmit(
ResubmitComputationExecutionEvent event) {
resubmitComputation(event);
}
});
EventBusProvider.INSTANCE.addHandler(StartComputationExecutionEvent.getType(),
new StartComputationExecutionEvent.StartComputationExecutionEventHandler() {
EventBusProvider.INSTANCE
.addHandler(
StartComputationExecutionEvent.getType(),
new StartComputationExecutionEvent.StartComputationExecutionEventHandler() {
@Override
public void onStart(StartComputationExecutionEvent event) {
startComputation(event);
@Override
public void onStart(
StartComputationExecutionEvent event) {
startComputation(event);
}
}
});
});
}
public void startNewComputation(final Operator operator,
String computationTitle, String computationDescription) {
public void startNewComputation(final Operator operator) {
Log.debug("Computation Panel: start new computation ");
ComputationStatusPanel statusPanel = new ComputationStatusPanel(
operator);
@ -108,7 +112,7 @@ public class ComputationExecutionPanel extends FramedPanel {
forceLayout();
StartComputationExecutionRequestEvent event = new StartComputationExecutionRequestEvent(
operator, computationTitle, computationDescription, index);
operator, index);
EventBusProvider.INSTANCE.fireEvent(event);
}

View File

@ -124,13 +124,12 @@ public class ComputationPanel extends FramedPanel implements HasComputationReady
computationParametersPanel = new ComputationParametersPanel(operator);
computationParametersPanel.setHandler(new ComputationParametersPanelHandler() {
@Override
public void startComputation(String computationTitle,
String computationDescription) {
public void startComputation() {
if (computationParametersPanel != null) {
forceLayout();
computationParametersPanel.updateOperatorParametersValues();
Operator op = computationParametersPanel.getOperator();
ComputationReadyEvent event = new ComputationReadyEvent(op, computationTitle, computationDescription);
ComputationReadyEvent event = new ComputationReadyEvent(op);
fireEvent(event);
}

View File

@ -3,7 +3,6 @@
*/
package org.gcube.portlets.user.dataminermanager.client.experiments;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -24,8 +23,6 @@ import org.gcube.portlets.user.dataminermanager.client.util.UtilsGXT3;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Image;
@ -40,7 +37,6 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent;
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.form.FieldSet;
import com.sencha.gxt.widget.core.client.form.FormPanel;
import com.sencha.gxt.widget.core.client.form.TextField;
/**
*
@ -51,8 +47,7 @@ import com.sencha.gxt.widget.core.client.form.TextField;
public class ComputationParametersPanel extends SimpleContainer {
public interface ComputationParametersPanelHandler {
public void startComputation(String computationTitle,
String computationDescription);
public void startComputation();
}
private static final String START_BUTTON_TOOLTIP = "Start Computation";
@ -67,8 +62,6 @@ public class ComputationParametersPanel extends SimpleContainer {
private VerticalLayoutContainer vParameters;
private Map<String, OperatorFieldWidget> fieldWidgetsMap;
private ComputationParametersPanelHandler handler = null;
private TextField titleField;
private String defaultComputationTitle;
private TextButton submit;
@ -77,7 +70,6 @@ public class ComputationParametersPanel extends SimpleContainer {
this.operator = operator;
fieldWidgetsMap = new HashMap<>();
try {
setDefaultComputationTitle();
init();
create();
} catch (Throwable e) {
@ -164,10 +156,7 @@ public class ComputationParametersPanel extends SimpleContainer {
@Override
public void onSelect(SelectEvent event) {
if (handler != null && parametersPanel.isValid()) {
String value = titleField.getValue();
String title = (value == null || value.contentEquals("")) ? defaultComputationTitle
: value;
handler.startComputation(title, title); // TODO insert
handler.startComputation(); // TODO insert
// description
}
@ -303,11 +292,6 @@ public class ComputationParametersPanel extends SimpleContainer {
this.handler = handler;
}
public void setDefaultComputationTitle() {
String name = this.operator.getName();
String date = DateTimeFormat
.getFormat(PredefinedFormat.DATE_TIME_SHORT).format(new Date());
defaultComputationTitle = name + "-" + date;
}
}

View File

@ -23,7 +23,6 @@ public class WorkflowPanel extends TabPanel {
public static final String DEFAULT_OPERATOR = "AQUAMAPS_SUITABLE";
private ComputationExecutionPanel computationExecutionPanel;
private ComputationPanel computationPanel;
@ -44,8 +43,8 @@ public class WorkflowPanel extends TabPanel {
private void create() {
TabItemConfig tabWorkFlowLcItemConf = new TabItemConfig(
".: Operator", false);
TabItemConfig tabWorkFlowLcItemConf = new TabItemConfig(".: Operator",
false);
tabWorkFlowLcItemConf.setIcon(DataMinerManager.resources
.folderExplore());
computationPanel = new ComputationPanel();
@ -54,9 +53,8 @@ public class WorkflowPanel extends TabPanel {
@Override
public void onReady(ComputationReadyEvent event) {
Log.debug("StartComputationEvent Received:"+event);
startComputation(event.getOperator(), event.getComputationTitle(),
event.getComputationDescription());
Log.debug("StartComputationEvent Received:" + event);
startComputation(event.getOperator());
}
});
@ -76,21 +74,22 @@ public class WorkflowPanel extends TabPanel {
*
*/
private void bind() {
EventBusProvider.INSTANCE.addHandler(
ResubmitComputationExecutionEvent.getType(),
new ResubmitComputationExecutionEvent.ResubmitComputationExecutionEventHandler() {
@Override
public void onResubmit(
ResubmitComputationExecutionEvent event) {
resubmitComputation();
}
});
EventBusProvider.INSTANCE
.addHandler(
ResubmitComputationExecutionEvent.getType(),
new ResubmitComputationExecutionEvent.ResubmitComputationExecutionEventHandler() {
@Override
public void onResubmit(
ResubmitComputationExecutionEvent event) {
resubmitComputation();
}
});
}
/**
*
*/
private void resubmitComputation(){
private void resubmitComputation() {
setActiveWidget(computationExecutionPanel);
}
@ -99,13 +98,10 @@ public class WorkflowPanel extends TabPanel {
* @param operator
*
*/
private void startComputation(Operator op, String computationTitle,
String computationDescription) {
private void startComputation(Operator op) {
setActiveWidget(computationExecutionPanel);
computationExecutionPanel.startNewComputation(op, computationTitle,
computationDescription);
computationExecutionPanel.startNewComputation(op);
}
public void addOperator(Operator op) {
@ -113,8 +109,5 @@ public class WorkflowPanel extends TabPanel {
computationPanel.addOperator(op);
}
}

View File

@ -52,7 +52,7 @@ public class BooleanFld extends AbstractFld {
descr.addStyleName("workflow-fieldDescription");
} else {
checkBox.setToolTip(p.getDescription());
//checkBox.setToolTip(p.getDescription());
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
+ p.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");

View File

@ -81,7 +81,7 @@ public class ColumnFld extends AbstractFld implements
descr.addStyleName("workflow-fieldDescription");
} else {
comboBox.setToolTip(columnParameter.getDescription());
//comboBox.setToolTip(columnParameter.getDescription());
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
+ columnParameter.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");

View File

@ -74,7 +74,7 @@ public class ColumnListFld extends AbstractFld implements
descr.addStyleName("workflow-fieldDescription");
} else {
grid.setToolTip(columnListParameter.getDescription());
//grid.setToolTip(columnListParameter.getDescription());
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
+ columnListParameter.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");

View File

@ -50,7 +50,7 @@ public class DoubleFld extends AbstractFld {
descr.addStyleName("workflow-fieldDescription");
} else {
numberField.setToolTip(p.getDescription());
//numberField.setToolTip(p.getDescription());
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
+ p.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");

View File

@ -57,7 +57,7 @@ public class EnumFld extends AbstractFld {
descr.addStyleName("workflow-fieldDescription");
} else {
listBox.setToolTip(p.getDescription());
//listBox.setToolTip(p.getDescription());
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
+ p.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");

View File

@ -50,7 +50,7 @@ public class FloatFld extends AbstractFld {
descr.addStyleName("workflow-fieldDescription");
} else {
numberField.setToolTip(p.getDescription());
//numberField.setToolTip(p.getDescription());
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
+ p.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");

View File

@ -50,7 +50,7 @@ public class IntFld extends AbstractFld {
descr.addStyleName("workflow-fieldDescription");
} else {
numberField.setToolTip(p.getDescription());
//numberField.setToolTip(p.getDescription());
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
+ p.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");

View File

@ -66,7 +66,7 @@ public class ListIntFld extends AbstractFld {
descr.addStyleName("workflow-fieldDescription");
} else {
listContainer.setToolTip(listParameter.getDescription());
//listContainer.setToolTip(listParameter.getDescription());
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
+ listParameter.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");

View File

@ -32,7 +32,7 @@ public class OperatorFieldWidget {
try {
if (p.isObject())
field = createObjectField((ObjectParameter) p);
field = createObjectField(p);
else if (p.isEnum())
field = new EnumFld(p);
else if (p.isTabular())
@ -44,7 +44,7 @@ public class OperatorFieldWidget {
else if (p.isColumnList())
field = new ColumnListFld(p);
else if (p.isList())
field = createListField((ListParameter) p);
field = createListField(p);
else if (p.isFile())
field = new FileFld(p);
@ -88,18 +88,19 @@ public class OperatorFieldWidget {
* @param p
* @return
*/
private AbstractFld createObjectField(ObjectParameter p) {
String type = p.getType();
private AbstractFld createObjectField(Parameter p) {
ObjectParameter objectParameter=(ObjectParameter) p;
String type = objectParameter.getType();
if (type.contentEquals(Integer.class.getName())) {
return new IntFld(p);
return new IntFld(objectParameter);
} else if (type.contentEquals(String.class.getName())) {
return new StringFld(p);
return new StringFld(objectParameter);
} else if (type.contentEquals(Boolean.class.getName())) {
return new BooleanFld(p);
return new BooleanFld(objectParameter);
} else if (type.contentEquals(Double.class.getName())) {
return new DoubleFld(p);
return new DoubleFld(objectParameter);
} else if (type.contentEquals(Float.class.getName())) {
return new FloatFld(p);
return new FloatFld(objectParameter);
} else
return null;
}
@ -107,15 +108,16 @@ public class OperatorFieldWidget {
/**
*
*/
private AbstractFld createListField(ListParameter p) {
String type = p.getType();
private AbstractFld createListField(Parameter p) {
ListParameter listParameter=(ListParameter) p;
String type = listParameter.getType();
if (type.contentEquals(String.class.getName())
|| type.contentEquals("STRING")) { // TODO REMOVE "STRING"
return new ListStringFld(p);
return new ListStringFld(listParameter);
} else if (type.contentEquals(Integer.class.getName())
|| type.contentEquals("NUMBER")) {
return new ListIntFld(p);
return new ListIntFld(listParameter);
}
// } else if (type.contentEquals(Boolean.class.getName())) {
// return new ListBooleanField(p);

View File

@ -49,7 +49,7 @@ public class StringFld extends AbstractFld {
descr.addStyleName("workflow-fieldDescription");
} else {
textField.setToolTip(p.getDescription());
//textField.setToolTip(p.getDescription());
descr=new HtmlLayoutContainer("<p style='margin-left:5px;'>"+p.getDescription()+"</p>");
descr.addStyleName("workflow-fieldDescription");
}

View File

@ -4,31 +4,55 @@
package org.gcube.portlets.user.dataminermanager.client.parametersfield;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.commons.digester.SetRootRule;
import org.gcube.portlets.user.dataminermanager.client.DataMinerManager;
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.Parameter;
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.TabularListParameter;
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.TabularParameter;
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.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.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.core.client.dom.XDOM;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.button.TextButton;
import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
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.VerticalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
import com.sencha.gxt.widget.core.client.event.SelectEvent;
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 TabularListFld extends AbstractFld {
private List<Item> items = new ArrayList<Item>();
private SimpleContainer fieldContainer;
private HBoxLayoutContainer horiz;
private SimpleContainer listContainer;
private List<TabItem> items;
private VerticalLayoutContainer vp;
private TabularListParameter tabularListParameter;
private WorkspaceExplorerSelectDialog wselectDialog;
/**
* @param parameter
@ -36,48 +60,96 @@ public class TabularListFld extends AbstractFld {
public TabularListFld(Parameter parameter) {
super(parameter);
Log.debug("TabularListField");
this.tabularListParameter = (TabularListParameter) parameter;
tabularListParameter = (TabularListParameter) parameter;
vp = new VerticalLayoutContainer();
addField(null);
}
items = new ArrayList<>();
private void addField(Item upperItem) {
listContainer = new SimpleContainer();
listContainer.add(vp, new MarginData(new Margins(0)));
TabularParameter tabPar = new TabularParameter(
tabularListParameter.getName(),
tabularListParameter.getDescription(),null,
tabularListParameter.getTemplates());
/*
* List<String> templates = tabularListParameter.getTemplates(); String
* list = ""; boolean firstTemplate = true; for (String template :
* templates) { list += (firstTemplate ? "" : ", ") +
* Format.ellipse(template,50); firstTemplate = false; }
* HtmlLayoutContainer templatesList = new
* HtmlLayoutContainer("<p>Suitable Data Set Templates: <br>" +
* list+"</p>");
* templatesList.addStyleName("workflow-parameters-description");
*/
if (upperItem == null) {
Item item = new Item(tabPar, true);
items.add(item);
vp.add(item);
fieldContainer = new SimpleContainer();
// fieldContainer.setResize(true);
horiz = new HBoxLayoutContainer();
horiz.setPack(BoxLayoutPack.START);
horiz.setEnableOverflow(false);
HtmlLayoutContainer descr;
if (tabularListParameter.getDescription() == null) {
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'></p>");
descr.addStyleName("workflow-fieldDescription");
} else {
// search the position of the upper item
int pos = 0;
for (int i = 0; i < items.size(); i++)
if (items.get(i) == upperItem) {
pos = i;
break;
}
upperItem.showCancelButton();
Item item = new Item(tabPar, false);
items.add(pos + 1, item);
vp.insert(item, pos + 1);
/* listContainer.setToolTip(listParameter.getDescription()); */
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
+ tabularListParameter.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");
}
vp.forceLayout();
horiz.add(listContainer, new BoxLayoutData(new Margins(0)));
horiz.add(descr, new BoxLayoutData(new Margins(0)));
fieldContainer.add(horiz, new MarginData(new Margins(0)));
addField(null);
fieldContainer.forceLayout();
}
private void addField(TabItem upperItem) {
try {
TabularParameter tabPar = new TabularParameter(
tabularListParameter.getName(),
tabularListParameter.getDescription(), null,
tabularListParameter.getTemplates());
if (upperItem == null) {
TabItem item = new TabItem(tabPar, true);
items.add(item);
vp.add(item, new VerticalLayoutData(1, -1, new Margins(0)));
} else {
// search the position of the upper item
int pos = items.indexOf(upperItem);
if (pos > -1) {
upperItem.showCancelButton();
TabItem item = new TabItem(tabPar, false);
items.add(pos + 1, item);
vp.insert(item, pos + 1, new VerticalLayoutData(1, -1,
new Margins(0)));
} else {
TabItem item = new TabItem(tabPar, true);
items.add(item);
vp.add(item, new VerticalLayoutData(1, -1, new Margins(0)));
}
}
} catch (Throwable e) {
Log.error(e.getLocalizedMessage());
e.printStackTrace();
}
}
/**
* @param item
*/
protected void removeField(Item item) {
private void removeField(TabItem item) {
items.remove(item);
vp.remove(item);
vp.forceLayout();
if (items.size() == 1) {
items.get(0).hideCancelButton();
@ -93,7 +165,7 @@ public class TabularListFld extends AbstractFld {
String separator = tabularListParameter.getSeparator();
String value = "";
boolean first = true;
for (Item item : items) {
for (TabItem item : items) {
String itemValue = item.getValue();
if (itemValue != null && !itemValue.contentEquals("")) {
value += (first ? "" : separator) + itemValue;
@ -108,84 +180,251 @@ public class TabularListFld extends AbstractFld {
*/
@Override
public Widget getWidget() {
return vp;
return fieldContainer;
}
/**
*
*/
@Override
public boolean isValid() {
boolean valid = false;
for (Item item : items)
if (item.getField().getValue() != null) {
for (TabItem item : items)
if (item.isValid()) {
valid = true;
break;
}
return valid;
}
private class Item extends HorizontalLayoutContainer {
private class TabItem extends HBoxLayoutContainer {
private TextButton selectButton, selectButton2;
private TableItemSimple selectedTableItem = null;
private TextButton addBtn;
private TextButton removeBtn;
private TextField tableDescription;
/**
* @param objPar
*/
public TabItem(TabularParameter tabularParameter, boolean first) {
super();
create(tabularParameter, first);
initDialog();
}
private void create(TabularParameter tabularParameter, boolean first) {
tableDescription = new TextField();
tableDescription.setReadOnly(true);
//tableDescription.setVisible(false);
selectButton = new TextButton("Select Data Set");
selectButton.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
wselectDialog.show();
}
});
selectButton.setIcon(DataMinerManager.resources.folderExplore());
selectButton.setToolTip("Select Data Set");
selectButton2 = new TextButton("");
selectButton2.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
wselectDialog.show();
}
});
selectButton2.setIcon(DataMinerManager.resources.folderExplore());
selectButton2.setToolTip("Select Another Data Set");
selectButton2.setVisible(false);
addBtn = new TextButton("");
addBtn.setIcon(DataMinerManager.resources.add());
addBtn.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
addField(TabItem.this);
fieldContainer.forceLayout();
}
});
removeBtn = new TextButton("");
removeBtn.setIcon(DataMinerManager.resources.cancel());
removeBtn.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
selectedTableItem = null;
removeField(TabItem.this);
fieldContainer.forceLayout();
}
});
removeBtn.setVisible(!first);
setPack(BoxLayoutPack.START);
setEnableOverflow(false);
add(tableDescription, new BoxLayoutData(new Margins(0)));
add(selectButton, new BoxLayoutData(new Margins(0)));
add(selectButton2, new BoxLayoutData(new Margins(0)));
add(addBtn, new BoxLayoutData(new Margins(0)));
add(removeBtn, new BoxLayoutData(new Margins(0)));
}
private void initDialog() {
List<ItemType> selectableTypes = new ArrayList<ItemType>();
selectableTypes.add(ItemType.EXTERNAL_FILE);
List<ItemType> showableTypes = new ArrayList<ItemType>();
showableTypes.addAll(Arrays.asList(ItemType.values()));
/*
* "application/zip", "application/x-zip",
* "application/x-zip-compressed", "application/octet-stream",
* "application/x-compress", "application/x-compressed",
* "multipart/x-zip"
*/
// List<String> allowedMimeTypes =
// Arrays.asList("text/csv","text/plain","text/plain; charset=ISO-8859-1");
/**
* "zip"
*/
/*
* List<String> allowedFileExtensions = Arrays.asList("csv");
*
* FilterCriteria filterCriteria = new
* FilterCriteria(allowedMimeTypes, allowedFileExtensions, new
* HashMap<String, String>());
*/
wselectDialog = new WorkspaceExplorerSelectDialog("Select CSV",
false);
// filterCriteria, selectableTypes);
WorskpaceExplorerSelectNotificationListener handler = new WorskpaceExplorerSelectNotificationListener() {
@Override
public void onSelectedItem(Item item) {
if (item.isFolder() || item.isRoot()) {
UtilsGXT3.info("Attention", "Select a valid csv!");
} else {
TabItem.this.retrieveTableInformation(item);
}
}
@Override
public void onFailed(Throwable throwable) {
Log.error("Error in create project: "
+ throwable.getLocalizedMessage());
UtilsGXT3.alert("Error", throwable.getLocalizedMessage());
throwable.printStackTrace();
}
@Override
public void onAborted() {
}
@Override
public void onNotValidSelection() {
UtilsGXT3.info("Attention", "Select a valid csv!");
}
};
wselectDialog
.addWorkspaceExplorerSelectNotificationListener(handler);
wselectDialog.setZIndex(XDOM.getTopZIndex());
}
private void retrieveTableInformation(Item item) {
DataMinerPortletServiceAsync.INSTANCE.retrieveTableInformation(
item, new AsyncCallback<TableItemSimple>() {
@Override
public void onFailure(Throwable caught) {
Log.error("Error in retrieveTableInformation "
+ caught.getMessage());
if (caught instanceof ExpiredSessionServiceException) {
UtilsGXT3.alert("Error", "Expired Session");
} else {
UtilsGXT3.alert("Error",
"Error retrieving table information: "
+ caught.getLocalizedMessage());
}
}
@Override
public void onSuccess(TableItemSimple result) {
Log.debug("Retrieved: " + result);
selectedTableItem = result;
showFieldWithSelection();
}
});
}
private TabularFld field;
private TextButton addButton;
private TextButton removeButton;
/**
*
* @param tabularParameter
* @param first
*/
public Item(TabularParameter tabularParameter, boolean first) {
super();
this.field = new TabularFld(tabularParameter);
this.add(field.getWidget());
addButton= new TextButton("");
addButton.setIcon(DataMinerManager.resources.add());
addButton.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
addField(Item.this);
private void showFieldWithSelection() {
try {
String tableName = selectedTableItem.getName();
if (tableName == null || tableName.isEmpty()) {
tableName = "NoName";
}
});
removeButton= new TextButton("");
removeButton.setIcon(DataMinerManager.resources.cancel());
tableDescription.setValue(tableName);
selectButton.setVisible(false);
selectButton2.setVisible(true);
removeButton.addSelectHandler(new SelectEvent.SelectHandler() {
@Override
public void onSelect(SelectEvent event) {
removeField(Item.this);
}
});
removeButton.setVisible(!first);
this.add(addButton);
this.add(removeButton);
} catch (Throwable e) {
Log.error(e.getLocalizedMessage());
e.printStackTrace();
}
}
public void showCancelButton() {
removeButton.setVisible(true);
removeBtn.setVisible(true);
}
public void hideCancelButton() {
removeButton.setVisible(false);
removeBtn.setVisible(false);
}
public String getValue() {
return field.getValue();
return (selectedTableItem == null) ? null : selectedTableItem
.getId();
}
public TabularFld getField() {
return field;
public boolean isValid() {
return (selectedTableItem != null);
}
}
}

View File

@ -61,8 +61,7 @@ public interface DataMinerPortletService extends RemoteService {
public List<Parameter> getParameters(Operator operator) throws Exception;
public ComputationId startComputation(Operator op, String computationTitle,
String computationDescription) throws Exception;
public ComputationId startComputation(Operator op) throws Exception;
public ComputationStatus getComputationStatus(ComputationId computationId)
throws Exception;

View File

@ -67,9 +67,7 @@ public interface DataMinerPortletServiceAsync {
void getParameters(Operator operator,
AsyncCallback<List<Parameter>> callback);
void startComputation(Operator op, String computationTitle,
String computationDescription,
AsyncCallback<ComputationId> asyncCallback);
void startComputation(Operator op, AsyncCallback<ComputationId> asyncCallback);
void getComputationStatus(ComputationId computationId,
AsyncCallback<ComputationStatus> asyncCallback);

View File

@ -140,18 +140,14 @@ public class DataMinerManagerServiceImpl extends RemoteServiceServlet implements
}
@Override
public ComputationId startComputation(Operator operator,
String computationTitle, String computationDescription)
public ComputationId startComputation(Operator operator)
throws Exception {
try {
HttpSession session = this.getThreadLocalRequest().getSession();
ASLSession aslSession = SessionUtil.getASLSession(session);
logger.debug("StartComputation(): [computationTitle="
+ computationTitle + ", computationDescription="
+ computationDescription + ", operator=" + operator + "]");
logger.debug("StartComputation(): [ operator=" + operator + "]");
SClient smClient = SessionUtil.getSClient(session, aslSession);
return smClient.startComputation(operator, computationTitle,
computationDescription);
return smClient.startComputation(operator);
} catch (Throwable e) {
logger.error("Error in start computation: "

View File

@ -2,7 +2,6 @@ package org.gcube.portlets.user.dataminermanager.server.smservice;
import java.util.List;
import org.gcube.portlets.user.dataminermanager.client.bean.ComputationItem;
import org.gcube.portlets.user.dataminermanager.client.bean.ComputationStatus;
import org.gcube.portlets.user.dataminermanager.client.bean.Operator;
import org.gcube.portlets.user.dataminermanager.client.bean.OperatorsClassification;
@ -30,8 +29,7 @@ public abstract class SClient {
public abstract List<Parameter> getInputParameters(Operator operator)
throws Exception;
public abstract ComputationId startComputation(Operator operator,
String computationTitle, String computationDescription)
public abstract ComputationId startComputation(Operator operator)
throws Exception;
public abstract ComputationStatus getComputationStatus(

View File

@ -667,8 +667,7 @@ public class SClient4WPS extends SClient {
}
@Override
public ComputationId startComputation(Operator operator,
String computationTitle, String computationDescription)
public ComputationId startComputation(Operator operator)
throws Exception {
ProcessInformations processInformations;
try {
@ -697,8 +696,7 @@ public class SClient4WPS extends SClient {
+ parm.getValue());
}
String processUrl = compute(processInformations, userInputs, inputParameters,
computationTitle, computationDescription);
String processUrl = compute(processInformations, userInputs, inputParameters);
logger.debug("Stated Computation ProcessLocation:" + processUrl);
int idIndex = processUrl.lastIndexOf("?id=");
@ -718,8 +716,7 @@ public class SClient4WPS extends SClient {
}
private String compute(ProcessInformations processInformations, Map<String, String> userInputs,
Map<String, Parameter> inputParameters, String computationTitle,
String computationDescription) throws Exception {
Map<String, Parameter> inputParameters) throws Exception {
try {
// setup the inputs
org.n52.wps.client.ExecuteRequestBuilder executeBuilder = new org.n52.wps.client.ExecuteRequestBuilder(

View File

@ -24,13 +24,12 @@ import org.gcube.portlets.user.dataminermanager.client.bean.parameters.FileParam
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.ListParameter;
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.ObjectParameter;
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.Parameter;
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.TabularListParameter;
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.TabularParameter;
import org.gcube.portlets.user.dataminermanager.shared.exception.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.itextpdf.text.pdf.PatternColor;
public class WPS2SM {
private final static String SEPARATOR = "|";
@ -132,15 +131,17 @@ public class WPS2SM {
logger.debug("Machter group: " + matcher.group());
logger.debug("Machter start: " + matcher.start());
logger.debug("Machter end: " + matcher.end());
logger.debug("Machter Group Count: " + matcher.groupCount());
logger.debug("Machter Group Count: "
+ matcher.groupCount());
String referredTabularParameterName = matcher.group(1);
logger.debug("Matcher referredTabularParameterName: "
+ referredTabularParameterName);
converted = new ColumnParameter(id, title,
referredTabularParameterName, defaultValue);
} else {
if (title.contains("[a sequence of values separated by ")) {
if (title
.contains("[a sequence of values separated by ")) {
Pattern pattern = Pattern
.compile("a sequence of values separated by (\\p{ASCII})");
Matcher matcher = pattern.matcher(title);
@ -149,8 +150,9 @@ public class WPS2SM {
logger.debug("Machter group: " + matcher.group());
logger.debug("Machter start: " + matcher.start());
logger.debug("Machter end: " + matcher.end());
logger.debug("Machter Group Count: " + matcher.groupCount());
logger.debug("Machter Group Count: "
+ matcher.groupCount());
String separator = matcher.group(1);
logger.debug("Matcher separator: " + separator);
@ -158,7 +160,8 @@ public class WPS2SM {
guessedType, separator);
} else {
converted = new ObjectParameter(id, title,
guessPrimitiveType(guessedType), defaultValue);
guessPrimitiveType(guessedType),
defaultValue);
}
}
}
@ -204,19 +207,49 @@ public class WPS2SM {
// rebuild title
title = buildParameterDescription(title, maxMegaBytes, null, minOcc,
maxOcc, null);
if ((maxOcc == 1) || (maxOcc < 0) || (maxOcc == 0))
if ((maxOcc == 1) || (maxOcc < 0) || (maxOcc == 0)) {
if (title != null && !title.isEmpty()) {
if (title.contains("[a http link to a table")) {
converted = new TabularParameter(id, title, " ",
new ArrayList<String>());
} else {
if (title.contains("[a http link to a file")) {
converted = new FileParameter(id, title, mimeType);
} else {
if (title.contains("[a sequence of http links")) {
Pattern pattern = Pattern
.compile("\\[a sequence of http links separated by (\\p{ASCII}) , each indicating a table");
if(title.contains("[a http link to a table")){
converted = new TabularParameter(id, title, " ",
new ArrayList<String>());
Matcher matcher = pattern.matcher(title);
boolean match = false;
if (match = matcher.find()) {
logger.debug("Machter title: " + title);
logger.debug("Machter find: " + match);
logger.debug("Machter group: "
+ matcher.group());
logger.debug("Machter start: "
+ matcher.start());
logger.debug("Machter end: " + matcher.end());
logger.debug("Machter Group Count: "
+ matcher.groupCount());
String separator = matcher.group(1);
logger.debug("Matcher separator: " + separator);
converted = new TabularListParameter(id, title,
separator);
} else {
converted = new FileParameter(id, title, mimeType);
}
} else {
converted = new FileParameter(id, title, mimeType);
}
}
}
} else {
converted = new FileParameter(id, title, mimeType);
}
else
converted = new ListParameter(id, title, String.class.getName(),
SEPARATOR);
} else {
converted = new FileParameter(id, title, mimeType);
}
return converted;
}

View File

@ -1,7 +1,7 @@
package org.gcube.portlets.user.dataminermanager.shared;
public class Constants {
public static final boolean DEBUG_MODE = false;
public static final boolean DEBUG_MODE = true;
public static final boolean TEST_ENABLE = false;
public static final String APPLICATION_ID = "org.gcube.portlets.user.dataminermanager.portlet.DataMinerManager";
@ -10,11 +10,14 @@ public class Constants {
public static final String DATA_MINER_LANG = "DataMinerLang";
public static final String DEFAULT_USER = "giancarlo.panichi";
//public static final String DEFAULT_USER = "statistical.manager@gmail.com";
public static final String DEFAULT_ROLE = "OrganizationMember";
public final static String DEFAULT_SCOPE = "/gcube/devsec/devVRE";
// public final static String DEFAULT_USER = "test.user";
// public final static String DEFAULT_SCOPE = "/gcube/devNext";
// public final static String DEFAULT_SCOPE = "/gcube/devNext/NextNext";
public static final String SClient = "DataMinerClient";
public static final String DATA_MINER_SERVICE_NAME = "DataMiner";
@ -23,18 +26,13 @@ public class Constants {
public static final String TD_DATASOURCE_FACTORY_ID = "DataMinerManager";
public static final int TIME_UPDATE_MONITOR = 5 * 1000;
public static final int TIME_UPDATE_JOBS_GRID = 10 * 1000;
public static final int TIME_UPDATE_COMPUTATION_STATUS_PANEL = 10 * 1000;// 7*1000;
public static final String maskLoadingStyle = "x-mask-loading";
public final static String[] ClassificationNames = { "User Perspective" };
// "Computation Perspective"};
public final static String UserClassificationName = ClassificationNames[0];
// public final static String computationClassificationName =
// classificationNames[1];
public static final String RealFileTemplate = "ZZ-FILE";
public static final String UserFileTemplate = "FILE";
// WPS Data Miner
public static final String WPSServiceURL = "http://dataminer-d-d4s.d4science.org:80/wps/";
@ -43,6 +41,9 @@ public class Constants {
public static final String WPSToken = "4ccc2c35-60c9-4c9b-9800-616538d5d48b";// "d7a4076c-e8c1-42fe-81e0-bdecb1e8074a";
public static final String WPSUser = "gianpaolo.coro";
public static final String SESSION_TOKEN = "SESSION_TOKEN";
//public static final String WPSToken = "45943442-74ef-408b-be64-d26b42cf4c08 ";
//public static final String WPSUser = "statistical.manager@gmail.com";

View File

@ -41,18 +41,18 @@
<entry-point
class='org.gcube.portlets.user.dataminermanager.client.DataMinerManager' />
<!-- <set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
<set-property name="log_ConsoleLogger" value="ENABLED" /> <set-property
name="log_DivLogger" value="ENABLED" /> <set-property name="log_GWTLogger"
value="ENABLED" /> <set-property name="log_SystemLogger" value="ENABLED"
/> -->
/>
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="ENABLED"
/> -->
<!--
<set-property name="log_ConsoleLogger" value="DISABLED" />
<set-property name="log_DivLogger" value="DISABLED" />
<set-property name="log_GWTLogger" value="DISABLED" />
<set-property name="log_SystemLogger" value="DISABLED" />
<set-property name="log_SystemLogger" value="DISABLED" /> -->
<!-- Not in GWT 2.6 <set-property name="log_FirebugLogger" value="DISABLED"
/> -->