Added [TEXTAREA] string support

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@158822 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2017-11-27 14:44:30 +00:00
parent 21fc12c772
commit c75d9b4949
3 changed files with 87 additions and 26 deletions

View File

@ -2,6 +2,7 @@
<Changeset component="org.gcube.portlets-user.data-miner-manager.1-6-0"
date="2016-11-09">
<Change>Added NetCDF files support</Change>
<Change>Added [TEXAREA] string support</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.data-miner-manager.1-5-0"
date="2016-06-12">

View File

@ -6,6 +6,7 @@ package org.gcube.portlets.user.dataminermanager.client.parametersfield;
import org.gcube.portlets.user.dataminermanager.shared.parameters.ObjectParameter;
import org.gcube.portlets.user.dataminermanager.shared.parameters.Parameter;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
@ -15,6 +16,7 @@ import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
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.form.TextArea;
import com.sencha.gxt.widget.core.client.form.TextField;
/**
@ -27,54 +29,87 @@ public class StringFld extends AbstractFld {
private SimpleContainer fieldContainer;
private TextField textField;
private TextArea textArea;
private boolean isTextArea;
/**
* @param parameter parameter
* @param parameter
* parameter
*/
public StringFld(Parameter parameter) {
super(parameter);
ObjectParameter p = (ObjectParameter) parameter;
textField = new TextField();
textField.setValue(p.getDefaultValue());
if (p.getDefaultValue() == null)
textField.setAllowBlank(false);
ObjectParameter p = (ObjectParameter) parameter;
HtmlLayoutContainer descr;
if (p.getDescription() == null) {
descr=new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
if (p.getDescription() == null || p.getDescription().isEmpty()) {
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
descr.addStyleName("workflow-fieldDescription");
isTextArea = false;
} else {
//textField.setToolTip(p.getDescription());
descr=new HtmlLayoutContainer("<p style='margin-left:5px !important;'>"+p.getDescription()+"</p>");
descr.addStyleName("workflow-fieldDescription");
// textField.setToolTip(p.getDescription());
if (p.getDescription().contains("[TEXTAREA]")) {
String textAreaDescription=p.getDescription();
Log.debug("textAreaDescription: "+textAreaDescription);
textAreaDescription=textAreaDescription.replaceFirst("\\[TEXTAREA\\]", "");
Log.debug("Removed tag: "+textAreaDescription);
descr = new HtmlLayoutContainer(
"<p style='margin-left:5px !important;'>" + textAreaDescription + "</p>");
descr.addStyleName("workflow-fieldDescription");
isTextArea = true;
} else {
descr = new HtmlLayoutContainer(
"<p style='margin-left:5px !important;'>" + p.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");
isTextArea = false;
}
}
SimpleContainer vContainer=new SimpleContainer();
SimpleContainer vContainer = new SimpleContainer();
VerticalLayoutContainer vField = new VerticalLayoutContainer();
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer(
"String Value");
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer("String Value");
typeDescription.setStylePrimaryName("workflow-parameters-description");
vField.add(textField, new VerticalLayoutData(-1,-1,new Margins(0)));
vField.add(typeDescription, new VerticalLayoutData(-1,-1,new Margins(0)));
if (isTextArea) {
textArea = new TextArea();
textArea.setValue(p.getDefaultValue(), true);
textArea.setStylePrimaryName("dataminer-textarea");
//textArea.setResizable(TextAreaInputCell.Resizable.VERTICAL);
textArea.setWidth("360px");
textArea.setHeight("160px");
if (p.getDefaultValue() == null)
textArea.setAllowBlank(false);
vField.add(textArea, new VerticalLayoutData(-1, -1, new Margins(0)));
} else {
textField = new TextField();
textField.setValue(p.getDefaultValue());
if (p.getDefaultValue() == null)
textField.setAllowBlank(false);
vField.add(textField, new VerticalLayoutData(-1, -1, new Margins(0)));
}
vField.add(typeDescription, new VerticalLayoutData(-1, -1, new Margins(0)));
vContainer.add(vField);
fieldContainer = new SimpleContainer();
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
horiz.setPack(BoxLayoutPack.START);
horiz.setEnableOverflow(false);
horiz.add(vContainer, new BoxLayoutData(new Margins()));
horiz.add(descr, new BoxLayoutData(new Margins()));
fieldContainer.add(horiz);
fieldContainer.forceLayout();
}
/**
@ -82,7 +117,11 @@ public class StringFld extends AbstractFld {
*/
@Override
public String getValue() {
return textField.getValue();
if (isTextArea) {
return textArea.getCurrentValue();
} else {
return textField.getValue();
}
}
/**
@ -95,7 +134,18 @@ public class StringFld extends AbstractFld {
@Override
public boolean isValid() {
return textField.isValid();
if (isTextArea) {
return textArea.isValid();
} else {
return textField.isValid();
}
}
public boolean isTextArea() {
return isTextArea;
}
}

View File

@ -428,6 +428,16 @@
}
/**
* Field
*/
.dataminer-textarea textarea {
height: 160px !important;
width: 360px !important;
}
/**
* Computation Output
*/