2521: Explore the possibility to port the StatMan interface onto Dataminer
https://support.d4science.org/issues/2521 Fixed Layout on Fields Parameters git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/data-miner-manager@127004 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
98f8c1859d
commit
b7094db85a
|
@ -0,0 +1,66 @@
|
|||
package org.gcube.portlets.user.dataminermanager.client.events;
|
||||
|
||||
import org.gcube.portlets.user.dataminermanager.shared.data.TableItemSimple;
|
||||
|
||||
import com.google.gwt.event.shared.EventHandler;
|
||||
import com.google.gwt.event.shared.GwtEvent;
|
||||
import com.google.gwt.event.shared.HandlerRegistration;
|
||||
import com.google.gwt.event.shared.HasHandlers;
|
||||
|
||||
/**
|
||||
* Start Computation Event
|
||||
*
|
||||
*
|
||||
* @author "Giancarlo Panichi" <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TabularFldChangeEvent extends
|
||||
GwtEvent<TabularFldChangeEvent.TabularFldChangeEventHandler> {
|
||||
|
||||
public static Type<TabularFldChangeEventHandler> TYPE = new Type<TabularFldChangeEventHandler>();
|
||||
private TableItemSimple tableItemSimple;
|
||||
|
||||
public interface TabularFldChangeEventHandler extends EventHandler {
|
||||
void onChange(TabularFldChangeEvent event);
|
||||
}
|
||||
|
||||
public interface HasTabularFldChangeEventHandler extends HasHandlers {
|
||||
public HandlerRegistration addTabularFldChangeEventHandler(
|
||||
TabularFldChangeEventHandler handler);
|
||||
}
|
||||
|
||||
public TabularFldChangeEvent(TableItemSimple tableItemSimple) {
|
||||
this.tableItemSimple = tableItemSimple;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatch(TabularFldChangeEventHandler handler) {
|
||||
handler.onChange(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type<TabularFldChangeEventHandler> getAssociatedType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static Type<TabularFldChangeEventHandler> getType() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
public static void fire(HasHandlers source, TabularFldChangeEvent event) {
|
||||
source.fireEvent(event);
|
||||
}
|
||||
|
||||
public TableItemSimple getTableItemSimple() {
|
||||
return tableItemSimple;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TabularFldChangeEvent [tableItemSimple=" + tableItemSimple
|
||||
+ "]";
|
||||
}
|
||||
|
||||
}
|
|
@ -2,11 +2,9 @@ package org.gcube.portlets.user.dataminermanager.client.experimentArea;
|
|||
|
||||
import org.gcube.portlets.user.dataminermanager.client.DataMinerManager;
|
||||
import org.gcube.portlets.user.dataminermanager.client.bean.Operator;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.ComponentRefreshLayoutEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.StartComputationEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.ComponentRefreshLayoutEvent.ComponentRefreshLayoutEventHandler;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.StartComputationEvent.StartComputationEventHandler;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.StartComputationEvent.HasStartComputationEventHandler;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.StartComputationEvent.StartComputationEventHandler;
|
||||
import org.gcube.portlets.user.dataminermanager.client.experimentArea.ComputationParametersPanel.ComputationParametersPanelHandler;
|
||||
|
||||
import com.google.gwt.event.shared.HandlerRegistration;
|
||||
|
@ -93,7 +91,7 @@ public class ComputationPanel extends FramedPanel implements
|
|||
v.clear();
|
||||
CenterLayoutContainer centerContainer = new CenterLayoutContainer();
|
||||
centerContainer.add(new HTML(
|
||||
"<p align='center'>Select an operator.</p>"));
|
||||
"<span align='center'>Select an operator.</span>"));
|
||||
v.add(centerContainer, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||
forceLayout();
|
||||
|
||||
|
@ -111,6 +109,7 @@ public class ComputationPanel extends FramedPanel implements
|
|||
v.add(computationParametersPanel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0,5,5,5)));
|
||||
removeAllButton.setEnabled(true);
|
||||
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
|
|
|
@ -13,10 +13,9 @@ import org.gcube.portlets.user.dataminermanager.client.bean.Operator;
|
|||
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.ColumnListParameter;
|
||||
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.ColumnParameter;
|
||||
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.Parameter;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.ComponentRefreshLayoutEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.ComponentRefreshLayoutEvent.ComponentRefreshLayoutEventHandler;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.ComponentRefreshLayoutEvent.HasComponentRefreshLayoutEventHandler;
|
||||
import org.gcube.portlets.user.dataminermanager.client.parametersfield.AbstractFld;
|
||||
import org.gcube.portlets.user.dataminermanager.client.parametersfield.ColumnFld;
|
||||
import org.gcube.portlets.user.dataminermanager.client.parametersfield.ColumnListFld;
|
||||
import org.gcube.portlets.user.dataminermanager.client.parametersfield.OperatorFieldWidget;
|
||||
import org.gcube.portlets.user.dataminermanager.client.parametersfield.TabularFld;
|
||||
import org.gcube.portlets.user.dataminermanager.client.util.UtilsGXT3;
|
||||
|
@ -24,12 +23,10 @@ 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.event.shared.HandlerRegistration;
|
||||
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.HTML;
|
||||
import com.google.gwt.user.client.ui.Image;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||
|
@ -73,11 +70,7 @@ public class ComputationParametersPanel extends SimpleContainer {
|
|||
private TextField titleField;
|
||||
private String defaultComputationTitle;
|
||||
|
||||
/*
|
||||
* public ComputationParametersPanel(DataMinerPortletServiceAsync service,
|
||||
* Operator operator, ComputationParametersPanelHandler handler) {
|
||||
* this(operator); this.setHandler(handler); }
|
||||
*/
|
||||
private TextButton submit;
|
||||
|
||||
public ComputationParametersPanel(Operator operator) {
|
||||
super();
|
||||
|
@ -92,7 +85,6 @@ public class ComputationParametersPanel extends SimpleContainer {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private void init() {
|
||||
addStyleName("workflow");
|
||||
}
|
||||
|
@ -105,21 +97,25 @@ public class ComputationParametersPanel extends SimpleContainer {
|
|||
+ (operator.hasImage() ? operator.getId() : "DEFAULT_IMAGE")
|
||||
+ ".png");
|
||||
img.setStylePrimaryName("workflow-icon");
|
||||
v.add(img, new VerticalLayoutData(-1, -1, new Margins(-10,0,0,5)));
|
||||
|
||||
HtmlLayoutContainer title = new HtmlLayoutContainer(operator.getName());
|
||||
v.add(img, new VerticalLayoutData(-1, -1, new Margins(-10, 0, 0, 5)));
|
||||
|
||||
HtmlLayoutContainer title = new HtmlLayoutContainer("<span>"
|
||||
+ operator.getName() + "</span>");
|
||||
title.addStyleName("workflow-title");
|
||||
v.add(title, new VerticalLayoutData(-1, -1, new Margins(15,0,0,-25)));
|
||||
v.add(title, new VerticalLayoutData(-1, -1, new Margins(15, 0, 0, -25)));
|
||||
|
||||
String descr = operator.getDescription();
|
||||
descr = (descr == null || descr.contentEquals("")) ? "no-description"
|
||||
: operator.getDescription();
|
||||
HtmlLayoutContainer description = new HtmlLayoutContainer(descr);
|
||||
HtmlLayoutContainer description = new HtmlLayoutContainer("<span>"
|
||||
+ descr + "</span>");
|
||||
description.addStyleName("workflow-description");
|
||||
v.add(description, new VerticalLayoutData(-1, -1, new Margins(0,0,0,5)));
|
||||
v.add(description, new VerticalLayoutData(-1, -1, new Margins(0, 5, 0,
|
||||
10)));
|
||||
|
||||
addTitleField();
|
||||
|
||||
|
||||
|
||||
parametersPanel = new FormPanel() {
|
||||
@Override
|
||||
public boolean isValid(boolean preventMark) {
|
||||
|
@ -136,21 +132,55 @@ public class ComputationParametersPanel extends SimpleContainer {
|
|||
}
|
||||
|
||||
};
|
||||
//parametersPanel = new FramedPanel();
|
||||
parametersPanel.setDeferHeight(false);
|
||||
parametersPanel.setBorders(false);
|
||||
|
||||
// parametersPanel.getElement().getStyle().setMargin(20, px);
|
||||
parametersFieldSet = new FieldSet();
|
||||
parametersFieldSet.setHeadingText("Parameters");
|
||||
|
||||
vParameters = new VerticalLayoutContainer();
|
||||
|
||||
Image imgLoading = new Image(PRELOAD_IMAGE);
|
||||
vParameters.add(imgLoading, new VerticalLayoutData(1, -1, new Margins(5)));
|
||||
|
||||
parametersFieldSet.add(vParameters, new MarginData(0));
|
||||
parametersFieldSet.setCollapsible(false);
|
||||
parametersPanel.add(parametersFieldSet, new MarginData(new Margins(5,5, 5, 5)));
|
||||
|
||||
parametersPanel.add(parametersFieldSet, new MarginData(new Margins(5)));
|
||||
v.add(parametersPanel, new VerticalLayoutData(1, -1, new Margins()));
|
||||
|
||||
submit = new TextButton("Start Computation");
|
||||
submit.setToolTip(START_BUTTON_TOOLTIP);
|
||||
submit.setIcon(DataMinerManager.resources.startComputation());
|
||||
|
||||
|
||||
submit.getElement().getStyle().setMarginLeft(20, Unit.PX);
|
||||
submit.getElement().getStyle().setMarginBottom(20, Unit.PX);
|
||||
|
||||
submit.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@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
|
||||
// description
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
v.add(submit);
|
||||
//, new VerticalLayoutData(-1, -1, new Margins(0, 0, 20, 20)));
|
||||
submit.setVisible(false);
|
||||
|
||||
forceLayout();
|
||||
|
||||
loadOperatorParameters();
|
||||
|
||||
fireEvent(new ComponentRefreshLayoutEvent());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -162,7 +192,7 @@ public class ComputationParametersPanel extends SimpleContainer {
|
|||
titleField.setValue(defaultComputationTitle);
|
||||
FieldLabel titleLabel = new FieldLabel(titleField, "Computation Title");
|
||||
v.add(titleLabel, new VerticalLayoutData(-1, -1,
|
||||
new Margins(0,0,0,5)));
|
||||
new Margins(5, 0, 0, 5)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -185,10 +215,8 @@ public class ComputationParametersPanel extends SimpleContainer {
|
|||
"Impossible to retrieve parameters.");
|
||||
}
|
||||
});
|
||||
Image img = new Image(PRELOAD_IMAGE);
|
||||
img.setStyleName("workflow-parameters-preload");
|
||||
vParameters.add(img, new VerticalLayoutData(-1, -1, new Margins()));
|
||||
forceLayout();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -220,7 +248,20 @@ public class ComputationParametersPanel extends SimpleContainer {
|
|||
if (tabularField != null) {
|
||||
AbstractFld field = fieldWidgetsMap
|
||||
.get(p.getName()).getField();
|
||||
tabularField.addChangeListener(field);
|
||||
if (field instanceof ColumnFld) {
|
||||
ColumnFld columnField = (ColumnFld) field;
|
||||
tabularField
|
||||
.addTabularFldChangeEventHandler(columnField);
|
||||
} else {
|
||||
if (field instanceof ColumnListFld) {
|
||||
ColumnListFld columnListField = (ColumnListFld) field;
|
||||
tabularField
|
||||
.addTabularFldChangeEventHandler(columnListField);
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
@ -234,31 +275,7 @@ public class ComputationParametersPanel extends SimpleContainer {
|
|||
}
|
||||
}
|
||||
|
||||
final TextButton submit = new TextButton("Start Computation");
|
||||
submit.setToolTip(START_BUTTON_TOOLTIP);
|
||||
submit.setIcon(DataMinerManager.resources.startComputation());
|
||||
submit.getElement().getStyle().setMarginLeft(20, Unit.PX);
|
||||
submit.getElement().getStyle().setMarginBottom(20, Unit.PX);
|
||||
|
||||
submit.addSelectHandler(new SelectHandler() {
|
||||
|
||||
@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
|
||||
// description
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
//new VerticalLayoutData(-1, -1, new Margins(0, 0, 20,20))
|
||||
v.add(submit);
|
||||
|
||||
submit.setVisible(true);
|
||||
forceLayout();
|
||||
} catch (Throwable e) {
|
||||
Log.error("Error in show form:" + e.getLocalizedMessage());
|
||||
|
|
|
@ -13,12 +13,13 @@ import com.google.gwt.user.client.ui.Widget;
|
|||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractFld {
|
||||
public abstract class AbstractFld {
|
||||
|
||||
protected Parameter parameter;
|
||||
public abstract String getValue();
|
||||
public abstract Widget getWidget();
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -48,9 +49,6 @@ public abstract class AbstractFld {
|
|||
// (for string, int, float, double and boolean) the built-in validation is enough
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* @param tableItem
|
||||
*/
|
||||
public void fireEvent(Object message) {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -7,14 +7,23 @@ import org.gcube.portlets.user.dataminermanager.client.bean.parameters.ObjectPar
|
|||
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.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;
|
||||
|
||||
/**
|
||||
* @author ceras
|
||||
*
|
||||
* @author Giancarlo Panichi email: <a
|
||||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class BooleanFld extends AbstractFld {
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
private CheckBox checkBox = new CheckBox();
|
||||
|
||||
/**
|
||||
|
@ -22,15 +31,39 @@ public class BooleanFld extends AbstractFld {
|
|||
*/
|
||||
public BooleanFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
fieldContainer = new SimpleContainer();
|
||||
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
ObjectParameter p = (ObjectParameter)parameter;
|
||||
checkBox.setValue(!p.getDefaultValue().toUpperCase().equals("FALSE"));
|
||||
if (p.getDescription()!=null)
|
||||
checkBox.setTitle(p.getDescription());
|
||||
ObjectParameter p = (ObjectParameter) parameter;
|
||||
|
||||
if (p.getDefaultValue() != null)
|
||||
checkBox.setValue(!p.getDefaultValue().toUpperCase()
|
||||
.equals("FALSE"));
|
||||
else checkBox.setValue(false);
|
||||
checkBox.setBoxLabel(p.getName());
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (p.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
checkBox.setToolTip(p.getDescription());
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
|
||||
+ p.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
|
||||
horiz.add(checkBox, new BoxLayoutData(new Margins()));
|
||||
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getValue() {
|
||||
return (checkBox.getValue() ? "true" : "false");
|
||||
|
@ -38,7 +71,7 @@ public class BooleanFld extends AbstractFld {
|
|||
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return checkBox;
|
||||
return fieldContainer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,16 +7,25 @@ import java.util.ArrayList;
|
|||
|
||||
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.ColumnParameter;
|
||||
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.Parameter;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.TabularFldChangeEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.TabularFldChangeEvent.TabularFldChangeEventHandler;
|
||||
import org.gcube.portlets.user.dataminermanager.client.properties.ColumnItemPropertiesCombo;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.data.ColumnItem;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.data.TableItemSimple;
|
||||
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
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.Format;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.shared.ListStore;
|
||||
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;
|
||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||
|
||||
/**
|
||||
|
@ -25,9 +34,10 @@ import com.sencha.gxt.widget.core.client.form.ComboBox;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ColumnFld extends AbstractFld {
|
||||
public class ColumnFld extends AbstractFld implements
|
||||
TabularFldChangeEventHandler {
|
||||
|
||||
private VerticalLayoutContainer vp;
|
||||
//private VerticalLayoutContainer vp;
|
||||
|
||||
private String defaultColumn;
|
||||
|
||||
|
@ -35,17 +45,28 @@ public class ColumnFld extends AbstractFld {
|
|||
private ListStore<ColumnItem> store;
|
||||
private String referredTabularParameterName;
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
|
||||
private SimpleContainer vContainer;
|
||||
|
||||
/**
|
||||
* @param parameter
|
||||
*/
|
||||
public ColumnFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
vp = new VerticalLayoutContainer();
|
||||
|
||||
|
||||
ColumnParameter p = (ColumnParameter) parameter;
|
||||
this.referredTabularParameterName = p.getReferredTabularParameterName();
|
||||
this.defaultColumn = p.getDefaultColumn();
|
||||
|
||||
referredTabularParameterName = p.getReferredTabularParameterName();
|
||||
defaultColumn = p.getDefaultColumn();
|
||||
|
||||
fieldContainer = new SimpleContainer();
|
||||
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
|
||||
ColumnItemPropertiesCombo props = GWT
|
||||
.create(ColumnItemPropertiesCombo.class);
|
||||
|
||||
|
@ -56,18 +77,62 @@ public class ColumnFld extends AbstractFld {
|
|||
comboBox.setForceSelection(true);
|
||||
comboBox.setEditable(false);
|
||||
comboBox.setTriggerAction(TriggerAction.ALL);
|
||||
if (p.getDescription() != null)
|
||||
comboBox.setTitle(p.getDescription());
|
||||
comboBox.setEnabled(false);
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (p.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
comboBox.setToolTip(p.getDescription());
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
|
||||
+ p.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
|
||||
vContainer=new SimpleContainer();
|
||||
showNoSelectionField();
|
||||
horiz.add(vContainer, new BoxLayoutData(new Margins()));
|
||||
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
fieldContainer.forceLayout();
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void showNoSelectionField() {
|
||||
vContainer.clear();
|
||||
VerticalLayoutContainer vField = new VerticalLayoutContainer();
|
||||
HtmlLayoutContainer typeDescription= new HtmlLayoutContainer(
|
||||
"<div class='workflow-parameters-description'><p>Select table from parameter "
|
||||
+ Format.ellipse(referredTabularParameterName,30) + "</p></div>");
|
||||
typeDescription.setStylePrimaryName("workflow-parameters-description");
|
||||
vField.add(comboBox, new VerticalLayoutData(1,-1,new Margins(0)));
|
||||
vField.add(typeDescription, new VerticalLayoutData(-1,-1,new Margins(0)));
|
||||
vContainer.add(vField);
|
||||
}
|
||||
|
||||
private void showFieldWithSelection(TableItemSimple tableItem) {
|
||||
vContainer.clear();
|
||||
VerticalLayoutContainer vField = new VerticalLayoutContainer();
|
||||
HtmlLayoutContainer typeDescription= new HtmlLayoutContainer(
|
||||
"<div class='workflow-parameters-description'><p>Columns of Table "
|
||||
+ Format.ellipse(tableItem.getName(),30) + "</p></div>");
|
||||
typeDescription.setStylePrimaryName("workflow-parameters-description");
|
||||
vField.add(comboBox, new VerticalLayoutData(1,-1,new Margins(0)));
|
||||
vField.add(typeDescription, new VerticalLayoutData(-1,-1,new Margins(0)));
|
||||
vContainer.add(vField);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
||||
private void showNoSelectionField() {
|
||||
vp.clear();
|
||||
;
|
||||
vp.add(comboBox);
|
||||
vp.add(new HTML(
|
||||
"<div class='workflow-parameters-description'>Select table from parameter "
|
||||
|
@ -75,9 +140,6 @@ public class ColumnFld extends AbstractFld {
|
|||
vp.forceLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void showFieldWithSelection(TableItemSimple tableItem) {
|
||||
vp.clear();
|
||||
vp.add(comboBox);
|
||||
|
@ -85,7 +147,7 @@ public class ColumnFld extends AbstractFld {
|
|||
"<div class='workflow-parameters-description'>Columns of Table "
|
||||
+ tableItem.getName() + "</div>"));
|
||||
vp.forceLayout();
|
||||
}
|
||||
} */
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -101,23 +163,22 @@ public class ColumnFld extends AbstractFld {
|
|||
*/
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return vp;
|
||||
return fieldContainer;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void fireEvent(Object message) {
|
||||
if (message == null) {
|
||||
public void onChange(TabularFldChangeEvent event) {
|
||||
TableItemSimple tableItemSimple = event.getTableItemSimple();
|
||||
if (tableItemSimple == null) {
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
comboBox.clear();
|
||||
comboBox.setEnabled(false);
|
||||
showNoSelectionField();
|
||||
} else {
|
||||
TableItemSimple tableItem = (TableItemSimple) message;
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
ArrayList<ColumnItem> columns = tableItem.getColumns();
|
||||
ArrayList<ColumnItem> columns = tableItemSimple.getColumns();
|
||||
if (columns != null) {
|
||||
store.addAll(columns);
|
||||
for (ColumnItem columnItem : columns) {
|
||||
|
@ -130,8 +191,9 @@ public class ColumnFld extends AbstractFld {
|
|||
}
|
||||
comboBox.clear();
|
||||
comboBox.setEnabled(true);
|
||||
showFieldWithSelection(tableItem);
|
||||
showFieldWithSelection(tableItemSimple);
|
||||
}
|
||||
fieldContainer.forceLayout();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,6 +8,8 @@ import java.util.List;
|
|||
|
||||
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.ColumnListParameter;
|
||||
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.Parameter;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.TabularFldChangeEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.TabularFldChangeEvent.TabularFldChangeEventHandler;
|
||||
import org.gcube.portlets.user.dataminermanager.client.properties.ColumnItemProperties;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.data.ColumnItem;
|
||||
import org.gcube.portlets.user.dataminermanager.shared.data.TableItemSimple;
|
||||
|
@ -30,9 +32,9 @@ import com.sencha.gxt.widget.core.client.grid.Grid;
|
|||
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ColumnListFld extends AbstractFld {
|
||||
public class ColumnListFld extends AbstractFld implements
|
||||
TabularFldChangeEventHandler {
|
||||
|
||||
|
||||
private VerticalLayoutContainer vp;
|
||||
private ColumnListParameter columnListParameter;
|
||||
private ListStore<ColumnItem> store;
|
||||
|
@ -67,9 +69,9 @@ public class ColumnListFld extends AbstractFld {
|
|||
ColumnModel<ColumnItem> cm = new ColumnModel<ColumnItem>(l);
|
||||
|
||||
store = new ListStore<ColumnItem>(props.id());
|
||||
|
||||
|
||||
grid = new Grid<ColumnItem>(store, cm);
|
||||
|
||||
|
||||
sm.setSelectionMode(SelectionMode.MULTI);
|
||||
grid.setSelectionModel(sm);
|
||||
// grid.getView().setAutoExpandColumn(labelCol);
|
||||
|
@ -82,7 +84,7 @@ public class ColumnListFld extends AbstractFld {
|
|||
grid.setColumnReordering(true);
|
||||
grid.setColumnResize(false);
|
||||
grid.disable();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -110,7 +112,6 @@ public class ColumnListFld extends AbstractFld {
|
|||
vp.forceLayout();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -119,9 +120,9 @@ public class ColumnListFld extends AbstractFld {
|
|||
String separator = columnListParameter.getSeparator();
|
||||
String value = "";
|
||||
boolean first = true;
|
||||
|
||||
|
||||
for (ColumnItem columnItem : sm.getSelection()) {
|
||||
String columnName = columnItem.getName();
|
||||
String columnName = columnItem.getName();
|
||||
value += (first ? "" : separator) + columnName;
|
||||
first = false;
|
||||
}
|
||||
|
@ -136,26 +137,7 @@ public class ColumnListFld extends AbstractFld {
|
|||
return vp;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
public void fireEvent(Object message) {
|
||||
if (message == null) {
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
grid.disable();
|
||||
showNoSelectionField();
|
||||
} else {
|
||||
TableItemSimple tableItem = (TableItemSimple) message;
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
store.addAll(tableItem.getColumns());
|
||||
store.commitChanges();
|
||||
grid.enable();
|
||||
showFieldWithSelection(tableItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -165,4 +147,23 @@ public class ColumnListFld extends AbstractFld {
|
|||
return store.size() > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChange(TabularFldChangeEvent event) {
|
||||
TableItemSimple tableItemSimple = event.getTableItemSimple();
|
||||
if (tableItemSimple == null) {
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
grid.disable();
|
||||
showNoSelectionField();
|
||||
} else {
|
||||
store.clear();
|
||||
store.commitChanges();
|
||||
store.addAll(tableItemSimple.getColumns());
|
||||
store.commitChanges();
|
||||
grid.enable();
|
||||
showFieldWithSelection(tableItemSimple);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,6 +4,14 @@ import org.gcube.portlets.user.dataminermanager.client.bean.parameters.ObjectPar
|
|||
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.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;
|
||||
import com.sencha.gxt.widget.core.client.form.DoubleField;
|
||||
|
||||
/**
|
||||
|
@ -13,7 +21,8 @@ import com.sencha.gxt.widget.core.client.form.DoubleField;
|
|||
*
|
||||
*/
|
||||
public class DoubleFld extends AbstractFld {
|
||||
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
private DoubleField numberField;
|
||||
|
||||
/**
|
||||
|
@ -21,6 +30,10 @@ public class DoubleFld extends AbstractFld {
|
|||
*/
|
||||
public DoubleFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
fieldContainer=new SimpleContainer();
|
||||
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
ObjectParameter p = (ObjectParameter) parameter;
|
||||
|
||||
|
@ -28,10 +41,37 @@ public class DoubleFld extends AbstractFld {
|
|||
|
||||
if (p.getDefaultValue() != null)
|
||||
numberField.setValue(Double.parseDouble(p.getDefaultValue()));
|
||||
else
|
||||
numberField.setAllowBlank(false);
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (p.getDescription() != null)
|
||||
numberField.setTitle(p.getDescription());
|
||||
if (p.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
numberField.setToolTip(p.getDescription());
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
|
||||
+ p.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
|
||||
SimpleContainer vContainer=new SimpleContainer();
|
||||
VerticalLayoutContainer vField = new VerticalLayoutContainer();
|
||||
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer(
|
||||
"Double Value");
|
||||
typeDescription.setStylePrimaryName("workflow-parameters-description");
|
||||
vField.add(numberField, new VerticalLayoutData(1,-1,new Margins(0)));
|
||||
vField.add(typeDescription, new VerticalLayoutData(-1,-1,new Margins(0)));
|
||||
vContainer.add(vField);
|
||||
|
||||
horiz.add(vContainer, new BoxLayoutData(new Margins()));
|
||||
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
|
||||
fieldContainer.forceLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,7 +87,7 @@ public class DoubleFld extends AbstractFld {
|
|||
*/
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return numberField;
|
||||
return fieldContainer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,17 +8,24 @@ import org.gcube.portlets.user.dataminermanager.client.bean.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.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.BoxLayoutContainer.BoxLayoutData;
|
||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||
import com.sencha.gxt.widget.core.client.form.SimpleComboBox;
|
||||
|
||||
/**
|
||||
*
|
||||
* @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 EnumFld extends AbstractFld {
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
private SimpleComboBox<String> listBox;
|
||||
|
||||
/**
|
||||
|
@ -26,6 +33,10 @@ public class EnumFld extends AbstractFld {
|
|||
*/
|
||||
public EnumFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
fieldContainer = new SimpleContainer();
|
||||
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
EnumParameter p = (EnumParameter) parameter;
|
||||
|
||||
|
@ -35,11 +46,27 @@ public class EnumFld extends AbstractFld {
|
|||
listBox.setForceSelection(true);
|
||||
listBox.setEditable(false);
|
||||
listBox.setTriggerAction(TriggerAction.ALL);
|
||||
if (p.getDescription() != null)
|
||||
listBox.setTitle(p.getDescription());
|
||||
|
||||
if (p.getDefaultValue() != null)
|
||||
listBox.setValue(p.getDefaultValue());
|
||||
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (p.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
listBox.setToolTip(p.getDescription());
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
|
||||
+ p.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
horiz.add(listBox, new BoxLayoutData(new Margins()));
|
||||
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,14 @@ import org.gcube.portlets.user.dataminermanager.client.bean.parameters.ObjectPar
|
|||
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.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;
|
||||
import com.sencha.gxt.widget.core.client.form.FloatField;
|
||||
|
||||
/**
|
||||
|
@ -13,7 +21,8 @@ import com.sencha.gxt.widget.core.client.form.FloatField;
|
|||
*
|
||||
*/
|
||||
public class FloatFld extends AbstractFld {
|
||||
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
private FloatField numberField;
|
||||
|
||||
/**
|
||||
|
@ -21,17 +30,50 @@ public class FloatFld extends AbstractFld {
|
|||
*/
|
||||
public FloatFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
fieldContainer=new SimpleContainer();
|
||||
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
ObjectParameter p = (ObjectParameter) parameter;
|
||||
|
||||
|
||||
|
||||
numberField = new FloatField();
|
||||
|
||||
if (p.getDefaultValue() != null)
|
||||
numberField.setValue(Float.parseFloat(p.getDefaultValue()));
|
||||
else
|
||||
numberField.setAllowBlank(false);
|
||||
|
||||
|
||||
if (p.getDescription() != null)
|
||||
numberField.setTitle(p.getDescription());
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (p.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
numberField.setToolTip(p.getDescription());
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
|
||||
+ p.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
|
||||
SimpleContainer vContainer=new SimpleContainer();
|
||||
VerticalLayoutContainer vField = new VerticalLayoutContainer();
|
||||
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer(
|
||||
"Float Value");
|
||||
typeDescription.setStylePrimaryName("workflow-parameters-description");
|
||||
vField.add(numberField, new VerticalLayoutData(1,-1,new Margins(0)));
|
||||
vField.add(typeDescription, new VerticalLayoutData(-1,-1,new Margins(0)));
|
||||
vContainer.add(vField);
|
||||
|
||||
horiz.add(vContainer, new BoxLayoutData(new Margins()));
|
||||
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
fieldContainer.forceLayout();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,6 +90,6 @@ public class FloatFld extends AbstractFld {
|
|||
*/
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return numberField;
|
||||
return fieldContainer;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,42 +1,77 @@
|
|||
|
||||
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 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;
|
||||
import com.sencha.gxt.widget.core.client.form.IntegerField;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @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 IntFld extends AbstractFld {
|
||||
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
private IntegerField numberField;
|
||||
|
||||
|
||||
/**
|
||||
* @param operator
|
||||
*/
|
||||
public IntFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
fieldContainer = new SimpleContainer();
|
||||
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
ObjectParameter p = (ObjectParameter) parameter;
|
||||
|
||||
|
||||
numberField = new IntegerField();
|
||||
|
||||
if (p.getDefaultValue() != null)
|
||||
numberField.setValue(Integer.parseInt(p.getDefaultValue()));
|
||||
else
|
||||
numberField.setAllowBlank(false);
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (p.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
numberField.setToolTip(p.getDescription());
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
|
||||
+ p.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
|
||||
SimpleContainer vContainer=new SimpleContainer();
|
||||
VerticalLayoutContainer vField = new VerticalLayoutContainer();
|
||||
HtmlLayoutContainer typeDescription = new HtmlLayoutContainer(
|
||||
"Integer Value");
|
||||
typeDescription.setStylePrimaryName("workflow-parameters-description");
|
||||
vField.add(numberField, new VerticalLayoutData(1,-1,new Margins(0)));
|
||||
vField.add(typeDescription, new VerticalLayoutData(-1,-1,new Margins(0)));
|
||||
vContainer.add(vField);
|
||||
|
||||
horiz.add(vContainer, new BoxLayoutData(new Margins()));
|
||||
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
fieldContainer.forceLayout();
|
||||
|
||||
if (p.getDescription() != null)
|
||||
numberField.setTitle(p.getDescription());
|
||||
numberField.setAllowBlank(false);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -53,7 +88,7 @@ public class IntFld extends AbstractFld {
|
|||
*/
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return numberField;
|
||||
return fieldContainer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -11,36 +11,134 @@ import org.gcube.portlets.user.dataminermanager.client.bean.parameters.ListParam
|
|||
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.ObjectParameter;
|
||||
import org.gcube.portlets.user.dataminermanager.client.bean.parameters.Parameter;
|
||||
|
||||
import com.google.gwt.editor.client.Editor.Path;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sencha.gxt.core.client.ValueProvider;
|
||||
import com.sencha.gxt.core.client.util.Margins;
|
||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||
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 ceras
|
||||
*
|
||||
* @author Giancarlo Panichi
|
||||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class ListStringFld extends AbstractFld {
|
||||
|
||||
private List<Item> items;
|
||||
private SimpleContainer simpleContainer;
|
||||
|
||||
private SimpleContainer fieldContainer;
|
||||
private HBoxLayoutContainer horiz;
|
||||
private SimpleContainer listContainer;
|
||||
private VerticalLayoutContainer vp;
|
||||
private List<Item> items;
|
||||
private ListParameter listParameter;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param parameter
|
||||
*/
|
||||
public ListStringFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
this.listParameter = (ListParameter) parameter;
|
||||
simpleContainer = new SimpleContainer();
|
||||
|
||||
listParameter = (ListParameter) parameter;
|
||||
|
||||
listContainer = new SimpleContainer();
|
||||
vp = new VerticalLayoutContainer();
|
||||
simpleContainer.add(vp);
|
||||
items = new ArrayList<Item>();
|
||||
addField(null);
|
||||
listContainer.add(vp, new MarginData(new Margins()));
|
||||
|
||||
fieldContainer = new SimpleContainer();
|
||||
horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (listParameter.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
listContainer.setToolTip(listParameter.getDescription());
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
|
||||
+ listParameter.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
|
||||
horiz.add(listContainer, new BoxLayoutData(new Margins(0)));
|
||||
horiz.add(descr, new BoxLayoutData(new Margins(0)));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
fieldContainer.forceLayout();
|
||||
}
|
||||
|
||||
public interface ItemStringProperties extends PropertyAccess<ItemString> {
|
||||
|
||||
@Path("id")
|
||||
ModelKeyProvider<ItemString> id();
|
||||
ValueProvider<ItemString, String> label();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class ItemString{
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
private void gridDef(){
|
||||
ColumnConfig<Stock, String> nameCol = new ColumnConfig<Stock, String>(props.name(), 50, "Company");
|
||||
ColumnConfig<Stock, String> symbolCol = new ColumnConfig<Stock, String>(props.symbol(), 75, "Symbol");
|
||||
ColumnConfig<Stock, Double> lastCol = new ColumnConfig<Stock, Double>(props.last(), 75, "Last");
|
||||
ColumnConfig<Stock, Double> changeCol = new ColumnConfig<Stock, Double>(props.change(), 75, "Change");
|
||||
ColumnConfig<Stock, Date> lastTransCol = new ColumnConfig<Stock, Date>(props.lastTrans(), 100, "Last Updated");
|
||||
|
||||
final NumberFormat number = NumberFormat.getFormat("0.00");
|
||||
changeCol.setCell(new AbstractCell<Double>() {
|
||||
@Override
|
||||
public void render(Context context, Double value, SafeHtmlBuilder sb) {
|
||||
String style = "style='color: " + (value < 0 ? "red" : "green") + "'";
|
||||
String v = number.format(value);
|
||||
sb.appendHtmlConstant("<span " + style + ">" + v + "</span>");
|
||||
}
|
||||
});
|
||||
|
||||
lastTransCol.setCell(new DateCell(DateTimeFormat.getFormat("MM/dd/yyyy")));
|
||||
|
||||
List<ColumnConfig<Stock, ?>> columns = new ArrayList<ColumnConfig<Stock, ?>>();
|
||||
columns.add(nameCol);
|
||||
columns.add(symbolCol);
|
||||
columns.add(lastCol);
|
||||
columns.add(changeCol);
|
||||
columns.add(lastTransCol);
|
||||
|
||||
ColumnModel<Stock> cm = new ColumnModel<Stock>(columns);
|
||||
|
||||
ListStore<Stock> store = new ListStore<Stock>(props.key());
|
||||
store.addAll(TestData.getStocks());
|
||||
|
||||
final Grid<Stock> grid = new Grid<Stock>(store, cm);
|
||||
grid.setAllowTextSelection(true);
|
||||
grid.getView().setAutoExpandColumn(nameCol);
|
||||
grid.getView().setStripeRows(true);
|
||||
grid.getView().setColumnLines(true);
|
||||
grid.setBorders(false);
|
||||
grid.setColumnReordering(true);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
private void addField(Item upperItem) {
|
||||
|
||||
|
@ -50,7 +148,7 @@ public class ListStringFld extends AbstractFld {
|
|||
if (upperItem == null) {
|
||||
Item item = new Item(objPar, true);
|
||||
items.add(item);
|
||||
vp.add(item);
|
||||
vp.add(item, new VerticalLayoutData(1,-1, new Margins()));
|
||||
} else {
|
||||
// search the position of the upper item
|
||||
int pos = 0;
|
||||
|
@ -65,8 +163,7 @@ public class ListStringFld extends AbstractFld {
|
|||
items.add(pos + 1, item);
|
||||
vp.insert(item, pos + 1);
|
||||
}
|
||||
|
||||
simpleContainer.forceLayout();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,8 +177,8 @@ public class ListStringFld extends AbstractFld {
|
|||
if (items.size() == 1) {
|
||||
items.get(0).hideCancelButton();
|
||||
}
|
||||
|
||||
simpleContainer.forceLayout();
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -108,7 +205,7 @@ public class ListStringFld extends AbstractFld {
|
|||
*/
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return simpleContainer;
|
||||
return fieldContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,74 +215,88 @@ public class ListStringFld extends AbstractFld {
|
|||
public boolean isValid() {
|
||||
boolean valid = false;
|
||||
for (Item item : items)
|
||||
if (item.getField().getValue() != null) {
|
||||
if (item.isValid()) {
|
||||
valid = true;
|
||||
break;
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
||||
private class Item extends HorizontalLayoutContainer {
|
||||
private class Item extends HBoxLayoutContainer {
|
||||
|
||||
private StringFld field;
|
||||
private TextButton addButton;
|
||||
private TextButton removeButton;
|
||||
private TextField field;
|
||||
private TextButton addBtn;
|
||||
private TextButton removeBtn;
|
||||
|
||||
/**
|
||||
* @param objPar
|
||||
*/
|
||||
public Item(ObjectParameter objectParameter, boolean first) {
|
||||
super();
|
||||
this.field = new StringFld(objectParameter);
|
||||
this.add(field.getWidget());
|
||||
|
||||
field = new TextField();
|
||||
field.setAllowBlank(false);
|
||||
|
||||
addBtn = new TextButton("");
|
||||
|
||||
addButton = new TextButton("");
|
||||
addBtn.setIcon(DataMinerManager.resources.add());
|
||||
|
||||
addButton.setIcon(DataMinerManager.resources.add());
|
||||
|
||||
addButton.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
addBtn.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
addField(Item.this);
|
||||
forceLayout();
|
||||
vp.forceLayout();
|
||||
fieldContainer.forceLayout();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
removeButton = new TextButton("");
|
||||
removeBtn = new TextButton("");
|
||||
|
||||
removeButton.setIcon(DataMinerManager.resources.cancel());
|
||||
removeBtn.setIcon(DataMinerManager.resources.cancel());
|
||||
|
||||
removeButton.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
removeBtn.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
@Override
|
||||
public void onSelect(SelectEvent event) {
|
||||
removeField(Item.this);
|
||||
forceLayout();
|
||||
vp.forceLayout();
|
||||
fieldContainer.forceLayout();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
removeButton.setVisible(!first);
|
||||
|
||||
this.add(addButton);
|
||||
this.add(removeButton);
|
||||
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() {
|
||||
removeButton.setVisible(true);
|
||||
removeBtn.setVisible(true);
|
||||
}
|
||||
|
||||
public void hideCancelButton() {
|
||||
removeButton.setVisible(false);
|
||||
removeBtn.setVisible(false);
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return field.getValue();
|
||||
return field.getCurrentValue();
|
||||
}
|
||||
|
||||
public boolean isValid(){
|
||||
return field.isValid();
|
||||
}
|
||||
|
||||
public StringFld getField() {
|
||||
return field;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,13 +8,11 @@ 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.core.client.util.Padding;
|
||||
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.HorizontalLayoutContainer;
|
||||
import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer.HorizontalLayoutData;
|
||||
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.form.TextField;
|
||||
|
||||
|
@ -26,8 +24,7 @@ import com.sencha.gxt.widget.core.client.form.TextField;
|
|||
*/
|
||||
public class StringFld extends AbstractFld {
|
||||
|
||||
private SimpleContainer simpleContainer;
|
||||
private HorizontalLayoutContainer horiz;
|
||||
private SimpleContainer fieldContainer;
|
||||
private TextField textField;
|
||||
|
||||
/**
|
||||
|
@ -35,11 +32,7 @@ public class StringFld extends AbstractFld {
|
|||
*/
|
||||
public StringFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
simpleContainer=new SimpleContainer();
|
||||
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
|
||||
ObjectParameter p = (ObjectParameter) parameter;
|
||||
|
||||
textField = new TextField();
|
||||
|
@ -60,12 +53,16 @@ public class StringFld extends AbstractFld {
|
|||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
|
||||
fieldContainer=new SimpleContainer();
|
||||
HBoxLayoutContainer horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
horiz.add(textField,new BoxLayoutData(new Margins()));
|
||||
horiz.add(descr,new BoxLayoutData(new Margins()));
|
||||
|
||||
/*horiz.add(textField, new HorizontalLayoutData(-1,-1,new Margins()));
|
||||
horiz.add(descr,new HorizontalLayoutData(1,-1,new Margins()));*/
|
||||
simpleContainer.add(horiz);
|
||||
fieldContainer.add(horiz,new MarginData(new Margins()));
|
||||
|
||||
fieldContainer.forceLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -81,7 +78,7 @@ public class StringFld extends AbstractFld {
|
|||
*/
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return simpleContainer;
|
||||
return fieldContainer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,6 +10,9 @@ import java.util.List;
|
|||
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.TabularParameter;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.TabularFldChangeEvent;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.TabularFldChangeEvent.HasTabularFldChangeEventHandler;
|
||||
import org.gcube.portlets.user.dataminermanager.client.events.TabularFldChangeEvent.TabularFldChangeEventHandler;
|
||||
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;
|
||||
|
@ -20,17 +23,23 @@ 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.event.shared.GwtEvent;
|
||||
import com.google.gwt.event.shared.HandlerRegistration;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.gwt.user.client.ui.Widget;
|
||||
import com.sencha.gxt.core.client.dom.XDOM;
|
||||
import com.sencha.gxt.core.client.util.Format;
|
||||
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.event.SelectEvent;
|
||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -38,17 +47,17 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
|||
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||
*
|
||||
*/
|
||||
public class TabularFld extends AbstractFld {
|
||||
public class TabularFld extends AbstractFld implements HasTabularFldChangeEventHandler {
|
||||
|
||||
private SimpleContainer sc;
|
||||
private SimpleContainer fieldContainer;
|
||||
private HBoxLayoutContainer horiz;
|
||||
private VerticalLayoutContainer vp;
|
||||
|
||||
// TableSelector tableSelector;
|
||||
private WorkspaceExplorerSelectDialog wselectDialog;
|
||||
private TextButton selectButton, selectButton2, cancelButton;
|
||||
private HTML templatesList;
|
||||
private HtmlLayoutContainer templatesList;
|
||||
private TableItemSimple selectedTableItem = null;
|
||||
private List<AbstractFld> listeners = new ArrayList<AbstractFld>();
|
||||
//private List<AbstractFld> listeners = new ArrayList<AbstractFld>();
|
||||
|
||||
/**
|
||||
* @param parameter
|
||||
|
@ -56,11 +65,36 @@ public class TabularFld extends AbstractFld {
|
|||
public TabularFld(Parameter parameter) {
|
||||
super(parameter);
|
||||
Log.debug("TabularField");
|
||||
|
||||
SimpleContainer tabContainer=new SimpleContainer();
|
||||
vp=new VerticalLayoutContainer();
|
||||
init();
|
||||
sc=new SimpleContainer();
|
||||
sc.add(vp, new MarginData(0));
|
||||
tabContainer.add(vp, new MarginData(new Margins(0)));
|
||||
|
||||
fieldContainer = new SimpleContainer();
|
||||
horiz = new HBoxLayoutContainer();
|
||||
horiz.setPack(BoxLayoutPack.START);
|
||||
horiz.setEnableOverflow(false);
|
||||
|
||||
HtmlLayoutContainer descr;
|
||||
|
||||
if (parameter.getDescription() == null) {
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'></p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
|
||||
} else {
|
||||
tabContainer.setToolTip(parameter.getDescription());
|
||||
descr = new HtmlLayoutContainer("<p style='margin-left:5px;'>"
|
||||
+ parameter.getDescription() + "</p>");
|
||||
descr.addStyleName("workflow-fieldDescription");
|
||||
}
|
||||
|
||||
horiz.add(tabContainer, new BoxLayoutData(new Margins()));
|
||||
horiz.add(descr, new BoxLayoutData(new Margins()));
|
||||
|
||||
fieldContainer.add(horiz);
|
||||
showNoSelectionField();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -68,17 +102,6 @@ public class TabularFld extends AbstractFld {
|
|||
TabularParameter p = (TabularParameter) parameter;
|
||||
List<String> templates = p.getTemplates();
|
||||
|
||||
/*
|
||||
* tableSelector = new TableSelector(templates) {
|
||||
*
|
||||
* @Override public void fireSelection(TableItemSimple tableItem) {
|
||||
* super.fireSelection(tableItem); selectedTableItem = tableItem;
|
||||
* showFieldWithSelection();
|
||||
*
|
||||
* loadTableMetadata(tableItem); // send change message to all listeners
|
||||
* // it will be managed by all columnFields and columnListField that
|
||||
* depends by tabular field } };
|
||||
*/
|
||||
List<ItemType> selectableTypes = new ArrayList<ItemType>();
|
||||
selectableTypes.add(ItemType.EXTERNAL_FILE);
|
||||
List<ItemType> showableTypes = new ArrayList<ItemType>();
|
||||
|
@ -183,11 +206,11 @@ public class TabularFld extends AbstractFld {
|
|||
String list = "";
|
||||
boolean first = true;
|
||||
for (String template : templates) {
|
||||
list += (first ? "" : ", ") + template;
|
||||
list += (first ? "" : ", ") + Format.ellipse(template,50);
|
||||
first = false;
|
||||
}
|
||||
templatesList = new HTML("Suitable Data Set Templates: <br>" + list);
|
||||
templatesList.addStyleName("workflow-templatesList");
|
||||
templatesList = new HtmlLayoutContainer("<p>Suitable Data Set Templates: <br>" + list+"</p>");
|
||||
templatesList.addStyleName("workflow-parameters-description");
|
||||
|
||||
|
||||
}
|
||||
|
@ -200,7 +223,6 @@ public class TabularFld extends AbstractFld {
|
|||
Log.error("Error in retrieveTableInformation " + caught.getMessage());
|
||||
if (caught instanceof ExpiredSessionServiceException) {
|
||||
UtilsGXT3.alert("Error", "Expired Session");
|
||||
//sessionExpiredShowDelayed();
|
||||
|
||||
} else {
|
||||
UtilsGXT3.alert(
|
||||
|
@ -216,54 +238,14 @@ public class TabularFld extends AbstractFld {
|
|||
Log.debug("Retrieved: "+result);
|
||||
selectedTableItem=result;
|
||||
showFieldWithSelection();
|
||||
//loadTableMetadata(selectedTableItem);
|
||||
updateListeners(selectedTableItem);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tableItem
|
||||
|
||||
protected void loadTableMetadata(final TableItemSimple tableItem) {
|
||||
//TabularData tabularData = DataMinerManager.getTabularData();
|
||||
String tableId = tableItem.getId();
|
||||
|
||||
tabularData.getTableDefinition(tableId,
|
||||
new AsyncCallback<TableDefinition>() {
|
||||
|
||||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
vp.unmask();
|
||||
Info.display("ERROR", "");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(TableDefinition tableDefinition) {
|
||||
vp.unmask();
|
||||
List<ColumnDefinition> columns = tableDefinition
|
||||
.getColumnsAsList();
|
||||
Collections.sort(columns, new ColumnPositionComparator(
|
||||
false));
|
||||
for (ColumnDefinition column : columns)
|
||||
tableItem.addColumnName(column.getLabel());
|
||||
updateListeners(tableItem);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
vp.mask("Load Data Set Metadata...", Constants.maskLoadingStyle);
|
||||
}*/
|
||||
|
||||
/**
|
||||
* @param id
|
||||
*/
|
||||
protected void updateListeners(TableItemSimple tableItem) {
|
||||
for (AbstractFld abstractField : listeners) {
|
||||
abstractField.fireEvent(tableItem);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -271,23 +253,26 @@ public class TabularFld extends AbstractFld {
|
|||
vp.clear();
|
||||
vp.add(selectButton);
|
||||
vp.add(templatesList);
|
||||
sc.forceLayout();
|
||||
fieldContainer.forceLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private void showFieldWithSelection() {
|
||||
//final String tableId = selectedTableItem.getId();
|
||||
final String tableName = selectedTableItem.getName();
|
||||
|
||||
vp.clear();
|
||||
HorizontalLayoutContainer hp = new HorizontalLayoutContainer();
|
||||
hp.add(new HTML("<div class='workflow-parameters-tableDescription'>"
|
||||
+ Format.ellipse(tableName, 30) + "</div>"));
|
||||
hp.add(selectButton2);
|
||||
hp.add(cancelButton);
|
||||
String tableName = selectedTableItem.getName();
|
||||
|
||||
if(tableName==null|| tableName.isEmpty()){
|
||||
tableName="NoName";
|
||||
}
|
||||
|
||||
TextField tableDescription=new TextField();
|
||||
tableDescription.setValue(tableName);
|
||||
tableDescription.setReadOnly(true);
|
||||
|
||||
/*HTML tableDescription=new HTML("<div class='workflow-parameters-tableDescription'>"
|
||||
+ Format.ellipse(tableName, 30) + "</div>");*/
|
||||
|
||||
TextButton openTableButton = new TextButton("Open Data Set");
|
||||
openTableButton.addSelectHandler(new SelectEvent.SelectHandler() {
|
||||
|
||||
|
@ -319,10 +304,16 @@ public class TabularFld extends AbstractFld {
|
|||
}
|
||||
});
|
||||
|
||||
hp.add(openTableButton);
|
||||
vp.add(hp);
|
||||
|
||||
HBoxLayoutContainer h=new HBoxLayoutContainer();
|
||||
h.add(tableDescription,new BoxLayoutData(new Margins()));
|
||||
h.add(selectButton2,new BoxLayoutData(new Margins()));
|
||||
h.add(cancelButton,new BoxLayoutData(new Margins()));
|
||||
vp.clear();
|
||||
vp.add(h);
|
||||
vp.add(templatesList);
|
||||
sc.forceLayout();
|
||||
vp.forceLayout();
|
||||
fieldContainer.forceLayout();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -338,7 +329,7 @@ public class TabularFld extends AbstractFld {
|
|||
*/
|
||||
@Override
|
||||
public Widget getWidget() {
|
||||
return sc;
|
||||
return fieldContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -349,7 +340,25 @@ public class TabularFld extends AbstractFld {
|
|||
return (selectedTableItem != null);
|
||||
}
|
||||
|
||||
public void addChangeListener(AbstractFld abstractField) {
|
||||
this.listeners.add(abstractField);
|
||||
|
||||
|
||||
@Override
|
||||
public HandlerRegistration addTabularFldChangeEventHandler(
|
||||
TabularFldChangeEventHandler handler) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -296,9 +296,9 @@
|
|||
|
||||
.workflow-parameters-preload {
|
||||
display: block;
|
||||
margin: auto;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
background: url('ajax-loader-big.gif') no-repeat;
|
||||
width: 400px;
|
||||
height: 180px;
|
||||
}
|
||||
|
||||
/* TOOLTIP */
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue