Updated Boolean support

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@134532 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2016-11-22 14:29:56 +00:00
parent d036cbbb11
commit 45e969b3df
6 changed files with 76 additions and 36 deletions

View File

@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/data-miner-manager-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<classpathentry kind="src" output="target/data-miner-manager-1.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry including="**/*.java" kind="src" output="target/data-miner-manager-1.1.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources"/>
<classpathentry including="**/*.java" kind="src" output="target/data-miner-manager-1.2.0-SNAPSHOT/WEB-INF/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
@ -26,5 +26,5 @@
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="target/data-miner-manager-1.1.0-SNAPSHOT/WEB-INF/classes"/>
<classpathentry kind="output" path="target/data-miner-manager-1.2.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -1,4 +1,8 @@
<ReleaseNotes>
<Changeset component="org.gcube.portlets-user.data-miner-manager.1-2-0"
date="2016-12-01">
<Change>Updated Output support</Change>
</Changeset>
<Changeset component="org.gcube.portlets-user.data-miner-manager.1-1-0"
date="2016-10-01">
<Change>Updated to Auth 2.0</Change>

View File

@ -12,7 +12,7 @@
<groupId>org.gcube.portlets.user</groupId>
<artifactId>data-miner-manager</artifactId>
<version>1.1.0-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>data-miner-manager</name>

View File

@ -3,18 +3,19 @@
*/
package org.gcube.portlets.user.dataminermanager.client.parametersfield;
import org.gcube.portlets.user.dataminermanager.shared.StringUtil;
import org.gcube.portlets.user.dataminermanager.shared.parameters.ObjectParameter;
import org.gcube.portlets.user.dataminermanager.shared.parameters.Parameter;
import com.google.gwt.user.client.ui.Widget;
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.data.shared.StringLabelProvider;
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.SimpleContainer;
import com.sencha.gxt.widget.core.client.form.CheckBox;
import com.sencha.gxt.widget.core.client.form.SimpleComboBox;
/**
*
@ -25,7 +26,7 @@ import com.sencha.gxt.widget.core.client.form.CheckBox;
public class BooleanFld extends AbstractFld {
private SimpleContainer fieldContainer;
private CheckBox checkBox = new CheckBox();
private SimpleComboBox<String> listBox;
/**
* @param parameter
@ -39,41 +40,67 @@ public class BooleanFld extends AbstractFld {
ObjectParameter p = (ObjectParameter) parameter;
if (p.getDefaultValue() != null)
checkBox.setValue(!p.getDefaultValue().toUpperCase()
.equals("FALSE"));
else
checkBox.setValue(false);
checkBox.setBoxLabel(StringUtil.getCapitalWords(p.getName()));
listBox = new SimpleComboBox<String>(new StringLabelProvider<>());
listBox.add("true");
listBox.add("false");
listBox.setAllowBlank(false);
listBox.setForceSelection(true);
listBox.setEditable(false);
listBox.setTriggerAction(TriggerAction.ALL);
if (p.getDefaultValue() != null&& !p.getDefaultValue().isEmpty()) {
Boolean b=Boolean.valueOf(p.getDefaultValue());
if(b){
listBox.setValue("true");
} else {
listBox.setValue("false");
}
} else {
listBox.setValue("false");
}
HtmlLayoutContainer descr;
if (p.getDescription() == null) {
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'></p>");
descr = new HtmlLayoutContainer(
"<p style='margin-left:5px !important;'></p>");
descr.addStyleName("workflow-fieldDescription");
} else {
//checkBox.setToolTip(p.getDescription());
descr = new HtmlLayoutContainer("<p style='margin-left:5px !important;'>"
+ p.getDescription() + "</p>");
// listBox.setToolTip(p.getDescription());
descr = new HtmlLayoutContainer(
"<p style='margin-left:5px !important;'>"
+ p.getDescription() + "</p>");
descr.addStyleName("workflow-fieldDescription");
}
horiz.add(checkBox, new BoxLayoutData(new Margins()));
horiz.add(listBox, new BoxLayoutData(new Margins()));
horiz.add(descr, new BoxLayoutData(new Margins()));
fieldContainer.add(horiz);
fieldContainer.forceLayout();
}
/**
*
*/
@Override
public String getValue() {
return (checkBox.getValue() ? "true" : "false");
return listBox.getCurrentValue();
}
/**
*
*/
@Override
public Widget getWidget() {
return fieldContainer;
}
@Override
public boolean isValid() {
return listBox.isValid();
}
}

View File

@ -190,9 +190,15 @@ public class WPS2DM {
guessPrimitiveType(guessedType), defaultValue);
}
} else
converted = new ListParameter(id, title, String.class.getName(),
} else {
if(guessedType.compareTo(Boolean.class.getName())==0){
converted = new ObjectParameter(id, title, guessedType, defaultValue);
} else {
converted = new ListParameter(id, title, String.class.getName(),
SEPARATOR);
}
}
return converted;
}
@ -401,9 +407,14 @@ public class WPS2DM {
}
if (values.length > 1) {
ObjectParameter conv = (ObjectParameter) converted;
converted = new EnumParameter(conv.getName(),
conv.getDescription(), enumValues,
conv.getDefaultValue());
if (conv.getType() != null
&& !conv.getType().isEmpty()
&& conv.getType().compareToIgnoreCase(
Boolean.class.getName()) != 0){
converted = new EnumParameter(conv.getName(),
conv.getDescription(), enumValues,
conv.getDefaultValue());
}
}
}
} else if (wpsType.isSetComplexData()) {
@ -525,6 +536,9 @@ public class WPS2DM {
return Long.class.getName();
else if (typeS.contains("short"))
return Short.class.getName();
else if (typeS.contains("boolean"))
return Boolean.class.getName();
}
return String.class.getName();
@ -538,6 +552,7 @@ public class WPS2DM {
}
public static String guessPrimitiveType(String type) {
if (type.equals(Integer.class.getName())) {
return Integer.class.getName();
} else if (type.equals(String.class.getName())) {

View File

@ -1,7 +1,6 @@
package org.gcube.portlets.user.dataminermanager.server.storage;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -54,8 +53,7 @@ public class StorageUtil {
return properties.getProperties();
} catch (WorkspaceFolderNotFoundException | InternalErrorException
| HomeNotFoundException | ItemNotFoundException e) {
} catch (Throwable e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new ServiceException(e.getLocalizedMessage());
@ -86,8 +84,7 @@ public class StorageUtil {
return getInputStream(user, workSpaceItem);
} catch (WorkspaceFolderNotFoundException | InternalErrorException
| HomeNotFoundException | ItemNotFoundException e) {
} catch (Throwable e) {
logger.error(e.getLocalizedMessage());
e.printStackTrace();
throw new ServiceException(e.getLocalizedMessage());
@ -143,8 +140,7 @@ public class StorageUtil {
return workSpaceItem.getPublicLink(false);
} catch (WorkspaceFolderNotFoundException | InternalErrorException
| HomeNotFoundException | ItemNotFoundException e) {
} catch (Throwable e) {
logger.error("Error retrieving public link: "
+ e.getLocalizedMessage());
e.printStackTrace();
@ -179,9 +175,7 @@ public class StorageUtil {
return fileZip;
} catch (IOException | InternalErrorException
| WorkspaceFolderNotFoundException | HomeNotFoundException
| ItemNotFoundException e) {
} catch (Throwable e) {
e.printStackTrace();
throw new ServiceException(e.getLocalizedMessage());
}