81: TDM - Allow the creation and use of expressions on multi column in TDM portlet

Task-Url: https://support.d4science.org/issues/81

Updated Rules On Table

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-rule-widget@115309 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-06-10 16:35:38 +00:00 committed by Giancarlo Panichi
parent 40412cd2e2
commit 801f78e551
9 changed files with 52 additions and 43 deletions

View File

@ -67,9 +67,10 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
private ArrayList<ColumnData> columns; private ArrayList<ColumnData> columns;
private AppliedRulesResponseData appliedRuleResponseData; private AppliedRulesResponseData appliedRuleResponseData;
private VerticalLayoutContainer mainLayoutContainer; private VerticalLayoutContainer mainLayoutContainer;
public RuleActiveOnColumnPanel(TRId trId, EventBus eventBus) { public RuleActiveOnColumnPanel(TRId trId, EventBus eventBus) {
super(); super();
this.trId = trId; this.trId = trId;
@ -132,11 +133,11 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
protected void create() { protected void create() {
Log.debug("Create RuleActiveOnColumnPanel(): " + trId); Log.debug("Create RuleActiveOnColumnPanel(): " + trId);
VerticalLayoutContainer columnRulesFieldSetLayout = new VerticalLayoutContainer(); mainLayoutContainer = new VerticalLayoutContainer();
columnRulesFieldSetLayout.setScrollMode(ScrollMode.AUTO); mainLayoutContainer.setScrollMode(ScrollMode.AUTO);
columnRulesFieldSetLayout.setAdjustForScroll(true); mainLayoutContainer.setAdjustForScroll(true);
add(columnRulesFieldSetLayout); add(mainLayoutContainer);
HashMap<String, ArrayList<RuleDescriptionData>> columnRuleMapping = appliedRuleResponseData HashMap<String, ArrayList<RuleDescriptionData>> columnRuleMapping = appliedRuleResponseData
.getColumnRuleMapping(); .getColumnRuleMapping();
@ -148,7 +149,7 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
if (columnAppliedRules != null && columnAppliedRules.size() > 0) { if (columnAppliedRules != null && columnAppliedRules.size() > 0) {
FieldLabel columnLabel = createColumnRules(column, FieldLabel columnLabel = createColumnRules(column,
columnAppliedRules); columnAppliedRules);
columnRulesFieldSetLayout.add(columnLabel, mainLayoutContainer.add(columnLabel,
new VerticalLayoutData(1, -1, new Margins(0))); new VerticalLayoutData(1, -1, new Margins(0)));
} }
} }
@ -156,7 +157,7 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
FieldLabel noRulesLabel = new FieldLabel(null, "No rules on column applied!"); FieldLabel noRulesLabel = new FieldLabel(null, "No rules on column applied!");
noRulesLabel.setLabelSeparator(""); noRulesLabel.setLabelSeparator("");
noRulesLabel.setLabelWidth(200); noRulesLabel.setLabelWidth(200);
columnRulesFieldSetLayout.add(noRulesLabel, new VerticalLayoutData( mainLayoutContainer.add(noRulesLabel, new VerticalLayoutData(
1, -1, new Margins(0))); 1, -1, new Margins(0)));
} }
@ -210,7 +211,7 @@ public class RuleActiveOnColumnPanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>(
propsRules.creationDate(), 50, "Creation Date"); propsRules.creationDate(), 56, "Creation Date");
creationDateCol.setCell(new AbstractCell<String>() { creationDateCol.setCell(new AbstractCell<String>() {

View File

@ -60,8 +60,10 @@ public class RuleActiveOnTablePanel extends FramedPanel {
private TRId trId; private TRId trId;
private AppliedRulesResponseData appliedRuleResponseData; private AppliedRulesResponseData appliedRuleResponseData;
private Grid<RuleDescriptionData> gridAppliedRules;
private ListStore<RuleDescriptionData> storeAppliedRules;
private VerticalLayoutContainer mainLayoutContainer; private VerticalLayoutContainer mainLayoutContainer;
public RuleActiveOnTablePanel(TRId trId, EventBus eventBus) { public RuleActiveOnTablePanel(TRId trId, EventBus eventBus) {
super(); super();
this.trId = trId; this.trId = trId;
@ -79,9 +81,9 @@ public class RuleActiveOnTablePanel extends FramedPanel {
protected void create() { protected void create() {
Log.debug("Create RuleActiveOnTablePanel(): " + trId); Log.debug("Create RuleActiveOnTablePanel(): " + trId);
VerticalLayoutContainer v = new VerticalLayoutContainer(); mainLayoutContainer = new VerticalLayoutContainer();
v.setScrollMode(ScrollMode.AUTO); mainLayoutContainer.setScrollMode(ScrollMode.AUTO);
v.setAdjustForScroll(true); mainLayoutContainer.setAdjustForScroll(true);
ArrayList<RuleDescriptionData> appliedTableRules=appliedRuleResponseData.getTableRules(); ArrayList<RuleDescriptionData> appliedTableRules=appliedRuleResponseData.getTableRules();
@ -89,9 +91,9 @@ public class RuleActiveOnTablePanel extends FramedPanel {
FieldLabel noRulesLabel = new FieldLabel(null, "No rules on table applied!"); FieldLabel noRulesLabel = new FieldLabel(null, "No rules on table applied!");
noRulesLabel.setLabelSeparator(""); noRulesLabel.setLabelSeparator("");
noRulesLabel.setLabelWidth(200); noRulesLabel.setLabelWidth(200);
v.add(noRulesLabel, new VerticalLayoutData( mainLayoutContainer.add(noRulesLabel, new VerticalLayoutData(
1, -1, new Margins(0))); 1, -1, new Margins(0)));
add(v); add(mainLayoutContainer);
return; return;
} }
@ -138,7 +140,7 @@ public class RuleActiveOnTablePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>(
propsRules.creationDate(), 50, "Creation Date"); propsRules.creationDate(), 56, "Creation Date");
creationDateCol.setCell(new AbstractCell<String>() { creationDateCol.setCell(new AbstractCell<String>() {
@ -165,15 +167,15 @@ public class RuleActiveOnTablePanel extends FramedPanel {
propsRules.description()); propsRules.description());
// Applies Rules // Applies Rules
ListStore<RuleDescriptionData> appliedRulesStore = new ListStore<RuleDescriptionData>( storeAppliedRules = new ListStore<RuleDescriptionData>(
propsRules.id()); propsRules.id());
appliedRulesStore.addAll(appliedTableRules); storeAppliedRules.addAll(appliedTableRules);
final Grid<RuleDescriptionData> gridAppliedRules = new Grid<RuleDescriptionData>( gridAppliedRules = new Grid<RuleDescriptionData>(
appliedRulesStore, cm); storeAppliedRules, cm);
//gridAppliedRules.setHeight(RULES_GRID_HEIGHT); //gridAppliedRules.setHeight(RULES_GRID_HEIGHT);
gridAppliedRules.getView().setStripeRows(true); gridAppliedRules.getView().setStripeRows(true);
gridAppliedRules.getView().setColumnLines(true); gridAppliedRules.getView().setColumnLines(true);
@ -192,9 +194,9 @@ public class RuleActiveOnTablePanel extends FramedPanel {
createContextMenu(gridAppliedRules); createContextMenu(gridAppliedRules);
v.add(gridAppliedRules, new VerticalLayoutData( mainLayoutContainer.add(gridAppliedRules, new VerticalLayoutData(
1, 1, new Margins(0))); 1, 1, new Margins(0)));
add(v); add(mainLayoutContainer);
return; return;
} }

View File

@ -6,7 +6,6 @@ import java.util.List;
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
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.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.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;
@ -166,7 +165,7 @@ public class RuleDeletePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>(
props.creationDate(), 50, "Creation Date"); props.creationDate(), 56, "Creation Date");
creationDateCol.setCell(new AbstractCell<String>() { creationDateCol.setCell(new AbstractCell<String>() {
@ -316,7 +315,7 @@ public class RuleDeletePanel extends FramedPanel {
protected void loadData(ListLoadConfig loadConfig, protected void loadData(ListLoadConfig loadConfig,
final AsyncCallback<ListLoadResult<RuleDescriptionData>> callback) { final AsyncCallback<ListLoadResult<RuleDescriptionData>> callback) {
ExpressionServiceAsync.INSTANCE.getRules(RuleScopeType.COLUMN, ExpressionServiceAsync.INSTANCE.getRules(
new AsyncCallback<ArrayList<RuleDescriptionData>>() { new AsyncCallback<ArrayList<RuleDescriptionData>>() {
@Override @Override

View File

@ -31,17 +31,17 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public class RuleApplyDialog extends Window implements public class RuleOnColumnApplyDialog extends Window implements
MonitorDialogListener { MonitorDialogListener {
private static final String WIDTH = "770px"; private static final String WIDTH = "780px";
private static final String HEIGHT = "530px"; private static final String HEIGHT = "530px";
private EventBus eventBus; private EventBus eventBus;
public RuleApplyDialog(TRId trId, EventBus eventBus) { public RuleOnColumnApplyDialog(TRId trId, EventBus eventBus) {
this.eventBus = eventBus; this.eventBus = eventBus;
initWindow(); initWindow();
RuleApplyPanel ruleApplyPanel = new RuleApplyPanel(this, RuleOnColumnApplyPanel ruleApplyPanel = new RuleOnColumnApplyPanel(this,
trId, eventBus); trId, eventBus);
add(ruleApplyPanel); add(ruleApplyPanel);
} }

View File

@ -68,8 +68,8 @@ import com.sencha.gxt.widget.core.client.menu.MenuItem;
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public class RuleApplyPanel extends FramedPanel { public class RuleOnColumnApplyPanel extends FramedPanel {
private static final String WIDTH = "760px"; private static final String WIDTH = "770px";
private static final String HEIGHT = "520px"; private static final String HEIGHT = "520px";
private static final String RULE_TIP = "<p>Tip.: Use drag and drop in order to change selected rules.</p>"; private static final String RULE_TIP = "<p>Tip.: Use drag and drop in order to change selected rules.</p>";
private static final String RULES_GRID_HEIGHT = "184px"; private static final String RULES_GRID_HEIGHT = "184px";
@ -81,7 +81,7 @@ public class RuleApplyPanel extends FramedPanel {
} }
private EventBus eventBus; private EventBus eventBus;
private RuleApplyDialog parent; private RuleOnColumnApplyDialog parent;
private TRId trId; private TRId trId;
private ArrayList<ColumnData> columns; private ArrayList<ColumnData> columns;
private ColumnData column; private ColumnData column;
@ -98,12 +98,12 @@ public class RuleApplyPanel extends FramedPanel {
private ListStore<RuleDescriptionData> selectedRulesStore; private ListStore<RuleDescriptionData> selectedRulesStore;
private Grid<RuleDescriptionData> gridSelectedRules; private Grid<RuleDescriptionData> gridSelectedRules;
public RuleApplyPanel(RuleApplyDialog parent, TRId trId, EventBus eventBus) { public RuleOnColumnApplyPanel(RuleOnColumnApplyDialog parent, TRId trId, EventBus eventBus) {
this.parent = parent; this.parent = parent;
this.trId = trId; this.trId = trId;
applicableRules = new ArrayList<RuleDescriptionData>(); applicableRules = new ArrayList<RuleDescriptionData>();
Log.debug("RuleApplyPanel"); Log.debug("RuleOnColumnApplyPanel");
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setHeaderVisible(false); setHeaderVisible(false);
@ -237,7 +237,7 @@ public class RuleApplyPanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>(
propsRules.creationDate(), 50, "Creation Date"); propsRules.creationDate(), 56, "Creation Date");
creationDateCol.setCell(new AbstractCell<String>() { creationDateCol.setCell(new AbstractCell<String>() {

View File

@ -6,7 +6,6 @@ import java.util.List;
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
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.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.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;
@ -172,7 +171,7 @@ public class RuleOpenPanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>(
props.creationDate(), 50, "Creation Date"); props.creationDate(), 56, "Creation Date");
creationDateCol.setCell(new AbstractCell<String>() { creationDateCol.setCell(new AbstractCell<String>() {
@ -321,7 +320,7 @@ public class RuleOpenPanel extends FramedPanel {
protected void loadData(ListLoadConfig loadConfig, protected void loadData(ListLoadConfig loadConfig,
final AsyncCallback<ListLoadResult<RuleDescriptionData>> callback) { final AsyncCallback<ListLoadResult<RuleDescriptionData>> callback) {
ExpressionServiceAsync.INSTANCE.getRules(RuleScopeType.COLUMN, ExpressionServiceAsync.INSTANCE.getRules(
new AsyncCallback<ArrayList<RuleDescriptionData>>() { new AsyncCallback<ArrayList<RuleDescriptionData>>() {
@Override @Override

View File

@ -6,7 +6,6 @@ import java.util.List;
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync; import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
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.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.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;
@ -172,7 +171,7 @@ public class RuleSharePanel extends FramedPanel {
}); });
ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>(
props.creationDate(), 50, "Creation Date"); props.creationDate(), 56, "Creation Date");
creationDateCol.setCell(new AbstractCell<String>() { creationDateCol.setCell(new AbstractCell<String>() {
@ -323,7 +322,7 @@ public class RuleSharePanel extends FramedPanel {
protected void loadData(ListLoadConfig loadConfig, protected void loadData(ListLoadConfig loadConfig,
final AsyncCallback<ListLoadResult<RuleDescriptionData>> callback) { final AsyncCallback<ListLoadResult<RuleDescriptionData>> callback) {
ExpressionServiceAsync.INSTANCE.getRules(RuleScopeType.COLUMN, ExpressionServiceAsync.INSTANCE.getRules(
new AsyncCallback<ArrayList<RuleDescriptionData>>() { new AsyncCallback<ArrayList<RuleDescriptionData>>() {
@Override @Override

View File

@ -1,6 +1,7 @@
package org.gcube.portlets.user.td.rulewidget.client.multicolumn; package org.gcube.portlets.user.td.rulewidget.client.multicolumn;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import org.gcube.portlets.user.td.expressionwidget.client.properties.ColumnDataPropertiesCombo; import org.gcube.portlets.user.td.expressionwidget.client.properties.ColumnDataPropertiesCombo;
import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3; import org.gcube.portlets.user.td.expressionwidget.client.utils.UtilsGXT3;
@ -376,13 +377,21 @@ public class RuleOnTableApplyMapColumnCard extends WizardCard {
if (store == null || store.size() <= 0) { if (store == null || store.size() <= 0) {
AlertMessageBox d = new AlertMessageBox("Attention", AlertMessageBox d = new AlertMessageBox("Attention",
"Add at least one column"); "Error no mapping for this table Rule!");
d.addHideHandler(hideHandler); d.addHideHandler(hideHandler);
d.setModal(false); d.setModal(false);
d.show(); d.show();
return; return;
} }
HashMap<String, String> placeHolderToColumnMap=new HashMap<String,String>();
for(MapPlaceHolderToColumnRow m: store.getAll()){
placeHolderToColumnMap.put(m.getRuleColumnPlaceHolderDescriptor().getId(),
m.getColumn().getColumnId());
}
applyTableRuleSession.setPlaceHolderToColumnMap(placeHolderToColumnMap);
goNext(); goNext();
} }

View File

@ -178,7 +178,7 @@ public class RuleOnTableApplySelectRuleCard extends WizardCard {
}); });
ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>( ColumnConfig<RuleDescriptionData, String> creationDateCol = new ColumnConfig<RuleDescriptionData, String>(
props.creationDate(), 50, "Creation Date"); props.creationDate(), 56, "Creation Date");
creationDateCol.setCell(new AbstractCell<String>() { creationDateCol.setCell(new AbstractCell<String>() {