/** * */ package org.gcube.portlets.user.dataminerexecutor.client.parametersfield; import org.gcube.data.analysis.dataminermanagercl.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; 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.container.VerticalLayoutContainer; import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData; /** * * @author Giancarlo Panichi * * */ public class FileFld extends AbstractFld { private SimpleContainer fieldContainer; //private TextField textField; private String value; /** * @param parameter * parameter */ public FileFld(Parameter parameter) { super(parameter); //ObjectParameter p = (ObjectParameter) parameter; Log.debug("Create File field: "+parameter.getName()); value=parameter.getValue(); HtmlLayoutContainer descr; descr = new HtmlLayoutContainer("

"); descr.addStyleName("workflow-fieldDescription"); descr = new HtmlLayoutContainer("

" + parameter.getDescription() + "

"); descr.addStyleName("workflow-fieldDescription"); SimpleContainer vContainer = new SimpleContainer(); VerticalLayoutContainer vField = new VerticalLayoutContainer(); HtmlLayoutContainer typeDescription = new HtmlLayoutContainer("File Value"); typeDescription.setStylePrimaryName("workflow-parameters-description"); //textField = new TextField(); //textField.setValue(p.getValue()); //textField.isReadOnly(); HtmlLayoutContainer val = new HtmlLayoutContainer("File"); val.addStyleName("workflow-fieldValue"); vField.add(val, 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(); } /** * */ @Override public String getValue() { return value; } /** * */ @Override public Widget getWidget() { return fieldContainer; } @Override public boolean isValid() { if(value!=null&&!value.isEmpty()){ return true; } else { return false; } } }