81: Allow the creation and use of expressions on multi column in TDM portlet
Task-Url: https://support.d4science.org/issues/81 Updated apply rule on table git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-rule-widget@115087 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
58e85407cb
commit
5958104137
|
@ -17,6 +17,7 @@ import org.gcube.portlets.user.td.rulewidget.client.multicolumn.data.MapPlaceHol
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnData;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ import com.sencha.gxt.widget.core.client.form.FormPanel;
|
||||||
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
||||||
import com.sencha.gxt.widget.core.client.grid.Grid;
|
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.Grid.GridCell;
|
||||||
import com.sencha.gxt.widget.core.client.grid.GridSelectionModel;
|
import com.sencha.gxt.widget.core.client.grid.GridSelectionModel;
|
||||||
import com.sencha.gxt.widget.core.client.grid.editing.GridRowEditing;
|
import com.sencha.gxt.widget.core.client.grid.editing.GridRowEditing;
|
||||||
|
|
||||||
|
@ -66,6 +68,7 @@ public class RuleOnTableApplyMapColumnCard extends WizardCard {
|
||||||
private ListStore<MapPlaceHolderToColumnRow> store;
|
private ListStore<MapPlaceHolderToColumnRow> store;
|
||||||
private ArrayList<MapPlaceHolderToColumnRow> rows;
|
private ArrayList<MapPlaceHolderToColumnRow> rows;
|
||||||
private ArrayList<ColumnData> columns;
|
private ArrayList<ColumnData> columns;
|
||||||
|
private ListStore<ColumnData> storeComboColumnData;
|
||||||
|
|
||||||
public RuleOnTableApplyMapColumnCard(
|
public RuleOnTableApplyMapColumnCard(
|
||||||
ApplyTableRuleSession applyTableRuleSession) {
|
ApplyTableRuleSession applyTableRuleSession) {
|
||||||
|
@ -177,9 +180,9 @@ public class RuleOnTableApplyMapColumnCard extends WizardCard {
|
||||||
ColumnDataPropertiesCombo columnDataPropertiesCombo = GWT
|
ColumnDataPropertiesCombo columnDataPropertiesCombo = GWT
|
||||||
.create(ColumnDataPropertiesCombo.class);
|
.create(ColumnDataPropertiesCombo.class);
|
||||||
|
|
||||||
ListStore<ColumnData> storeComboColumnData = new ListStore<ColumnData>(
|
storeComboColumnData = new ListStore<ColumnData>(
|
||||||
columnDataPropertiesCombo.id());
|
columnDataPropertiesCombo.id());
|
||||||
storeComboColumnData.addAll(columns);
|
|
||||||
|
|
||||||
ComboBox<ColumnData> comboColumnData = new ComboBox<ColumnData>(
|
ComboBox<ColumnData> comboColumnData = new ComboBox<ColumnData>(
|
||||||
storeComboColumnData, columnDataPropertiesCombo.label());
|
storeComboColumnData, columnDataPropertiesCombo.label());
|
||||||
|
@ -198,6 +201,25 @@ public class RuleOnTableApplyMapColumnCard extends WizardCard {
|
||||||
public void onBeforeStartEdit(
|
public void onBeforeStartEdit(
|
||||||
BeforeStartEditEvent<MapPlaceHolderToColumnRow> event) {
|
BeforeStartEditEvent<MapPlaceHolderToColumnRow> event) {
|
||||||
setEnableNextButton(false);
|
setEnableNextButton(false);
|
||||||
|
GridCell cell=event.getEditCell();
|
||||||
|
int rowIndex=cell.getRow();
|
||||||
|
MapPlaceHolderToColumnRow row=store.get(rowIndex);
|
||||||
|
RuleColumnPlaceHolderDescriptor descriptor=row.getRuleColumnPlaceHolderDescriptor();
|
||||||
|
ColumnDataType columnDataType=descriptor.getColumnDataType();
|
||||||
|
ArrayList<ColumnData> usableColumns=new ArrayList<ColumnData>();
|
||||||
|
for(ColumnData column:columns){
|
||||||
|
ColumnDataType cdt=ColumnDataType.getColumnDataTypeFromId(column.getDataTypeName());
|
||||||
|
if(column.getDataTypeName()!=null && cdt.compareTo(columnDataType)==0){
|
||||||
|
usableColumns.add(column);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
storeComboColumnData.clear();
|
||||||
|
storeComboColumnData.commitChanges();
|
||||||
|
storeComboColumnData.addAll(usableColumns);
|
||||||
|
storeComboColumnData.commitChanges();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -207,7 +229,7 @@ public class RuleOnTableApplyMapColumnCard extends WizardCard {
|
||||||
public void onCancelEdit(
|
public void onCancelEdit(
|
||||||
CancelEditEvent<MapPlaceHolderToColumnRow> event) {
|
CancelEditEvent<MapPlaceHolderToColumnRow> event) {
|
||||||
store.rejectChanges();
|
store.rejectChanges();
|
||||||
setEnableNextButton(true);
|
checkAllFill();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,6 +243,26 @@ public class RuleOnTableApplyMapColumnCard extends WizardCard {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
store.commitChanges();
|
store.commitChanges();
|
||||||
|
checkAllFill();
|
||||||
|
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.error("Error in RuleOnTableNewDefinitionCard: "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
//
|
||||||
|
v.add(grid, new VerticalLayoutData(1, 1, new Margins(0)));
|
||||||
|
|
||||||
|
forceLayout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void checkAllFill() {
|
||||||
boolean fillAll = true;
|
boolean fillAll = true;
|
||||||
for (MapPlaceHolderToColumnRow row : store.getAll()) {
|
for (MapPlaceHolderToColumnRow row : store.getAll()) {
|
||||||
if (row.getColumn() == null) {
|
if (row.getColumn() == null) {
|
||||||
|
@ -234,21 +276,8 @@ public class RuleOnTableApplyMapColumnCard extends WizardCard {
|
||||||
} else {
|
} else {
|
||||||
setEnableNextButton(false);
|
setEnableNextButton(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Log.error("Error in RuleOnTableNewDefinitionCard: "
|
|
||||||
+ e.getLocalizedMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//
|
|
||||||
v.add(grid, new VerticalLayoutData(1, 1, new Margins(0)));
|
|
||||||
|
|
||||||
forceLayout();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void retrieveColumns() {
|
protected void retrieveColumns() {
|
||||||
TDGWTServiceAsync.INSTANCE.getColumns(applyTableRuleSession.getTrId(),
|
TDGWTServiceAsync.INSTANCE.getColumns(applyTableRuleSession.getTrId(),
|
||||||
|
|
|
@ -7,17 +7,12 @@ import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceA
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDataProperties;
|
import org.gcube.portlets.user.td.expressionwidget.shared.rule.RuleDescriptionDataProperties;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyTableRuleSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.rule.ApplyTableRuleSession;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleColumnPlaceHolderDescriptor;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType;
|
import org.gcube.portlets.user.td.gwtservice.shared.rule.RuleScopeType;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
|
import org.gcube.portlets.user.td.gwtservice.shared.rule.description.RuleDescriptionData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleTableType;
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.rule.type.TDRuleType;
|
|
||||||
import org.gcube.portlets.user.td.rulewidget.client.RuleInfoDialog;
|
import org.gcube.portlets.user.td.rulewidget.client.RuleInfoDialog;
|
||||||
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
|
import org.gcube.portlets.user.td.rulewidget.client.resources.ResourceBundle;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
import org.gcube.portlets.user.td.wizardwidget.client.util.UtilsGXT3;
|
||||||
|
|
||||||
|
@ -381,9 +376,10 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//TODO
|
|
||||||
//ruleDescriptionData = getSelectedItem();
|
ruleDescriptionData = getSelectedItem();
|
||||||
ArrayList<RuleColumnPlaceHolderDescriptor> ruleColumnPlaceHolderDescriptors=new ArrayList<RuleColumnPlaceHolderDescriptor>();
|
//TODO x Test
|
||||||
|
/*ArrayList<RuleColumnPlaceHolderDescriptor> ruleColumnPlaceHolderDescriptors=new ArrayList<RuleColumnPlaceHolderDescriptor>();
|
||||||
RuleColumnPlaceHolderDescriptor r1=new RuleColumnPlaceHolderDescriptor("Test1", "Test1", ColumnDataType.Text);
|
RuleColumnPlaceHolderDescriptor r1=new RuleColumnPlaceHolderDescriptor("Test1", "Test1", ColumnDataType.Text);
|
||||||
RuleColumnPlaceHolderDescriptor r2=new RuleColumnPlaceHolderDescriptor("Test2", "Test2", ColumnDataType.Integer);
|
RuleColumnPlaceHolderDescriptor r2=new RuleColumnPlaceHolderDescriptor("Test2", "Test2", ColumnDataType.Integer);
|
||||||
ruleColumnPlaceHolderDescriptors.add(r1);
|
ruleColumnPlaceHolderDescriptors.add(r1);
|
||||||
|
@ -392,7 +388,7 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard {
|
||||||
|
|
||||||
ruleDescriptionData =new RuleDescriptionData(1, "Test", "Test Description", "2015-01-01 18:45", null, null, RuleScopeType.TABLE, new C_Expression(),
|
ruleDescriptionData =new RuleDescriptionData(1, "Test", "Test Description", "2015-01-01 18:45", null, null, RuleScopeType.TABLE, new C_Expression(),
|
||||||
tdRuleType);
|
tdRuleType);
|
||||||
|
*/
|
||||||
if (ruleDescriptionData == null) {
|
if (ruleDescriptionData == null) {
|
||||||
AlertMessageBox d = new AlertMessageBox("Attention",
|
AlertMessageBox d = new AlertMessageBox("Attention",
|
||||||
"Select one rule!");
|
"Select one rule!");
|
||||||
|
|
Loading…
Reference in New Issue