81: Allow the creation and use of expressions on multi column in TDM portlet
Task-Url: https://support.d4science.org/issues/81 Updated MultiColumnExpressionPanel git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@114888 82a268e6-3cf1-43bd-a215-b396298e98cf
|
@ -508,14 +508,14 @@ public class ColumnExpressionPanel extends FramedPanel {
|
||||||
Log.debug("ConditionWidget" + conditionWidget);
|
Log.debug("ConditionWidget" + conditionWidget);
|
||||||
conditionsField.add(conditionWidget);
|
conditionsField.add(conditionWidget);
|
||||||
|
|
||||||
btnApply = new TextButton("Apply");
|
btnApply = new TextButton("Add");
|
||||||
btnApply.setIcon(ExpressionResources.INSTANCE.apply());
|
btnApply.setIcon(ExpressionResources.INSTANCE.ruleColumnAdd());
|
||||||
btnApply.setIconAlign(IconAlign.RIGHT);
|
btnApply.setIconAlign(IconAlign.RIGHT);
|
||||||
btnApply.setToolTip("Apply rule");
|
btnApply.setToolTip("Add");
|
||||||
btnApply.addSelectHandler(new SelectHandler() {
|
btnApply.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
Log.debug("Pressed Apply");
|
Log.debug("Pressed Add");
|
||||||
applySeleceted();
|
applySeleceted();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,38 +3,32 @@ package org.gcube.portlets.user.td.expressionwidget.client;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.client.exception.MultiColumnExpressionPanelException;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.expression.ConditionOnMultiColumnWidget;
|
import org.gcube.portlets.user.td.expressionwidget.client.expression.ConditionOnMultiColumnWidget;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.notification.ExpressionWrapperNotification;
|
import org.gcube.portlets.user.td.expressionwidget.client.notification.ExpressionWrapperNotification;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.properties.ColumnDataTypeProperties;
|
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources;
|
import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.store.ColumnDataTypeElement;
|
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.store.ColumnDataTypeStore;
|
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ConditionTypeMapException;
|
import org.gcube.portlets.user.td.expressionwidget.shared.exception.ConditionTypeMapException;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_Not;
|
import org.gcube.portlets.user.td.expressionwidget.shared.model.logical.C_Not;
|
||||||
|
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.gwtservice.shared.rule.type.TDRuleType;
|
||||||
import org.gcube.portlets.user.td.monitorwidget.client.utils.UtilsGXT3;
|
import org.gcube.portlets.user.td.monitorwidget.client.utils.UtilsGXT3;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.expression.C_ExpressionContainer;
|
import org.gcube.portlets.user.td.widgetcommonevent.client.expression.C_ExpressionContainer;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.expression.ExpressionWrapper;
|
import org.gcube.portlets.user.td.widgetcommonevent.client.expression.ExpressionWrapper;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.expression.C_Expression;
|
||||||
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.ColumnMockUp;
|
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
import com.google.gwt.core.client.GWT;
|
|
||||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||||
import com.google.gwt.i18n.client.DateTimeFormat;
|
import com.google.gwt.i18n.client.DateTimeFormat;
|
||||||
import com.google.gwt.user.client.ui.HTML;
|
import com.google.gwt.user.client.ui.HTML;
|
||||||
import com.google.web.bindery.event.shared.EventBus;
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||||
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
|
|
||||||
import com.sencha.gxt.core.client.util.Margins;
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
import com.sencha.gxt.data.shared.LabelProvider;
|
|
||||||
import com.sencha.gxt.data.shared.ListStore;
|
|
||||||
import com.sencha.gxt.widget.core.client.FramedPanel;
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
import com.sencha.gxt.widget.core.client.button.TextButton;
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||||
|
@ -50,7 +44,7 @@ import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||||
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||||
import com.sencha.gxt.widget.core.client.form.TextArea;
|
import com.sencha.gxt.widget.core.client.form.TextArea;
|
||||||
import com.sencha.gxt.widget.core.client.form.TextField;
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
import com.sencha.gxt.widget.core.client.info.Info;
|
import com.sencha.gxt.widget.core.client.form.validator.EmptyValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -61,18 +55,21 @@ import com.sencha.gxt.widget.core.client.info.Info;
|
||||||
public class MultiColumnExpressionPanel extends FramedPanel {
|
public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
private static final String WIDTH = "929px";
|
private static final String WIDTH = "929px";
|
||||||
private static final String HEIGHT = "352px";
|
private static final String HEIGHT = "352px";
|
||||||
private static final String ROW_DELETE_BY_EXPRESSION_HEIGHT = "388px";
|
private static final String ROWS_DELETE_HEIGHT = "388px";
|
||||||
|
private static final String RULE_HEIGHT= "312px";
|
||||||
|
|
||||||
|
private static final String RULE_MULTI_CONDITION_WIDTH = "890px";
|
||||||
|
private static final String RULE_MULTI_CONDITION_HEIGHT = "228px";
|
||||||
|
|
||||||
|
|
||||||
private static final String RULE_DESCRIPTION_HEIGHT = "44px";
|
private static final String RULE_DESCRIPTION_HEIGHT = "44px";
|
||||||
private static final String RULE_PLACE_HOLDER_ID = "Column";
|
|
||||||
|
|
||||||
private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm");
|
private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm");
|
||||||
|
|
||||||
private enum MultiColumnExpressionPanelType {
|
private enum MultiColumnExpressionPanelType {
|
||||||
ColumnFilter, RowDeleteByExpression, Template, RuleOnTable;
|
ColumnFilter, RowDeleteByExpression, Template, RuleOnTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private MultiColumnExpressionPanelType type;
|
private MultiColumnExpressionPanelType type;
|
||||||
|
|
||||||
private TemplateMultiColumnExpressionDialog parentTemplateDialog;
|
private TemplateMultiColumnExpressionDialog parentTemplateDialog;
|
||||||
|
@ -95,14 +92,6 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
private TextField ruleName;
|
private TextField ruleName;
|
||||||
private TextArea ruleDescription;
|
private TextArea ruleDescription;
|
||||||
|
|
||||||
private ComboBox<ColumnDataTypeElement> comboDataType;
|
|
||||||
|
|
||||||
private FieldLabel comboDataTypeLabel;
|
|
||||||
//private RuleDescriptionData ruleDescriptionData;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param parent
|
* @param parent
|
||||||
|
@ -130,10 +119,10 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
*/
|
*/
|
||||||
public MultiColumnExpressionPanel(
|
public MultiColumnExpressionPanel(
|
||||||
RowsDeleteByMultiColumnExpressionDialog parent,
|
RowsDeleteByMultiColumnExpressionDialog parent,
|
||||||
ArrayList<ColumnData> columns, EventBus eventBus) {
|
ArrayList<ColumnData> columns, EventBus eventBus) {
|
||||||
super();
|
super();
|
||||||
setWidth(WIDTH);
|
setWidth(WIDTH);
|
||||||
setHeight(ROW_DELETE_BY_EXPRESSION_HEIGHT);
|
setHeight(ROWS_DELETE_HEIGHT);
|
||||||
type = MultiColumnExpressionPanelType.RowDeleteByExpression;
|
type = MultiColumnExpressionPanelType.RowDeleteByExpression;
|
||||||
this.parentRowsDeleteByExpressionDialog = parent;
|
this.parentRowsDeleteByExpressionDialog = parent;
|
||||||
this.columns = columns;
|
this.columns = columns;
|
||||||
|
@ -163,86 +152,151 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
* @param parent
|
* @param parent
|
||||||
* @param eventBus
|
* @param eventBus
|
||||||
*/
|
*/
|
||||||
public MultiColumnExpressionPanel(RuleOnTableCreateDialog parent, RuleDescriptionData initialRuleDescriptionData, EventBus eventBus) {
|
public MultiColumnExpressionPanel(RuleOnTableCreateDialog parent,
|
||||||
|
RuleDescriptionData initialRuleDescriptionData)
|
||||||
|
throws MultiColumnExpressionPanelException {
|
||||||
super();
|
super();
|
||||||
|
Log.debug("MultiColumnExpressionPanel");
|
||||||
setWidth(WIDTH);
|
setWidth(WIDTH);
|
||||||
setHeight(HEIGHT);
|
setHeight(RULE_HEIGHT);
|
||||||
type = MultiColumnExpressionPanelType.RuleOnTable;
|
type = MultiColumnExpressionPanelType.RuleOnTable;
|
||||||
this.parentRuleOnTableCreateDialog = parent;
|
this.parentRuleOnTableCreateDialog = parent;
|
||||||
this.initialRuleDescriptionData=initialRuleDescriptionData;
|
this.initialRuleDescriptionData = initialRuleDescriptionData;
|
||||||
this.columns = null;
|
retrieveColumns();
|
||||||
createOnRule();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
protected void retrieveColumns() throws MultiColumnExpressionPanelException {
|
||||||
protected void createOnRule() {
|
|
||||||
forceLayoutOnResize = true;
|
|
||||||
|
|
||||||
setBodyBorder(false);
|
|
||||||
setHeaderVisible(false);
|
|
||||||
|
|
||||||
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
|
|
||||||
basicLayout.setAdjustForScroll(true);
|
|
||||||
|
|
||||||
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
|
||||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
|
||||||
flowButton.setPack(BoxLayoutPack.CENTER);
|
|
||||||
|
|
||||||
conditionsField = new FieldSet();
|
|
||||||
conditionsField.setHeadingText("Conditions");
|
|
||||||
conditionsField.setCollapsible(false);
|
|
||||||
|
|
||||||
conditionWidget = new ConditionOnMultiColumnWidget(columns);
|
|
||||||
conditionsField.add(conditionWidget);
|
|
||||||
|
|
||||||
btnApply = new TextButton("Save");
|
|
||||||
btnApply.setIcon(ExpressionResources.INSTANCE.ruleColumnAdd());
|
|
||||||
btnApply.setIconAlign(IconAlign.RIGHT);
|
|
||||||
btnApply.setToolTip("Save rule");
|
|
||||||
btnApply.addSelectHandler(new SelectHandler() {
|
|
||||||
|
|
||||||
public void onSelect(SelectEvent event) {
|
|
||||||
Log.debug("Pressed Save");
|
|
||||||
applySeleceted();
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
btnClose = new TextButton("Close");
|
|
||||||
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
|
||||||
btnClose.setIconAlign(IconAlign.RIGHT);
|
|
||||||
btnClose.setToolTip("Cancel rule");
|
|
||||||
btnClose.addSelectHandler(new SelectHandler() {
|
|
||||||
|
|
||||||
public void onSelect(SelectEvent event) {
|
|
||||||
Log.debug("Pressed Close");
|
|
||||||
close();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
|
||||||
|
|
||||||
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
|
||||||
|
|
||||||
basicLayout.add(conditionsField, new VerticalLayoutData(1, -1,
|
|
||||||
new Margins(1)));
|
|
||||||
basicLayout.add(flowButton, new VerticalLayoutData(1, 36, new Margins(
|
|
||||||
5, 2, 5, 2)));
|
|
||||||
add(basicLayout);
|
|
||||||
|
|
||||||
if (initialRuleDescriptionData == null) {
|
if (initialRuleDescriptionData == null) {
|
||||||
conditionWidget.disable();
|
Log.error("No rules description data present!");
|
||||||
} else {
|
throw new MultiColumnExpressionPanelException(
|
||||||
updateCondition();
|
"No rules description data present!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TDRuleType tdRuleType = initialRuleDescriptionData.getTdRuleType();
|
||||||
|
if (tdRuleType == null) {
|
||||||
|
Log.error("No Rule Type present!");
|
||||||
|
throw new MultiColumnExpressionPanelException(
|
||||||
|
"No Rule Type present!");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tdRuleType instanceof TDRuleTableType) {
|
||||||
|
TDRuleTableType tdRuleTableType = (TDRuleTableType) tdRuleType;
|
||||||
|
ArrayList<RuleColumnPlaceHolderDescriptor> listDescriptors = tdRuleTableType
|
||||||
|
.getRuleColumnPlaceHolderDescriptors();
|
||||||
|
columns = new ArrayList<ColumnData>();
|
||||||
|
for (RuleColumnPlaceHolderDescriptor ruleColumnPlaceHolderDescriptor : listDescriptors) {
|
||||||
|
ColumnData col = new ColumnData();
|
||||||
|
col.setId(ruleColumnPlaceHolderDescriptor.getId());
|
||||||
|
col.setColumnId(ruleColumnPlaceHolderDescriptor.getLabel());
|
||||||
|
col.setLabel(ruleColumnPlaceHolderDescriptor.getLabel());
|
||||||
|
col.setDataTypeName(ruleColumnPlaceHolderDescriptor
|
||||||
|
.getColumnDataType().getId());
|
||||||
|
columns.add(col);
|
||||||
|
}
|
||||||
|
|
||||||
|
createOnRule();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Log.error("No Table Rule Type present!");
|
||||||
|
throw new MultiColumnExpressionPanelException(
|
||||||
|
"No Table Rule Type present!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void createOnRule() throws MultiColumnExpressionPanelException {
|
||||||
|
try {
|
||||||
@SuppressWarnings("unused")
|
forceLayoutOnResize = true;
|
||||||
private void createColumnMockUp(VerticalLayoutContainer propertiesLayout) {
|
|
||||||
|
setBodyBorder(false);
|
||||||
|
setHeaderVisible(false);
|
||||||
|
|
||||||
|
VerticalLayoutContainer basicLayout = new VerticalLayoutContainer();
|
||||||
|
basicLayout.setAdjustForScroll(true);
|
||||||
|
|
||||||
|
FieldSet propertiesField = new FieldSet();
|
||||||
|
propertiesField.setHeadingText("Properties");
|
||||||
|
propertiesField.setCollapsible(false);
|
||||||
|
|
||||||
|
VerticalLayoutContainer propertiesLayout = new VerticalLayoutContainer();
|
||||||
|
createRuleOnTableDecription(propertiesLayout);
|
||||||
|
propertiesField.add(propertiesLayout);
|
||||||
|
|
||||||
|
conditionsField = new FieldSet();
|
||||||
|
conditionsField.setHeadingText("Conditions");
|
||||||
|
conditionsField.setCollapsible(false);
|
||||||
|
|
||||||
|
conditionWidget = new ConditionOnMultiColumnWidget(columns,RULE_MULTI_CONDITION_WIDTH,RULE_MULTI_CONDITION_HEIGHT);
|
||||||
|
conditionsField.add(conditionWidget);
|
||||||
|
|
||||||
|
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||||
|
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
|
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||||
|
|
||||||
|
btnApply = new TextButton("Save");
|
||||||
|
btnApply.setIcon(ExpressionResources.INSTANCE.ruleColumnAdd());
|
||||||
|
btnApply.setIconAlign(IconAlign.RIGHT);
|
||||||
|
btnApply.setToolTip("Save rule");
|
||||||
|
btnApply.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
Log.debug("Pressed Save");
|
||||||
|
applySeleceted();
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
btnClose = new TextButton("Close");
|
||||||
|
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
||||||
|
btnClose.setIconAlign(IconAlign.RIGHT);
|
||||||
|
btnClose.setToolTip("Cancel rule");
|
||||||
|
btnClose.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
Log.debug("Pressed Close");
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
flowButton
|
||||||
|
.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
|
|
||||||
|
flowButton
|
||||||
|
.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
|
|
||||||
|
basicLayout.add(propertiesField, new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(1)));
|
||||||
|
|
||||||
|
basicLayout.add(conditionsField, new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(1)));
|
||||||
|
|
||||||
|
if (parentRuleOnTableCreateDialog != null) {
|
||||||
|
basicLayout.add(flowButton, new VerticalLayoutData(1, 36,
|
||||||
|
new Margins(5, 2, 5, 2)));
|
||||||
|
}
|
||||||
|
add(basicLayout);
|
||||||
|
|
||||||
|
if (initialRuleDescriptionData == null) {
|
||||||
|
conditionWidget.disable();
|
||||||
|
} else {
|
||||||
|
if (initialRuleDescriptionData.getExpression() == null) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
Log.debug("Error in createOnRule(): "+e.getLocalizedMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createRuleOnTableDecription(
|
||||||
|
VerticalLayoutContainer propertiesLayout) {
|
||||||
ruleName = new TextField();
|
ruleName = new TextField();
|
||||||
|
ruleName.addValidator(new EmptyValidator<String>());
|
||||||
ruleName.setToolTip("Rule Name");
|
ruleName.setToolTip("Rule Name");
|
||||||
if (initialRuleDescriptionData != null) {
|
if (initialRuleDescriptionData != null) {
|
||||||
ruleName.setValue(initialRuleDescriptionData.getName());
|
ruleName.setValue(initialRuleDescriptionData.getName());
|
||||||
|
@ -250,6 +304,7 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
FieldLabel ruleNameLabel = new FieldLabel(ruleName, "Rule Name");
|
FieldLabel ruleNameLabel = new FieldLabel(ruleName, "Rule Name");
|
||||||
|
|
||||||
ruleDescription = new TextArea();
|
ruleDescription = new TextArea();
|
||||||
|
ruleDescription.addValidator(new EmptyValidator<String>());
|
||||||
ruleDescription.setHeight(RULE_DESCRIPTION_HEIGHT);
|
ruleDescription.setHeight(RULE_DESCRIPTION_HEIGHT);
|
||||||
ruleDescription.setToolTip("Rule Description");
|
ruleDescription.setToolTip("Rule Description");
|
||||||
if (initialRuleDescriptionData != null) {
|
if (initialRuleDescriptionData != null) {
|
||||||
|
@ -259,193 +314,38 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
FieldLabel ruleDescriptionLabel = new FieldLabel(ruleDescription,
|
FieldLabel ruleDescriptionLabel = new FieldLabel(ruleDescription,
|
||||||
"Rule Description");
|
"Rule Description");
|
||||||
|
|
||||||
|
|
||||||
// comboDataType
|
|
||||||
ColumnDataTypeProperties propsDataType = GWT
|
|
||||||
.create(ColumnDataTypeProperties.class);
|
|
||||||
ListStore<ColumnDataTypeElement> storeComboDataType = new ListStore<ColumnDataTypeElement>(
|
|
||||||
propsDataType.id());
|
|
||||||
storeComboDataType.addAll(ColumnDataTypeStore.getAttributeType());
|
|
||||||
|
|
||||||
comboDataType = new ComboBox<ColumnDataTypeElement>(
|
|
||||||
storeComboDataType, propsDataType.label());
|
|
||||||
Log.trace("ComboDataType created");
|
|
||||||
|
|
||||||
addHandlersForComboAttributeType(propsDataType.label());
|
|
||||||
|
|
||||||
comboDataType.setEmptyText("Select a column type...");
|
|
||||||
comboDataType.setWidth(191);
|
|
||||||
comboDataType.setTypeAhead(true);
|
|
||||||
comboDataType.setTriggerAction(TriggerAction.ALL);
|
|
||||||
|
|
||||||
if (initialRuleDescriptionData != null) {
|
|
||||||
Log.debug("Initial RuleDescriptionData: "
|
|
||||||
+ initialRuleDescriptionData);
|
|
||||||
ColumnDataType cdt = retrieveColumnDataType();
|
|
||||||
if (cdt != null) {
|
|
||||||
Log.debug("Retrieved column data type: " + cdt);
|
|
||||||
ColumnDataTypeElement cdte = ColumnDataTypeStore
|
|
||||||
.selectedAttributeElement(cdt);
|
|
||||||
if (cdte != null) {
|
|
||||||
comboDataType.setValue(cdte);
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.debug("Retrieved column data type null");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
comboDataTypeLabel = new FieldLabel(comboDataType,
|
|
||||||
"Data Type");
|
|
||||||
|
|
||||||
propertiesLayout.add(ruleNameLabel, new VerticalLayoutData(1, -1,
|
propertiesLayout.add(ruleNameLabel, new VerticalLayoutData(1, -1,
|
||||||
new Margins(0)));
|
new Margins(0)));
|
||||||
propertiesLayout.add(ruleDescriptionLabel, new VerticalLayoutData(1,
|
propertiesLayout.add(ruleDescriptionLabel, new VerticalLayoutData(1,
|
||||||
-1, new Margins(0)));
|
-1, new Margins(0)));
|
||||||
|
|
||||||
propertiesLayout.add(comboDataTypeLabel, new VerticalLayoutData(1,
|
|
||||||
-1, new Margins(0)));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ColumnDataType retrieveColumnDataType() {
|
protected RuleDescriptionData retrieveRuleDescriptionData(C_Expression exp)
|
||||||
TDRuleType tdRuleTableType = initialRuleDescriptionData
|
throws MultiColumnExpressionPanelException {
|
||||||
.getTdRuleType();
|
if (ruleName.validate()) {
|
||||||
|
if (ruleDescription.validate()) {
|
||||||
return null;
|
if (exp != null) {
|
||||||
|
String ruleNameS = ruleName.getCurrentValue();
|
||||||
}
|
String ruleDescriptionS = ruleDescription.getCurrentValue();
|
||||||
|
RuleDescriptionData ruleDescriptionData = new RuleDescriptionData(
|
||||||
|
0, ruleNameS, ruleDescriptionS,
|
||||||
protected void addHandlersForComboAttributeType(
|
sdf.format(new Date()), null, null,
|
||||||
final LabelProvider<ColumnDataTypeElement> labelProvider) {
|
RuleScopeType.TABLE, exp,
|
||||||
comboDataType
|
initialRuleDescriptionData.getTdRuleType());
|
||||||
.addSelectionHandler(new SelectionHandler<ColumnDataTypeElement>() {
|
return ruleDescriptionData;
|
||||||
public void onSelection(
|
|
||||||
SelectionEvent<ColumnDataTypeElement> event) {
|
|
||||||
Info.display(
|
|
||||||
"Attribute Type Selected",
|
|
||||||
"You selected "
|
|
||||||
+ (event.getSelectedItem() == null ? "nothing"
|
|
||||||
: labelProvider.getLabel(event
|
|
||||||
.getSelectedItem())
|
|
||||||
+ "!"));
|
|
||||||
Log.debug("ComboAttributeType selected: "
|
|
||||||
+ event.getSelectedItem());
|
|
||||||
ColumnDataTypeElement attributeType = event
|
|
||||||
.getSelectedItem();
|
|
||||||
updateDataType(attributeType.getType());
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected void updateCondition() {
|
|
||||||
ColumnMockUp columnMockUp = retrieveColumnMockUp();
|
|
||||||
if (columnMockUp != null) {
|
|
||||||
column = new ColumnData();
|
|
||||||
column.setId(columnMockUp.getId());
|
|
||||||
column.setColumnId(columnMockUp.getColumnId());
|
|
||||||
column.setLabel(columnMockUp.getLabel());
|
|
||||||
column.setDataTypeName(columnMockUp.getColumnDataType().toString());
|
|
||||||
conditionWidget.update(columns);
|
|
||||||
conditionWidget.enable();
|
|
||||||
} else {
|
|
||||||
conditionWidget.disable();
|
|
||||||
}
|
|
||||||
forceLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected ColumnMockUp retrieveColumnMockUp() {
|
|
||||||
ColumnMockUp columnMockUp = null;
|
|
||||||
|
|
||||||
ColumnDataTypeElement columnDataTypeElement = comboDataType
|
|
||||||
.getCurrentValue();
|
|
||||||
if (columnDataTypeElement != null) {
|
|
||||||
ColumnDataType dataType = columnDataTypeElement.getType();
|
|
||||||
if (dataType != null) {
|
|
||||||
columnMockUp = new ColumnMockUp(null, RULE_PLACE_HOLDER_ID,
|
|
||||||
dataType, RULE_PLACE_HOLDER_ID);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return columnMockUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected ColumnMockUp checkEnterData() {
|
|
||||||
ColumnMockUp columnMockUp = null;
|
|
||||||
|
|
||||||
String ruleNameS = ruleName.getCurrentValue();
|
|
||||||
|
|
||||||
if (ruleNameS != null && !ruleNameS.isEmpty()) {
|
|
||||||
|
|
||||||
String ruleDescriptionS = ruleDescription.getCurrentValue();
|
|
||||||
|
|
||||||
if (ruleDescriptionS != null && !ruleDescriptionS.isEmpty()) {
|
|
||||||
ColumnDataTypeElement columnDataTypeElement = comboDataType
|
|
||||||
.getCurrentValue();
|
|
||||||
if (columnDataTypeElement != null) {
|
|
||||||
ColumnDataType dataType = columnDataTypeElement.getType();
|
|
||||||
if (dataType != null) {
|
|
||||||
columnMockUp = new ColumnMockUp(null,
|
|
||||||
RULE_PLACE_HOLDER_ID, dataType,
|
|
||||||
RULE_PLACE_HOLDER_ID);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
UtilsGXT3.alert("Attention",
|
|
||||||
"Column data type not selected!");
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
UtilsGXT3.alert("Attention",
|
throw new MultiColumnExpressionPanelException(
|
||||||
"Column data type not selected!");
|
"Enter a valid condition!");
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
UtilsGXT3.alert("Attention",
|
throw new MultiColumnExpressionPanelException(
|
||||||
"Enter a valid description for the rule!");
|
"Enter a valid description for the rule!");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
UtilsGXT3.alert("Attention", "Enter a valid name for the rule!");
|
throw new MultiColumnExpressionPanelException(
|
||||||
|
"Enter a valid name for the rule!");
|
||||||
}
|
}
|
||||||
return columnMockUp;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected RuleDescriptionData retrieveRuleDescriptionData(C_Expression exp) {
|
|
||||||
ColumnMockUp columnMockUp = checkEnterData();
|
|
||||||
if (columnMockUp != null) {
|
|
||||||
if (exp != null) {
|
|
||||||
String ruleNameS = ruleName.getCurrentValue();
|
|
||||||
String ruleDescriptionS = ruleDescription.getCurrentValue();
|
|
||||||
//TODO
|
|
||||||
RuleDescriptionData ruleDescriptionData = new RuleDescriptionData(
|
|
||||||
0, ruleNameS, ruleDescriptionS, sdf.format(new Date()), null, null,
|
|
||||||
RuleScopeType.TABLE, exp,initialRuleDescriptionData.getTdRuleType());
|
|
||||||
return ruleDescriptionData;
|
|
||||||
} else {
|
|
||||||
UtilsGXT3.alert("Attention", "Enter a valid condition!");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected void updateDataType(ColumnDataType type) {
|
|
||||||
Log.debug("Update ColumnDataType: " + type);
|
|
||||||
updateCondition();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -464,7 +364,6 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
flowButton.setPack(BoxLayoutPack.CENTER);
|
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||||
|
|
||||||
|
|
||||||
conditionsField = new FieldSet();
|
conditionsField = new FieldSet();
|
||||||
conditionsField.setHeadingText("Conditions");
|
conditionsField.setHeadingText("Conditions");
|
||||||
conditionsField.setCollapsible(false);
|
conditionsField.setCollapsible(false);
|
||||||
|
@ -473,14 +372,14 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
Log.debug("ConditionWidget" + conditionWidget);
|
Log.debug("ConditionWidget" + conditionWidget);
|
||||||
conditionsField.add(conditionWidget);
|
conditionsField.add(conditionWidget);
|
||||||
|
|
||||||
btnApply = new TextButton("Apply");
|
btnApply = new TextButton("Add");
|
||||||
btnApply.setIcon(ExpressionResources.INSTANCE.apply());
|
btnApply.setIcon(ExpressionResources.INSTANCE.ruleTableAdd());
|
||||||
btnApply.setIconAlign(IconAlign.RIGHT);
|
btnApply.setIconAlign(IconAlign.RIGHT);
|
||||||
btnApply.setToolTip("Apply rule");
|
btnApply.setToolTip("Add rule");
|
||||||
btnApply.addSelectHandler(new SelectHandler() {
|
btnApply.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
Log.debug("Pressed Apply");
|
Log.debug("Pressed Add");
|
||||||
applySeleceted();
|
applySeleceted();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -489,7 +388,7 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
btnClose = new TextButton("Close");
|
btnClose = new TextButton("Close");
|
||||||
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
||||||
btnClose.setIconAlign(IconAlign.RIGHT);
|
btnClose.setIconAlign(IconAlign.RIGHT);
|
||||||
btnClose.setToolTip("Cancel rule");
|
btnClose.setToolTip("Close");
|
||||||
btnClose.addSelectHandler(new SelectHandler() {
|
btnClose.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
public void onSelect(SelectEvent event) {
|
public void onSelect(SelectEvent event) {
|
||||||
|
@ -522,7 +421,7 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
flowButton.setPack(BoxLayoutPack.CENTER);
|
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||||
|
|
||||||
conditionsField = new FieldSet();
|
conditionsField = new FieldSet();
|
||||||
conditionsField.setHeadingText("Conditions");
|
conditionsField.setHeadingText("Conditions");
|
||||||
conditionsField.setCollapsible(false);
|
conditionsField.setCollapsible(false);
|
||||||
|
@ -557,7 +456,6 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
|
|
||||||
|
|
||||||
basicLayout.add(conditionsField, new VerticalLayoutData(1, -1,
|
basicLayout.add(conditionsField, new VerticalLayoutData(1, -1,
|
||||||
new Margins(1)));
|
new Margins(1)));
|
||||||
basicLayout.add(flowButton, new VerticalLayoutData(1, 36, new Margins(
|
basicLayout.add(flowButton, new VerticalLayoutData(1, 36, new Margins(
|
||||||
|
@ -579,7 +477,7 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||||
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
flowButton.setPack(BoxLayoutPack.CENTER);
|
flowButton.setPack(BoxLayoutPack.CENTER);
|
||||||
|
|
||||||
conditionsField = new FieldSet();
|
conditionsField = new FieldSet();
|
||||||
conditionsField.setHeadingText("Conditions");
|
conditionsField.setHeadingText("Conditions");
|
||||||
conditionsField.setCollapsible(false);
|
conditionsField.setCollapsible(false);
|
||||||
|
@ -588,7 +486,6 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
Log.debug("ConditionWidget" + conditionWidget);
|
Log.debug("ConditionWidget" + conditionWidget);
|
||||||
conditionsField.add(conditionWidget);
|
conditionsField.add(conditionWidget);
|
||||||
|
|
||||||
|
|
||||||
btnApply = new TextButton("Delete");
|
btnApply = new TextButton("Delete");
|
||||||
btnApply.setIcon(ExpressionResources.INSTANCE
|
btnApply.setIcon(ExpressionResources.INSTANCE
|
||||||
.tableRowDeleteByExpression());
|
.tableRowDeleteByExpression());
|
||||||
|
@ -602,7 +499,6 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
btnClose = new TextButton("Close");
|
btnClose = new TextButton("Close");
|
||||||
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
btnClose.setIcon(ExpressionResources.INSTANCE.close());
|
||||||
|
@ -618,15 +514,12 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
flowButton.add(btnApply, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
flowButton.add(btnClose, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
|
|
||||||
|
|
||||||
basicLayout.add(conditionsField, new VerticalLayoutData(1, -1,
|
basicLayout.add(conditionsField, new VerticalLayoutData(1, -1,
|
||||||
new Margins(1)));
|
new Margins(1)));
|
||||||
basicLayout.add(flowButton, new VerticalLayoutData(1, 36, new Margins(
|
basicLayout.add(flowButton, new VerticalLayoutData(1, 36, new Margins(
|
||||||
5, 2, 5, 2)));
|
5, 2, 5, 2)));
|
||||||
|
|
||||||
add(basicLayout);
|
add(basicLayout);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,9 +589,7 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
return selectionHandler;
|
return selectionHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void applySeleceted() {
|
protected void applySeleceted() {
|
||||||
|
|
||||||
|
|
||||||
C_Expression exp;
|
C_Expression exp;
|
||||||
C_ExpressionContainer condContainer = null;
|
C_ExpressionContainer condContainer = null;
|
||||||
|
@ -717,12 +608,11 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
condContainer.setId(C_ExpressionContainer.Contains.C_Expression);
|
condContainer.setId(C_ExpressionContainer.Contains.C_Expression);
|
||||||
condContainer.setExp(exp);
|
condContainer.setExp(exp);
|
||||||
condContainer.setReadableExpression(exp.getReadableExpression());
|
condContainer.setReadableExpression(exp.getReadableExpression());
|
||||||
exWrapper = new ExpressionWrapper(column.getTrId(), column,
|
exWrapper = new ExpressionWrapper(null, null, condContainer);
|
||||||
condContainer);
|
|
||||||
|
|
||||||
ExpressionWrapperNotification expressionWrapperNotification = new ExpressionWrapperNotification(
|
ExpressionWrapperNotification expressionWrapperNotification = new ExpressionWrapperNotification(
|
||||||
exWrapper);
|
exWrapper);
|
||||||
Log.debug("Apply: "+expressionWrapperNotification);
|
Log.debug("Apply: " + expressionWrapperNotification);
|
||||||
parentTemplateDialog.onExpression(expressionWrapperNotification);
|
parentTemplateDialog.onExpression(expressionWrapperNotification);
|
||||||
break;
|
break;
|
||||||
case RuleOnTable:
|
case RuleOnTable:
|
||||||
|
@ -737,9 +627,19 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
UtilsGXT3.alert("Attention", e.getLocalizedMessage());
|
UtilsGXT3.alert("Attention", e.getLocalizedMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
RuleDescriptionData ruleDescriptionData = retrieveRuleDescriptionData(exp);
|
|
||||||
|
RuleDescriptionData ruleDescriptionData = null;
|
||||||
|
try {
|
||||||
|
ruleDescriptionData = retrieveRuleDescriptionData(exp);
|
||||||
|
} catch (MultiColumnExpressionPanelException e1) {
|
||||||
|
Log.debug(e1.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Attention", e1.getLocalizedMessage());
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (ruleDescriptionData != null) {
|
if (ruleDescriptionData != null) {
|
||||||
parentRuleOnTableCreateDialog.addRule(ruleDescriptionData);
|
if (parentRuleOnTableCreateDialog != null) {
|
||||||
|
parentRuleOnTableCreateDialog.addRule(ruleDescriptionData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ColumnFilter:
|
case ColumnFilter:
|
||||||
|
@ -750,7 +650,7 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
UtilsGXT3.alert("Attention", e.getLocalizedMessage());
|
UtilsGXT3.alert("Attention", e.getLocalizedMessage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Log.debug("Apply: "+exp);
|
Log.debug("Apply: " + exp);
|
||||||
parentMultiFilterDialog.applyFilter(exp);
|
parentMultiFilterDialog.applyFilter(exp);
|
||||||
break;
|
break;
|
||||||
case RowDeleteByExpression:
|
case RowDeleteByExpression:
|
||||||
|
@ -762,25 +662,46 @@ public class MultiColumnExpressionPanel extends FramedPanel {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
C_Expression notExp = new C_Not(exp);
|
C_Expression notExp = new C_Not(exp);
|
||||||
Log.debug("Apply: "+exp);
|
Log.debug("Apply: " + exp);
|
||||||
parentRowsDeleteByExpressionDialog.deleteRowsByExpression(
|
parentRowsDeleteByExpressionDialog.deleteRowsByExpression(notExp);
|
||||||
notExp);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RuleDescriptionData getRuleOnTable()
|
||||||
|
throws MultiColumnExpressionPanelException {
|
||||||
|
if (!conditionWidget.isEnabled()) {
|
||||||
|
throw new MultiColumnExpressionPanelException("Fill all field!");
|
||||||
|
}
|
||||||
|
|
||||||
|
C_Expression exp;
|
||||||
|
|
||||||
|
try {
|
||||||
|
exp = conditionWidget.getExpression();
|
||||||
|
} catch (ConditionTypeMapException e) {
|
||||||
|
Log.debug(e.getLocalizedMessage());
|
||||||
|
throw new MultiColumnExpressionPanelException(
|
||||||
|
e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
RuleDescriptionData ruleDescriptionData = retrieveRuleDescriptionData(exp);
|
||||||
|
return ruleDescriptionData;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected void close() {
|
protected void close() {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Template:
|
case Template:
|
||||||
parentTemplateDialog.close();
|
parentTemplateDialog.close();
|
||||||
break;
|
break;
|
||||||
case RuleOnTable:
|
case RuleOnTable:
|
||||||
parentRuleOnTableCreateDialog.close();
|
if (parentRuleOnTableCreateDialog != null) {
|
||||||
|
parentRuleOnTableCreateDialog.close();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ColumnFilter:
|
case ColumnFilter:
|
||||||
parentMultiFilterDialog.close();
|
parentMultiFilterDialog.close();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.gcube.portlets.user.td.expressionwidget.client;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.client.exception.MultiColumnExpressionPanelException;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.notification.RuleDialogNotification;
|
import org.gcube.portlets.user.td.expressionwidget.client.notification.RuleDialogNotification;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.notification.RuleDialogNotification.HasRuleDialogNotificationListener;
|
import org.gcube.portlets.user.td.expressionwidget.client.notification.RuleDialogNotification.HasRuleDialogNotificationListener;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.notification.RuleDialogNotification.RuleDialogNotificationListener;
|
import org.gcube.portlets.user.td.expressionwidget.client.notification.RuleDialogNotification.RuleDialogNotificationListener;
|
||||||
|
@ -46,8 +47,13 @@ public class RuleOnTableCreateDialog extends Window implements
|
||||||
initWindow();
|
initWindow();
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
this.initialRuleDescriptionData=ruleDescriptionData;
|
this.initialRuleDescriptionData=ruleDescriptionData;
|
||||||
multiColumnExpressionPanel = new MultiColumnExpressionPanel(this, ruleDescriptionData,eventBus);
|
try {
|
||||||
add(multiColumnExpressionPanel);
|
multiColumnExpressionPanel = new MultiColumnExpressionPanel(this, ruleDescriptionData);
|
||||||
|
add(multiColumnExpressionPanel);
|
||||||
|
} catch (MultiColumnExpressionPanelException e) {
|
||||||
|
UtilsGXT3.alert("Attention", e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,7 +66,7 @@ public class RuleOnTableCreateDialog extends Window implements
|
||||||
setClosable(true);
|
setClosable(true);
|
||||||
setModal(true);
|
setModal(true);
|
||||||
forceLayoutOnResize = true;
|
forceLayoutOnResize = true;
|
||||||
getHeader().setIcon(ExpressionResources.INSTANCE.ruleColumnAdd());
|
getHeader().setIcon(ExpressionResources.INSTANCE.ruleTableAdd());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ public class TemplateColumnExpressionDialog extends Window implements
|
||||||
setClosable(true);
|
setClosable(true);
|
||||||
setModal(true);
|
setModal(true);
|
||||||
forceLayoutOnResize = true;
|
forceLayoutOnResize = true;
|
||||||
getHeader().setIcon(ExpressionResources.INSTANCE.ruleAdd());
|
getHeader().setIcon(ExpressionResources.INSTANCE.ruleColumnAdd());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ public class TemplateMultiColumnExpressionDialog extends Window implements
|
||||||
columns = new ArrayList<ColumnData>();
|
columns = new ArrayList<ColumnData>();
|
||||||
for (ColumnMockUp columnMockUp : columnsMockUp) {
|
for (ColumnMockUp columnMockUp : columnsMockUp) {
|
||||||
ColumnData column = new ColumnData();
|
ColumnData column = new ColumnData();
|
||||||
|
column.setId(columnMockUp.getColumnId());
|
||||||
column.setColumnId(columnMockUp.getColumnId());
|
column.setColumnId(columnMockUp.getColumnId());
|
||||||
column.setLabel(columnMockUp.getLabel());
|
column.setLabel(columnMockUp.getLabel());
|
||||||
column.setDataTypeName(columnMockUp.getColumnDataType().toString());
|
column.setDataTypeName(columnMockUp.getColumnDataType().toString());
|
||||||
|
@ -78,7 +79,7 @@ public class TemplateMultiColumnExpressionDialog extends Window implements
|
||||||
setClosable(true);
|
setClosable(true);
|
||||||
setModal(true);
|
setModal(true);
|
||||||
forceLayoutOnResize = true;
|
forceLayoutOnResize = true;
|
||||||
getHeader().setIcon(ExpressionResources.INSTANCE.ruleAdd());
|
getHeader().setIcon(ExpressionResources.INSTANCE.ruleTableAdd());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.gcube.portlets.user.td.expressionwidget.client.exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class MultiColumnExpressionPanelException extends Exception {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -4619188268507480346L;
|
||||||
|
|
||||||
|
public MultiColumnExpressionPanelException(String message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MultiColumnExpressionPanelException(String message, Throwable cause) {
|
||||||
|
super(message, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -1,76 +1,84 @@
|
||||||
package org.gcube.portlets.user.td.expressionwidget.client.resources;
|
package org.gcube.portlets.user.td.expressionwidget.client.resources;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import com.google.gwt.core.client.GWT;
|
import com.google.gwt.core.client.GWT;
|
||||||
import com.google.gwt.resources.client.ClientBundle;
|
import com.google.gwt.resources.client.ClientBundle;
|
||||||
import com.google.gwt.resources.client.ImageResource;
|
import com.google.gwt.resources.client.ImageResource;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi" <a
|
||||||
* <a 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 interface ExpressionResources extends ClientBundle {
|
public interface ExpressionResources extends ClientBundle {
|
||||||
|
|
||||||
public static final ExpressionResources INSTANCE = GWT.create(ExpressionResources.class);
|
public static final ExpressionResources INSTANCE = GWT
|
||||||
|
.create(ExpressionResources.class);
|
||||||
@Source("add.png")
|
|
||||||
ImageResource add();
|
@Source("add.png")
|
||||||
|
ImageResource add();
|
||||||
@Source("delete.png")
|
|
||||||
ImageResource delete();
|
@Source("delete.png")
|
||||||
|
ImageResource delete();
|
||||||
@Source("wrench-database.png")
|
|
||||||
ImageResource save();
|
@Source("wrench-database.png")
|
||||||
|
ImageResource save();
|
||||||
@Source("close-red.png")
|
|
||||||
ImageResource close();
|
@Source("close-red.png")
|
||||||
|
ImageResource close();
|
||||||
@Source("rule-add.png")
|
|
||||||
ImageResource ruleAdd();
|
@Source("rule-add.png")
|
||||||
|
ImageResource ruleAdd();
|
||||||
@Source("rule-add_32.png")
|
|
||||||
ImageResource ruleAdd32();
|
@Source("rule-add_32.png")
|
||||||
|
ImageResource ruleAdd32();
|
||||||
@Source("rule-edit_32.png")
|
|
||||||
ImageResource ruleEdit32();
|
@Source("rule-edit_32.png")
|
||||||
|
ImageResource ruleEdit32();
|
||||||
|
|
||||||
|
@Source("rule-edit.png")
|
||||||
|
ImageResource ruleEdit();
|
||||||
|
|
||||||
|
@Source("rule-column-add.png")
|
||||||
|
ImageResource ruleColumnAdd();
|
||||||
|
|
||||||
|
@Source("rule-column-add_32.png")
|
||||||
|
ImageResource ruleColumnAdd32();
|
||||||
|
|
||||||
|
@Source("rule-table-add.png")
|
||||||
|
ImageResource ruleTableAdd();
|
||||||
|
|
||||||
|
@Source("rule-table-add_32.png")
|
||||||
|
ImageResource ruleTableAdd32();
|
||||||
|
|
||||||
|
@Source("rule-table-apply.png")
|
||||||
|
ImageResource ruleTableApply();
|
||||||
|
|
||||||
|
@Source("rule-table-apply_32.png")
|
||||||
|
ImageResource ruleTableApply32();
|
||||||
|
|
||||||
|
@Source("wrench-go.png")
|
||||||
|
ImageResource apply();
|
||||||
|
|
||||||
|
@Source("wrench-manage.png")
|
||||||
|
ImageResource search();
|
||||||
|
|
||||||
|
@Source("column-filter.png")
|
||||||
|
ImageResource filter();
|
||||||
|
|
||||||
|
@Source("column-filter-go.png")
|
||||||
|
ImageResource applyFilter();
|
||||||
|
|
||||||
|
@Source("column-replace-by-expression_32.png")
|
||||||
|
ImageResource columnReplaceByExpression32();
|
||||||
|
|
||||||
|
@Source("column-replace-by-expression.png")
|
||||||
|
ImageResource columnReplaceByExpression();
|
||||||
|
|
||||||
|
@Source("table-row-delete-byexpression_32.png")
|
||||||
|
ImageResource tableRowDeleteByExpression32();
|
||||||
|
|
||||||
|
@Source("table-row-delete-byexpression.png")
|
||||||
|
ImageResource tableRowDeleteByExpression();
|
||||||
|
|
||||||
@Source("rule-edit.png")
|
|
||||||
ImageResource ruleEdit();
|
|
||||||
|
|
||||||
|
|
||||||
@Source("rule-column-add.png")
|
|
||||||
ImageResource ruleColumnAdd();
|
|
||||||
|
|
||||||
@Source("rule-column-add_32.png")
|
|
||||||
ImageResource ruleColumnAdd32();
|
|
||||||
|
|
||||||
@Source("wrench-go.png")
|
|
||||||
ImageResource apply();
|
|
||||||
|
|
||||||
@Source("wrench-manage.png")
|
|
||||||
ImageResource search();
|
|
||||||
|
|
||||||
@Source("column-filter.png")
|
|
||||||
ImageResource filter();
|
|
||||||
|
|
||||||
@Source("column-filter-go.png")
|
|
||||||
ImageResource applyFilter();
|
|
||||||
|
|
||||||
@Source("column-replace-by-expression_32.png")
|
|
||||||
ImageResource columnReplaceByExpression32();
|
|
||||||
|
|
||||||
@Source("column-replace-by-expression.png")
|
|
||||||
ImageResource columnReplaceByExpression();
|
|
||||||
|
|
||||||
|
|
||||||
@Source("table-row-delete-byexpression_32.png")
|
|
||||||
ImageResource tableRowDeleteByExpression32();
|
|
||||||
|
|
||||||
@Source("table-row-delete-byexpression.png")
|
|
||||||
ImageResource tableRowDeleteByExpression();
|
|
||||||
|
|
||||||
}
|
}
|
After Width: | Height: | Size: 889 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 872 B |
After Width: | Height: | Size: 1.8 KiB |
After Width: | Height: | Size: 889 B |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 872 B |
After Width: | Height: | Size: 1.8 KiB |