2521: Explore the possibility to port the StatMan interface onto Dataminer
https://support.d4science.org/issues/2521 Fixed TableListParameter layout git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@128443 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
c964cc69ad
commit
199039a0e0
|
@ -3,6 +3,8 @@
|
|||
*/
|
||||
package org.gcube.portlets.user.dataminermanager.client.bean.parameters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.google.gwt.user.client.rpc.IsSerializable;
|
||||
|
||||
/**
|
||||
|
@ -12,9 +14,9 @@ import com.google.gwt.user.client.rpc.IsSerializable;
|
|||
public class FileParameter extends Parameter implements IsSerializable {
|
||||
|
||||
private static final long serialVersionUID = -2967577990287112937L;
|
||||
private String mimeType;
|
||||
private String value;
|
||||
|
||||
private String defaultMimeType;
|
||||
private ArrayList<String> supportedMimeTypes;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -30,20 +32,27 @@ public class FileParameter extends Parameter implements IsSerializable {
|
|||
* @param fileName
|
||||
* @param mimeType
|
||||
*/
|
||||
public FileParameter(String name, String description, String mimeType) {
|
||||
public FileParameter(String name, String description, String defaultMimeType, ArrayList<String> supportedMimeTypes) {
|
||||
super(name, ParameterTypology.FILE, description);
|
||||
this.mimeType = mimeType;
|
||||
this.defaultMimeType = defaultMimeType;
|
||||
this.supportedMimeTypes = supportedMimeTypes;
|
||||
}
|
||||
|
||||
public String getMimeType() {
|
||||
return mimeType;
|
||||
public String getDefaultMimeType() {
|
||||
return defaultMimeType;
|
||||
}
|
||||
|
||||
public void setMimeType(String mimeType) {
|
||||
this.mimeType = mimeType;
|
||||
public void setDefaultMimeType(String defaultMimeType) {
|
||||
this.defaultMimeType = defaultMimeType;
|
||||
}
|
||||
|
||||
public ArrayList<String> getSupportedMimeTypes() {
|
||||
return supportedMimeTypes;
|
||||
}
|
||||
|
||||
public void setSupportedMimeTypes(ArrayList<String> supportedMimeTypes) {
|
||||
this.supportedMimeTypes = supportedMimeTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -62,10 +71,11 @@ public class FileParameter extends Parameter implements IsSerializable {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FileParameter [mimeType=" + mimeType + ", value=" + value
|
||||
+ ", name=" + name + ", description=" + description
|
||||
+ ", typology=" + typology + "]";
|
||||
return "FileParameter [value=" + value + ", defaultMimeType="
|
||||
+ defaultMimeType + ", supportedMimeTypes="
|
||||
+ supportedMimeTypes + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -5,25 +5,26 @@ package org.gcube.portlets.user.dataminermanager.client.bean.parameters;
|
|||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @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 abstract class Parameter implements Serializable {
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -555286289487491703L;
|
||||
public enum ParameterTypology {OBJECT, TABULAR, FILE, ENUM, LIST, COLUMN, COLUMN_LIST, TABULAR_LIST};
|
||||
|
||||
String name;
|
||||
String description;
|
||||
ParameterTypology typology;
|
||||
public enum ParameterTypology {
|
||||
OBJECT, TABULAR, FILE, ENUM, LIST, COLUMN, COLUMN_LIST, TABULAR_LIST
|
||||
};
|
||||
|
||||
protected String name;
|
||||
protected String description;
|
||||
protected ParameterTypology typology;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -50,16 +51,10 @@ public abstract class Parameter implements Serializable {
|
|||
|
||||
public abstract String getValue();
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
@ -72,7 +67,8 @@ public abstract class Parameter implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param typology the typology to set
|
||||
* @param typology
|
||||
* the typology to set
|
||||
*/
|
||||
public void setTypology(ParameterTypology typology) {
|
||||
this.typology = typology;
|
||||
|
@ -86,7 +82,8 @@ public abstract class Parameter implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param description the description to set
|
||||
* @param description
|
||||
* the description to set
|
||||
*/
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
|
@ -130,6 +127,4 @@ public abstract class Parameter implements Serializable {
|
|||
+ ", typology=" + typology + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ package org.gcube.portlets.user.dataminermanager.client.bean.parameters;
|
|||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
* @author ceras
|
||||
*
|
||||
|
@ -17,8 +16,10 @@ public class TabularListParameter extends Parameter implements Serializable {
|
|||
private String value;
|
||||
private String separator;
|
||||
private ArrayList<String> templates = new ArrayList<String>();
|
||||
//private List<String> tableNames = new ArrayList<String>();
|
||||
private String defaultMimeType;
|
||||
private ArrayList<String> supportedMimeTypes;
|
||||
|
||||
// private List<String> tableNames = new ArrayList<String>();
|
||||
|
||||
public TabularListParameter() {
|
||||
super();
|
||||
|
@ -29,18 +30,20 @@ public class TabularListParameter extends Parameter implements Serializable {
|
|||
* @param defaultValue
|
||||
* @param value
|
||||
*/
|
||||
public TabularListParameter(String name, String description, String separator) {
|
||||
public TabularListParameter(String name, String description,
|
||||
String separator, String defaultMimeType,
|
||||
ArrayList<String> supportedMimeTypes) {
|
||||
super(name, ParameterTypology.TABULAR_LIST, description);
|
||||
this.separator = separator;
|
||||
this.defaultMimeType = defaultMimeType;
|
||||
this.supportedMimeTypes = supportedMimeTypes;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
|
@ -54,7 +57,8 @@ public class TabularListParameter extends Parameter implements Serializable {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param templates the templates to set
|
||||
* @param templates
|
||||
* the templates to set
|
||||
*/
|
||||
public void setTemplates(ArrayList<String> templates) {
|
||||
this.templates = templates;
|
||||
|
@ -71,15 +75,32 @@ public class TabularListParameter extends Parameter implements Serializable {
|
|||
templates.add(template);
|
||||
}
|
||||
|
||||
public String getDefaultMimeType() {
|
||||
return defaultMimeType;
|
||||
}
|
||||
|
||||
public void setDefaultMimeType(String defaultMimeType) {
|
||||
this.defaultMimeType = defaultMimeType;
|
||||
}
|
||||
|
||||
public ArrayList<String> getSupportedMimeTypes() {
|
||||
return supportedMimeTypes;
|
||||
}
|
||||
|
||||
public void setSupportedMimeTypes(ArrayList<String> supportedMimeTypes) {
|
||||
this.supportedMimeTypes = supportedMimeTypes;
|
||||
}
|
||||
|
||||
public void setSeparator(String separator) {
|
||||
this.separator = separator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TabularListParameter [value=" + value + ", separator="
|
||||
+ separator + ", templates=" + templates + ", name=" + name
|
||||
+ ", description=" + description + ", typology=" + typology
|
||||
+ "]";
|
||||
+ separator + ", templates=" + templates + ", defaultMimeType="
|
||||
+ defaultMimeType + ", supportedMimeTypes="
|
||||
+ supportedMimeTypes + "]";
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,7 +7,9 @@ import java.io.Serializable;
|
|||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author ceras
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TabularParameter extends Parameter implements Serializable {
|
||||
|
@ -15,6 +17,8 @@ public class TabularParameter extends Parameter implements Serializable {
|
|||
private static final long serialVersionUID = 8038591467145151553L;
|
||||
private String tableName;
|
||||
private ArrayList<String> templates = new ArrayList<String>();
|
||||
private String defaultMimeType;
|
||||
private ArrayList<String> supportedMimeTypes;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -24,17 +28,19 @@ public class TabularParameter extends Parameter implements Serializable {
|
|||
this.typology = ParameterTypology.TABULAR;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @param description
|
||||
* @param tableName
|
||||
*/
|
||||
public TabularParameter(String name, String description, String tableName) {
|
||||
public TabularParameter(String name, String description, String tableName,
|
||||
String defaultMimeType, ArrayList<String> supportedMimeTypes) {
|
||||
super(name, ParameterTypology.TABULAR, description);
|
||||
this.tableName = tableName;
|
||||
this.templates = null;
|
||||
this.defaultMimeType = defaultMimeType;
|
||||
this.supportedMimeTypes = supportedMimeTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,10 +51,13 @@ public class TabularParameter extends Parameter implements Serializable {
|
|||
* @param templates
|
||||
*/
|
||||
public TabularParameter(String name, String description, String tableName,
|
||||
ArrayList<String> templates) {
|
||||
ArrayList<String> templates, String defaultMimeType,
|
||||
ArrayList<String> supportedMimeTypes) {
|
||||
super(name, ParameterTypology.TABULAR, description);
|
||||
this.tableName = tableName;
|
||||
this.templates = templates;
|
||||
this.defaultMimeType = defaultMimeType;
|
||||
this.supportedMimeTypes = supportedMimeTypes;
|
||||
}
|
||||
|
||||
public String getTableName() {
|
||||
|
@ -77,11 +86,28 @@ public class TabularParameter extends Parameter implements Serializable {
|
|||
this.setTableName(value);
|
||||
}
|
||||
|
||||
public String getDefaultMimeType() {
|
||||
return defaultMimeType;
|
||||
}
|
||||
|
||||
public void setDefaultMimeType(String defaultMimeType) {
|
||||
this.defaultMimeType = defaultMimeType;
|
||||
}
|
||||
|
||||
public ArrayList<String> getSupportedMimeTypes() {
|
||||
return supportedMimeTypes;
|
||||
}
|
||||
|
||||
public void setSupportedMimeTypes(ArrayList<String> supportedMimeTypes) {
|
||||
this.supportedMimeTypes = supportedMimeTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TabularParameter [tableName=" + tableName + ", templates="
|
||||
+ templates + ", name=" + name + ", description=" + description
|
||||
+ ", typology=" + typology + "]";
|
||||
+ templates + ", defaultMimeType=" + defaultMimeType
|
||||
+ ", supportedMimeTypes=" + supportedMimeTypes + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package org.gcube.portlets.user.dataminermanager.client.custom;
|
||||
|
||||
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 GreenProgressBar extends ProgressBar {
|
||||
|
||||
public GreenProgressBar() {
|
||||
super(new ProgressBarCell(new GreenProgressBarAppaearance()));
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
package org.gcube.portlets.user.dataminermanager.client.custom;
|
||||
|
||||
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 RedProgressBar extends ProgressBar {
|
||||
|
||||
public RedProgressBar() {
|
||||
super(new ProgressBarCell(new RedProgressBarAppaearance()));
|
||||
}
|
||||
|
||||
}
|
|
@ -47,6 +47,7 @@ public class ComputationPanel extends FramedPanel implements HasComputationReady
|
|||
create();
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
setHeaderVisible(false);
|
||||
setBodyStyle("backgroundColor:white;");
|
||||
|
|
|
@ -220,7 +220,7 @@ public class ComputationParametersPanel extends SimpleContainer {
|
|||
OperatorFieldWidget fieldWidget = new OperatorFieldWidget(p);
|
||||
fieldWidgetsMap.put(p.getName(), fieldWidget);
|
||||
vParameters.add(fieldWidget.getParameterLabel(),
|
||||
new VerticalLayoutData(1, -1, new Margins()));
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
}
|
||||
|
||||
for (Parameter p : operator.getOperatorParameters()) {
|
||||
|
@ -266,7 +266,9 @@ public class ComputationParametersPanel extends SimpleContainer {
|
|||
}
|
||||
parametersPanel.getElement().getStyle().setPaddingBottom(0, Unit.PX);
|
||||
submit.setVisible(true);
|
||||
parametersPanel.forceLayout();
|
||||
forceLayout();
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error in show form:" + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -9,8 +9,8 @@ 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.bean.Operator;
|
||||
import org.gcube.portlets.user.dataminermanager.client.common.EventBusProvider;
|
||||
import org.gcube.portlets.user.dataminermanager.client.custom.GreenProgressBarAppaearance;
|
||||
import org.gcube.portlets.user.dataminermanager.client.custom.RedProgressBarAppaearance;
|
||||
import org.gcube.portlets.user.dataminermanager.client.custom.GreenProgressBar;
|
||||
import org.gcube.portlets.user.dataminermanager.client.custom.RedProgressBar;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.CancelComputationExecutionRequestEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.rpc.DataMinerPortletServiceAsync;
|
||||
import org.gcube.portlets.user.dataminermanager.client.util.UtilsGXT3;
|
||||
|
@ -22,7 +22,6 @@ import com.google.gwt.dom.client.Style.Unit;
|
|||
import com.google.gwt.i18n.client.NumberFormat;
|
||||
import com.google.gwt.user.client.Timer;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.sencha.gxt.cell.core.client.ProgressBarCell;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.widget.core.client.ProgressBar;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
|
@ -134,8 +133,7 @@ public class ComputationStatusPanel extends SimpleContainer {
|
|||
int index=vert.getWidgetIndex(progressBar);
|
||||
vert.remove(index);
|
||||
//TODO
|
||||
ProgressBarCell cell=new ProgressBarCell(new GreenProgressBarAppaearance());
|
||||
progressBar =new ProgressBar(cell);
|
||||
progressBar =new GreenProgressBar();
|
||||
progressBar.updateProgress(1, "Computation Complete");
|
||||
progressBar.addStyleName("progressBar-complete");
|
||||
vert.insert(progressBar, index, new VerticalLayoutData(1, -1, new Margins(20)));
|
||||
|
@ -155,8 +153,7 @@ public class ComputationStatusPanel extends SimpleContainer {
|
|||
int index=vert.getWidgetIndex(progressBar);
|
||||
vert.remove(index);
|
||||
//TODO
|
||||
ProgressBarCell cell=new ProgressBarCell(new RedProgressBarAppaearance());
|
||||
progressBar =new ProgressBar(cell);
|
||||
progressBar =new RedProgressBar();
|
||||
progressBar.updateProgress(1, "Computation Fail");
|
||||
progressBar.getElement().getStyle().setMarginBottom(36, Unit.PX);
|
||||
progressBar.addStyleName("progressBar-failed");
|
||||
|
@ -207,8 +204,7 @@ public class ComputationStatusPanel extends SimpleContainer {
|
|||
int index=vert.getWidgetIndex(progressBar);
|
||||
vert.remove(index);
|
||||
//TODO
|
||||
ProgressBarCell cell=new ProgressBarCell(new RedProgressBarAppaearance());
|
||||
progressBar =new ProgressBar(cell);
|
||||
progressBar =new RedProgressBar();
|
||||
progressBar.updateProgress(1, "Failed to get the status");
|
||||
progressBar.getElement().getStyle().setMarginBottom(36, Unit.PX);
|
||||
progressBar.addStyleName("progressBar-failed");
|
||||
|
|
|
@ -5,6 +5,7 @@ package org.gcube.portlets.user.dataminermanager.client.parametersfield;
|
|||
|
||||
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.shared.StringUtil;
|
||||
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
|
@ -43,7 +44,7 @@ public class BooleanFld extends AbstractFld {
|
|||
.equals("FALSE"));
|
||||
else
|
||||
checkBox.setValue(false);
|
||||
checkBox.setBoxLabel(p.getName());
|
||||
checkBox.setBoxLabel(StringUtil.getCapitalWords(p.getName()));
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@ public class EnumFld extends AbstractFld {
|
|||
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
fieldContainer.forceLayout();
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -6,14 +6,12 @@ package org.gcube.portlets.user.dataminermanager.client.parametersfield;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.dataminermanager.client.DataMinerManager;
|
||||
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 com.google.gwt.user.client.ui.Widget;
|
||||
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.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||
|
@ -21,9 +19,6 @@ 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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -37,7 +32,7 @@ public class ListStringFld extends AbstractFld {
|
|||
private HBoxLayoutContainer horiz;
|
||||
private SimpleContainer listContainer;
|
||||
private VerticalLayoutContainer vp;
|
||||
private List<Item> items;
|
||||
private List<StringItem> items;
|
||||
private ListParameter listParameter;
|
||||
|
||||
/**
|
||||
|
@ -51,8 +46,7 @@ public class ListStringFld extends AbstractFld {
|
|||
|
||||
listContainer = new SimpleContainer();
|
||||
vp = new VerticalLayoutContainer();
|
||||
items = new ArrayList<Item>();
|
||||
addField(null);
|
||||
items = new ArrayList<StringItem>();
|
||||
listContainer.add(vp, new MarginData(new Margins()));
|
||||
|
||||
fieldContainer = new SimpleContainer();
|
||||
|
@ -77,47 +71,61 @@ public class ListStringFld extends AbstractFld {
|
|||
horiz.add(descr, new BoxLayoutData(new Margins(0)));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
fieldContainer.forceLayout();
|
||||
addField(null);
|
||||
}
|
||||
|
||||
private void addField(Item upperItem) {
|
||||
protected void addField(StringItem upperItem) {
|
||||
|
||||
ObjectParameter objPar = new ObjectParameter(listParameter.getName(),
|
||||
listParameter.getDescription(), listParameter.getType(), null);
|
||||
|
||||
if (upperItem == null) {
|
||||
Item item = new Item(objPar, true);
|
||||
StringItem item = new StringItem(this, objPar, true);
|
||||
items.add(item);
|
||||
vp.add(item, new VerticalLayoutData(1, -1, new Margins()));
|
||||
vp.add(item);
|
||||
} 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;
|
||||
}
|
||||
|
||||
int pos = items.indexOf(upperItem);
|
||||
if (pos > -1) {
|
||||
upperItem.showCancelButton();
|
||||
Item item = new Item(objPar, false);
|
||||
upperItem.forceLayout();
|
||||
StringItem item = new StringItem(this, objPar, false);
|
||||
items.add(pos + 1, item);
|
||||
vp.insert(item, pos + 1);
|
||||
vp.insert(item, pos + 1);//don't use new VerticalLayoutData(1, -1,new Margins(0))
|
||||
} else {
|
||||
upperItem.forceLayout();
|
||||
StringItem item = new StringItem(this, objPar, true);
|
||||
items.add(item);
|
||||
vp.add(item);//don't use new VerticalLayoutData(-1, -1, new Margins(0))
|
||||
}
|
||||
}
|
||||
|
||||
forceLayout();
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void forceLayout(){
|
||||
vp.forceLayout();
|
||||
horiz.forceLayout();
|
||||
fieldContainer.forceLayout();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param item
|
||||
*/
|
||||
protected void removeField(Item item) {
|
||||
protected void removeField(StringItem item) {
|
||||
items.remove(item);
|
||||
|
||||
vp.remove(item);
|
||||
|
||||
if (items.size() == 1) {
|
||||
items.get(0).hideCancelButton();
|
||||
items.get(0).forceLayout();
|
||||
}
|
||||
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,7 +136,7 @@ public class ListStringFld extends AbstractFld {
|
|||
String separator = listParameter.getSeparator();
|
||||
String value = "";
|
||||
boolean first = true;
|
||||
for (Item item : items) {
|
||||
for (StringItem item : items) {
|
||||
String itemValue = item.getValue();
|
||||
if (itemValue != null && !itemValue.contentEquals("")) {
|
||||
value += (first ? "" : separator) + itemValue;
|
||||
|
@ -152,7 +160,7 @@ public class ListStringFld extends AbstractFld {
|
|||
@Override
|
||||
public boolean isValid() {
|
||||
boolean valid = false;
|
||||
for (Item item : items)
|
||||
for (StringItem item : items)
|
||||
if (item.isValid()) {
|
||||
valid = true;
|
||||
break;
|
||||
|
@ -160,80 +168,6 @@ public class ListStringFld extends AbstractFld {
|
|||
return valid;
|
||||
}
|
||||
|
||||
private class Item extends HBoxLayoutContainer {
|
||||
|
||||
private TextField field;
|
||||
private TextButton addBtn;
|
||||
private TextButton removeBtn;
|
||||
|
||||
/**
|
||||
* @param objPar
|
||||
*/
|
||||
public Item(ObjectParameter objectParameter, boolean first) {
|
||||
super();
|
||||
|
||||
field = new TextField();
|
||||
field.setAllowBlank(false);
|
||||
|
||||
addBtn = new TextButton("");
|
||||
|
||||
addBtn.setIcon(DataMinerManager.resources.add());
|
||||
|
||||
addBtn.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
addField(Item.this);
|
||||
forceLayout();
|
||||
vp.forceLayout();
|
||||
fieldContainer.forceLayout();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
removeBtn = new TextButton("");
|
||||
|
||||
removeBtn.setIcon(DataMinerManager.resources.cancel());
|
||||
|
||||
removeBtn.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
removeField(Item.this);
|
||||
forceLayout();
|
||||
vp.forceLayout();
|
||||
fieldContainer.forceLayout();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
removeBtn.setVisible(!first);
|
||||
|
||||
setPack(BoxLayoutPack.START);
|
||||
setEnableOverflow(false);
|
||||
add(field, new BoxLayoutData(new Margins()));
|
||||
add(addBtn, new BoxLayoutData(new Margins()));
|
||||
add(removeBtn, new BoxLayoutData(new Margins()));
|
||||
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
public void showCancelButton() {
|
||||
removeBtn.setVisible(true);
|
||||
}
|
||||
|
||||
public void hideCancelButton() {
|
||||
removeBtn.setVisible(false);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return field.getCurrentValue();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return field.isValid();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ package org.gcube.portlets.user.dataminermanager.client.parametersfield;
|
|||
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.shared.StringUtil;
|
||||
|
||||
import com.allen_sauer.gwt.log.client.Log;
|
||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||
|
@ -19,12 +20,10 @@ import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
|||
public class OperatorFieldWidget {
|
||||
|
||||
private Parameter parameter;
|
||||
|
||||
private AbstractFld field;
|
||||
private FieldLabel parameterLabel;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public OperatorFieldWidget(Parameter p) {
|
||||
super();
|
||||
|
@ -49,12 +48,12 @@ public class OperatorFieldWidget {
|
|||
field = new FileFld(p);
|
||||
|
||||
if (field == null) {
|
||||
parameterLabel = new FieldLabel(null, p.getName());
|
||||
parameterLabel = new FieldLabel(null, StringUtil.getCapitalWords(p.getName()));
|
||||
parameterLabel.setLabelWidth(200);
|
||||
parameterLabel.setLabelWordWrap(true);
|
||||
|
||||
} else {
|
||||
parameterLabel = new FieldLabel(field.getWidget(), p.getName());
|
||||
parameterLabel = new FieldLabel(field.getWidget(), StringUtil.getCapitalWords(p.getName()));
|
||||
parameterLabel.setLabelWidth(200);
|
||||
parameterLabel.setLabelWordWrap(true);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
package org.gcube.portlets.user.dataminermanager.client.parametersfield;
|
||||
|
||||
import org.gcube.portlets.user.dataminermanager.client.DataMinerManager;
|
||||
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.ObjectParameter;
|
||||
|
||||
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.HBoxLayoutContainer;
|
||||
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>
|
||||
*
|
||||
*/
|
||||
public class StringItem extends HBoxLayoutContainer {
|
||||
private ListStringFld parent;
|
||||
private TextField field;
|
||||
private TextButton addBtn;
|
||||
private TextButton removeBtn;
|
||||
|
||||
/**
|
||||
* @param objPar
|
||||
*/
|
||||
public StringItem(ListStringFld parent, ObjectParameter objectParameter, boolean first) {
|
||||
super();
|
||||
this.parent=parent;
|
||||
create(objectParameter,first);
|
||||
}
|
||||
|
||||
private void create( ObjectParameter objectParameter, boolean first){
|
||||
field = new TextField();
|
||||
field.setAllowBlank(false);
|
||||
|
||||
addBtn = new TextButton("");
|
||||
|
||||
addBtn.setIcon(DataMinerManager.resources.add());
|
||||
|
||||
addBtn.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
parent.addField(StringItem.this);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
removeBtn = new TextButton("");
|
||||
|
||||
removeBtn.setIcon(DataMinerManager.resources.cancel());
|
||||
|
||||
removeBtn.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
parent.removeField(StringItem.this);
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
removeBtn.setVisible(!first);
|
||||
|
||||
setPack(BoxLayoutPack.START);
|
||||
setEnableOverflow(false);
|
||||
add(field, new BoxLayoutData(new Margins()));
|
||||
add(addBtn, new BoxLayoutData(new Margins()));
|
||||
add(removeBtn, new BoxLayoutData(new Margins()));
|
||||
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
public void showCancelButton() {
|
||||
removeBtn.setVisible(true);
|
||||
}
|
||||
|
||||
public void hideCancelButton() {
|
||||
removeBtn.setVisible(false);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return field.getCurrentValue();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return field.isValid();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,269 @@
|
|||
package org.gcube.portlets.user.dataminermanager.client.parametersfield;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.portlets.user.dataminermanager.client.DataMinerManager;
|
||||
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.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.HBoxLayoutContainer;
|
||||
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>
|
||||
*
|
||||
*/
|
||||
public class TabItem extends HBoxLayoutContainer {
|
||||
|
||||
private TabularListFld parent;
|
||||
private TextButton selectButton;
|
||||
private TextButton selectButton2;
|
||||
private TableItemSimple selectedTableItem;
|
||||
private TextButton addBtn;
|
||||
private TextButton removeBtn;
|
||||
private TextField tableDescription;
|
||||
private WorkspaceExplorerSelectDialog wselectDialog;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tabularListFld
|
||||
* @param tabularParameter
|
||||
* @param first
|
||||
*/
|
||||
public TabItem(TabularListFld parent, TabularParameter tabularParameter,
|
||||
boolean first) {
|
||||
super();
|
||||
this.parent = parent;
|
||||
initDialog();
|
||||
create(tabularParameter, first);
|
||||
}
|
||||
|
||||
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) {
|
||||
parent.addField(TabItem.this);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
removeBtn = new TextButton("");
|
||||
removeBtn.setIcon(DataMinerManager.resources.cancel());
|
||||
|
||||
removeBtn.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
selectedTableItem = null;
|
||||
parent.removeField(TabItem.this);
|
||||
|
||||
}
|
||||
});
|
||||
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(addBtn, new BoxLayoutData(new Margins()));
|
||||
add(removeBtn, new BoxLayoutData(new Margins()));
|
||||
|
||||
|
||||
|
||||
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
|
||||
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 void showFieldWithSelection() {
|
||||
try {
|
||||
|
||||
String tableName = selectedTableItem.getName();
|
||||
|
||||
if (tableName == null || tableName.isEmpty()) {
|
||||
tableName = "NoName";
|
||||
}
|
||||
|
||||
tableDescription.setValue(tableName);
|
||||
tableDescription.setVisible(true);
|
||||
selectButton.setVisible(false);
|
||||
selectButton2.setVisible(true);
|
||||
parent.forceLayout();
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.error(e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void showCancelButton() {
|
||||
removeBtn.setVisible(true);
|
||||
}
|
||||
|
||||
public void hideCancelButton() {
|
||||
removeBtn.setVisible(false);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return (selectedTableItem == null) ? null : selectedTableItem.getId();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return (selectedTableItem != null);
|
||||
}
|
||||
|
||||
}
|
|
@ -43,11 +43,12 @@ 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 TabularFld extends AbstractFld implements HasTabularFldChangeEventHandler {
|
||||
public class TabularFld extends AbstractFld implements
|
||||
HasTabularFldChangeEventHandler {
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
private HBoxLayoutContainer horiz;
|
||||
|
@ -70,6 +71,25 @@ public class TabularFld extends AbstractFld implements HasTabularFldChangeEventH
|
|||
SimpleContainer tabContainer = new SimpleContainer();
|
||||
vp = new VerticalLayoutContainer();
|
||||
init();
|
||||
|
||||
List<String> templates = tabularParameter.getTemplates();
|
||||
if (templates == null || templates.isEmpty()) {
|
||||
templatesList = new HtmlLayoutContainer(
|
||||
"<p></p>");
|
||||
templatesList.addStyleName("workflow-parameters-description");
|
||||
} else {
|
||||
String list = "";
|
||||
boolean first = true;
|
||||
for (String template : templates) {
|
||||
list += (first ? "" : ", ") + Format.ellipse(template, 50);
|
||||
first = false;
|
||||
}
|
||||
|
||||
templatesList = new HtmlLayoutContainer(
|
||||
"<p>Suitable Data Set Templates: <br>" + list + "</p>");
|
||||
templatesList.addStyleName("workflow-parameters-description");
|
||||
}
|
||||
|
||||
tabContainer.add(vp, new MarginData(new Margins(0)));
|
||||
|
||||
fieldContainer = new SimpleContainer();
|
||||
|
@ -97,9 +117,7 @@ public class TabularFld extends AbstractFld implements HasTabularFldChangeEventH
|
|||
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
List<String> templates = tabularParameter.getTemplates();
|
||||
|
||||
List<ItemType> selectableTypes = new ArrayList<ItemType>();
|
||||
selectableTypes.add(ItemType.EXTERNAL_FILE);
|
||||
|
@ -107,21 +125,23 @@ public class TabularFld extends AbstractFld implements HasTabularFldChangeEventH
|
|||
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"
|
||||
* "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");
|
||||
// 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>());
|
||||
/*
|
||||
* List<String> allowedFileExtensions = Arrays.asList("csv");
|
||||
*
|
||||
* FilterCriteria filterCriteria = new FilterCriteria(allowedMimeTypes,
|
||||
* allowedFileExtensions, new HashMap<String, String>());
|
||||
*/
|
||||
wselectDialog = new WorkspaceExplorerSelectDialog("Select CSV", false);
|
||||
// filterCriteria, selectableTypes);
|
||||
|
@ -175,7 +195,6 @@ public class TabularFld extends AbstractFld implements HasTabularFldChangeEventH
|
|||
selectButton.setIcon(DataMinerManager.resources.folderExplore());
|
||||
selectButton.setToolTip("Select Data Set");
|
||||
|
||||
|
||||
selectButton2 = new TextButton("");
|
||||
selectButton2.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
|
@ -201,31 +220,21 @@ public class TabularFld extends AbstractFld implements HasTabularFldChangeEventH
|
|||
|
||||
cancelButton.setIcon(DataMinerManager.resources.cancel());
|
||||
|
||||
|
||||
String list = "";
|
||||
boolean first = true;
|
||||
for (String template : templates) {
|
||||
list += (first ? "" : ", ") + Format.ellipse(template,50);
|
||||
first = false;
|
||||
}
|
||||
templatesList = new HtmlLayoutContainer("<p>Suitable Data Set Templates: <br>" + list+"</p>");
|
||||
templatesList.addStyleName("workflow-parameters-description");
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void retrieveTableInformation(Item item) {
|
||||
DataMinerPortletServiceAsync.INSTANCE.retrieveTableInformation(item, new AsyncCallback<TableItemSimple>() {
|
||||
DataMinerPortletServiceAsync.INSTANCE.retrieveTableInformation(item,
|
||||
new AsyncCallback<TableItemSimple>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.error("Error in retrieveTableInformation " + caught.getMessage());
|
||||
Log.error("Error in retrieveTableInformation "
|
||||
+ caught.getMessage());
|
||||
if (caught instanceof ExpiredSessionServiceException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session");
|
||||
|
||||
} else {
|
||||
UtilsGXT3.alert(
|
||||
"Error",
|
||||
UtilsGXT3.alert("Error",
|
||||
"Error retrieving table information: "
|
||||
+ caught.getLocalizedMessage());
|
||||
}
|
||||
|
@ -242,9 +251,6 @@ public class TabularFld extends AbstractFld implements HasTabularFldChangeEventH
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -305,23 +311,19 @@ public class TabularFld extends AbstractFld implements HasTabularFldChangeEventH
|
|||
return (selectedTableItem != null);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public HandlerRegistration addTabularFldChangeEventHandler(
|
||||
TabularFldChangeEventHandler handler) {
|
||||
return fieldContainer.addHandler(handler, TabularFldChangeEvent.getType());
|
||||
return fieldContainer.addHandler(handler,
|
||||
TabularFldChangeEvent.getType());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void updateListeners(TableItemSimple tableItemSimple) {
|
||||
TabularFldChangeEvent event = new TabularFldChangeEvent(tableItemSimple);
|
||||
fireEvent(event);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void fireEvent(GwtEvent<?> event) {
|
||||
fieldContainer.fireEvent(event);
|
||||
|
|
|
@ -4,29 +4,15 @@
|
|||
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.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||
|
@ -34,9 +20,6 @@ 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;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -52,7 +35,6 @@ public class TabularListFld extends AbstractFld {
|
|||
private List<TabItem> items;
|
||||
private VerticalLayoutContainer vp;
|
||||
private TabularListParameter tabularListParameter;
|
||||
private WorkspaceExplorerSelectDialog wselectDialog;
|
||||
|
||||
/**
|
||||
* @param parameter
|
||||
|
@ -102,41 +84,43 @@ public class TabularListFld extends AbstractFld {
|
|||
horiz.add(descr, new BoxLayoutData(new Margins(0)));
|
||||
|
||||
fieldContainer.add(horiz, new MarginData(new Margins(0)));
|
||||
addField(null);
|
||||
|
||||
|
||||
fieldContainer.forceLayout();
|
||||
|
||||
addField(null);
|
||||
}
|
||||
|
||||
private void addField(TabItem upperItem) {
|
||||
protected void addField(TabItem upperItem) {
|
||||
try {
|
||||
|
||||
TabularParameter tabPar = new TabularParameter(
|
||||
tabularListParameter.getName(),
|
||||
tabularListParameter.getDescription(), null,
|
||||
tabularListParameter.getTemplates());
|
||||
tabularListParameter.getTemplates(),
|
||||
tabularListParameter.getDefaultMimeType(),
|
||||
tabularListParameter.getSupportedMimeTypes());
|
||||
|
||||
if (upperItem == null) {
|
||||
TabItem item = new TabItem(tabPar, true);
|
||||
TabItem item = new TabItem(this, tabPar, true);
|
||||
items.add(item);
|
||||
vp.add(item, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vp.add(item);//don't use 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);
|
||||
upperItem.forceLayout();
|
||||
TabItem item = new TabItem(this, tabPar, false);
|
||||
items.add(pos + 1, item);
|
||||
vp.insert(item, pos + 1, new VerticalLayoutData(1, -1,
|
||||
new Margins(0)));
|
||||
vp.insert(item, pos + 1);//don't use new VerticalLayoutData(-1, -1,new Margins(0))
|
||||
} else {
|
||||
TabItem item = new TabItem(tabPar, true);
|
||||
upperItem.forceLayout();
|
||||
TabItem item = new TabItem(this, tabPar, true);
|
||||
items.add(item);
|
||||
vp.add(item, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
vp.add(item);//don't use new VerticalLayoutData(-1, -1, new Margins(0))
|
||||
}
|
||||
}
|
||||
|
||||
forceLayout();
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.error(e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
|
@ -144,17 +128,29 @@ public class TabularListFld extends AbstractFld {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param item
|
||||
*/
|
||||
private void removeField(TabItem item) {
|
||||
protected void removeField(TabItem item) {
|
||||
items.remove(item);
|
||||
|
||||
vp.remove(item);
|
||||
|
||||
if (items.size() == 1) {
|
||||
items.get(0).hideCancelButton();
|
||||
items.get(0).forceLayout();
|
||||
}
|
||||
vp.remove(item);
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
protected void forceLayout() {
|
||||
vp.forceLayout();
|
||||
listContainer.forceLayout();
|
||||
horiz.forceLayout();
|
||||
fieldContainer.forceLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -163,6 +159,7 @@ public class TabularListFld extends AbstractFld {
|
|||
@Override
|
||||
public String getValue() {
|
||||
String separator = tabularListParameter.getSeparator();
|
||||
//String separator="";
|
||||
String value = "";
|
||||
boolean first = true;
|
||||
for (TabItem item : items) {
|
||||
|
@ -194,237 +191,4 @@ public class TabularListFld extends AbstractFld {
|
|||
return valid;
|
||||
}
|
||||
|
||||
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 void showFieldWithSelection() {
|
||||
try {
|
||||
String tableName = selectedTableItem.getName();
|
||||
|
||||
if (tableName == null || tableName.isEmpty()) {
|
||||
tableName = "NoName";
|
||||
}
|
||||
|
||||
tableDescription.setValue(tableName);
|
||||
selectButton.setVisible(false);
|
||||
selectButton2.setVisible(true);
|
||||
|
||||
} catch (Throwable e) {
|
||||
Log.error(e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void showCancelButton() {
|
||||
removeBtn.setVisible(true);
|
||||
}
|
||||
|
||||
public void hideCancelButton() {
|
||||
removeBtn.setVisible(false);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return (selectedTableItem == null) ? null : selectedTableItem
|
||||
.getId();
|
||||
}
|
||||
|
||||
public boolean isValid() {
|
||||
return (selectedTableItem != null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -352,7 +352,6 @@ public class SClient4WPS extends SClient {
|
|||
|
||||
}
|
||||
|
||||
|
||||
private String executeProcessAsync(ExecuteRequestBuilder executeBuilder,
|
||||
ProcessDescriptionType processDescription) throws Exception {
|
||||
try {
|
||||
|
@ -637,8 +636,7 @@ public class SClient4WPS extends SClient {
|
|||
|
||||
ProcessInformations processInformations;
|
||||
try {
|
||||
processInformations = describeProcess(operator
|
||||
.getId());
|
||||
processInformations = describeProcess(operator.getId());
|
||||
} catch (Throwable e) {
|
||||
logger.error("GetParameters: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
|
@ -648,7 +646,8 @@ public class SClient4WPS extends SClient {
|
|||
List<Parameter> parameters = new ArrayList<>();
|
||||
|
||||
Parameter inputParameter;
|
||||
for (InputDescriptionType inputDesc : processInformations.getInputs()) {
|
||||
for (InputDescriptionType inputDesc : processInformations
|
||||
.getInputs()) {
|
||||
inputParameter = WPS2SM.convert2SMType(inputDesc);
|
||||
logger.debug("InputParameter: " + inputParameter);
|
||||
parameters.add(inputParameter);
|
||||
|
@ -667,12 +666,10 @@ public class SClient4WPS extends SClient {
|
|||
}
|
||||
|
||||
@Override
|
||||
public ComputationId startComputation(Operator operator)
|
||||
throws Exception {
|
||||
public ComputationId startComputation(Operator operator) throws Exception {
|
||||
ProcessInformations processInformations;
|
||||
try {
|
||||
processInformations = describeProcess(operator
|
||||
.getId());
|
||||
processInformations = describeProcess(operator.getId());
|
||||
} catch (Throwable e) {
|
||||
logger.error("GetParameters: " + e.getLocalizedMessage());
|
||||
e.printStackTrace();
|
||||
|
@ -696,7 +693,8 @@ public class SClient4WPS extends SClient {
|
|||
+ parm.getValue());
|
||||
}
|
||||
|
||||
String processUrl = compute(processInformations, userInputs, inputParameters);
|
||||
String processUrl = compute(processInformations, userInputs,
|
||||
inputParameters);
|
||||
logger.debug("Stated Computation ProcessLocation:" + processUrl);
|
||||
|
||||
int idIndex = processUrl.lastIndexOf("?id=");
|
||||
|
@ -715,7 +713,8 @@ public class SClient4WPS extends SClient {
|
|||
return computationId;
|
||||
}
|
||||
|
||||
private String compute(ProcessInformations processInformations, Map<String, String> userInputs,
|
||||
private String compute(ProcessInformations processInformations,
|
||||
Map<String, String> userInputs,
|
||||
Map<String, Parameter> inputParameters) throws Exception {
|
||||
try {
|
||||
// setup the inputs
|
||||
|
@ -930,16 +929,23 @@ public class SClient4WPS extends SClient {
|
|||
throws Exception {
|
||||
Map<String, Resource> outputResource = new LinkedHashMap<>();
|
||||
Map<String, Parameter> outputParameters = new LinkedHashMap<>();
|
||||
ProcessInformations processInformations=runningProcess.get(computationId);
|
||||
ProcessInformations processInformations = runningProcess
|
||||
.get(computationId);
|
||||
|
||||
Parameter outputParameter;
|
||||
for (OutputDescriptionType outputDesc : processInformations.getOutputs()) {
|
||||
if (processInformations != null
|
||||
&& processInformations.getOutputs() != null) {
|
||||
for (OutputDescriptionType outputDesc : processInformations
|
||||
.getOutputs()) {
|
||||
outputParameter = WPS2SM.convert2SMType(outputDesc);
|
||||
logger.debug("OutputParameter: " + outputParameter);
|
||||
outputParameters.put(outputParameter.getName(), outputParameter);
|
||||
outputParameters
|
||||
.put(outputParameter.getName(), outputParameter);
|
||||
}
|
||||
}
|
||||
|
||||
retrieveProcessOutput(computationId.getUrlId(), outputParameters, outputResource);
|
||||
retrieveProcessOutput(computationId.getUrlId(), outputParameters,
|
||||
outputResource);
|
||||
|
||||
return outputResource;
|
||||
|
||||
|
|
|
@ -162,6 +162,7 @@ public class WPS2SM {
|
|||
converted = new ObjectParameter(id, title,
|
||||
guessPrimitiveType(guessedType),
|
||||
defaultValue);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -185,25 +186,31 @@ public class WPS2SM {
|
|||
* @param maxOcc
|
||||
* @param rangeOccs
|
||||
* @param id
|
||||
* @param type
|
||||
* @param defaultType
|
||||
* @return
|
||||
*/
|
||||
public static Parameter manageComplexData(String maxMegaBytes,
|
||||
String title, int minOcc, int maxOcc, int rangeOccs, String id,
|
||||
ComplexDataDescriptionType type) {
|
||||
ComplexDataDescriptionType defaultType,
|
||||
ComplexDataDescriptionType[] supportedTypes) {
|
||||
Parameter converted = null;
|
||||
String mimeType = null;
|
||||
String schema = null;
|
||||
String encoding = null;
|
||||
ArrayList<String> supportedMimeTypes = new ArrayList<String>();
|
||||
|
||||
// GenericFileDataConstants.MIME_TYPE_TEXT_XML
|
||||
mimeType = type.getMimeType();
|
||||
schema = type.getSchema();
|
||||
encoding = type.getEncoding();
|
||||
mimeType = defaultType.getMimeType();
|
||||
schema = defaultType.getSchema();
|
||||
encoding = defaultType.getEncoding();
|
||||
|
||||
logger.debug("MimeType: " + mimeType);
|
||||
logger.debug("Schema: " + schema);
|
||||
logger.debug("Encoding: " + encoding);
|
||||
logger.debug("Default MimeType: " + mimeType);
|
||||
logger.debug("Default Schema: " + schema);
|
||||
logger.debug("Default Encoding: " + encoding);
|
||||
|
||||
for (ComplexDataDescriptionType supported : supportedTypes) {
|
||||
supportedMimeTypes.add(supported.getMimeType());
|
||||
}
|
||||
// rebuild title
|
||||
title = buildParameterDescription(title, maxMegaBytes, null, minOcc,
|
||||
maxOcc, null);
|
||||
|
@ -211,10 +218,12 @@ public class WPS2SM {
|
|||
if (title != null && !title.isEmpty()) {
|
||||
if (title.contains("[a http link to a table")) {
|
||||
converted = new TabularParameter(id, title, " ",
|
||||
new ArrayList<String>());
|
||||
new ArrayList<String>(), mimeType,
|
||||
supportedMimeTypes);
|
||||
} else {
|
||||
if (title.contains("[a http link to a file")) {
|
||||
converted = new FileParameter(id, title, mimeType);
|
||||
converted = new FileParameter(id, title, mimeType,
|
||||
supportedMimeTypes);
|
||||
} else {
|
||||
if (title.contains("[a sequence of http links")) {
|
||||
Pattern pattern = Pattern
|
||||
|
@ -235,20 +244,24 @@ public class WPS2SM {
|
|||
String separator = matcher.group(1);
|
||||
logger.debug("Matcher separator: " + separator);
|
||||
converted = new TabularListParameter(id, title,
|
||||
separator);
|
||||
separator, mimeType, supportedMimeTypes);
|
||||
} else {
|
||||
converted = new FileParameter(id, title, mimeType);
|
||||
converted = new FileParameter(id, title,
|
||||
mimeType, supportedMimeTypes);
|
||||
}
|
||||
} else {
|
||||
converted = new FileParameter(id, title, mimeType);
|
||||
converted = new FileParameter(id, title, mimeType,
|
||||
supportedMimeTypes);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
converted = new FileParameter(id, title, mimeType);
|
||||
converted = new FileParameter(id, title, mimeType,
|
||||
supportedMimeTypes);
|
||||
}
|
||||
} else {
|
||||
converted = new FileParameter(id, title, mimeType);
|
||||
converted = new FileParameter(id, title, mimeType,
|
||||
supportedMimeTypes);
|
||||
}
|
||||
return converted;
|
||||
}
|
||||
|
@ -317,7 +330,10 @@ public class WPS2SM {
|
|||
.getMaximumMegabytes().toString() : "1";
|
||||
logger.debug("Max Megabytes: " + maxMegaBytes);
|
||||
converted = manageComplexData(maxMegaBytes, title, minOcc,
|
||||
maxOcc, rangeOccs, id, complex.getDefault().getFormat());
|
||||
maxOcc, rangeOccs, id,
|
||||
complex.getDefault().getFormat(), complex
|
||||
.getSupported().getFormatArray());
|
||||
|
||||
}
|
||||
|
||||
logger.debug("Conversion to SM Type->Title:" + title);
|
||||
|
@ -364,7 +380,8 @@ public class WPS2SM {
|
|||
logger.debug("Complex Output");
|
||||
SupportedComplexDataType complex = wpsType.getComplexOutput();
|
||||
converted = manageComplexData("", title, -1, -1, -1, id, complex
|
||||
.getDefault().getFormat());
|
||||
.getDefault().getFormat(), complex.getSupported()
|
||||
.getFormatArray());
|
||||
}
|
||||
|
||||
return converted;
|
||||
|
|
414795
test.log.1
414795
test.log.1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue