Updated Rule
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-expression-widget@113988 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b313965538
commit
96443d5629
|
@ -36,6 +36,8 @@ import com.google.gwt.core.client.Scheduler;
|
|||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.event.logical.shared.SelectionEvent;
|
||||
import com.google.gwt.event.logical.shared.SelectionHandler;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.HTML;
|
||||
import com.google.web.bindery.event.shared.EventBus;
|
||||
|
@ -75,6 +77,7 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
private static final String HEIGHT_MULTI = "290px";
|
||||
private static final String WIDTH = "648px";
|
||||
private static final String HEIGHT = "364px";
|
||||
private static final String RULE_HEIGHT = "388px";
|
||||
|
||||
private ColumnExpressionPanelType type;
|
||||
private EventBus eventBus;
|
||||
|
@ -101,6 +104,7 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
private ComboBox<ColumnDataTypeElement> comboAttributeType;
|
||||
private ListStore<LocaleTypeElement> storeComboLocaleType;
|
||||
private ComboBox<LocaleTypeElement> comboLocaleType;
|
||||
private FieldLabel comboColumnTypeCodeLabel;
|
||||
private FieldLabel comboLocaleTypeLabel;
|
||||
private FieldLabel comboAttributeTypeLabel;
|
||||
private FieldLabel comboMeasureTypeLabel;
|
||||
|
@ -161,7 +165,7 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
ColumnData column, ArrayList<ColumnData> columns, EventBus eventBus) {
|
||||
super();
|
||||
setWidth(WIDTH);
|
||||
setHeight(HEIGHT);
|
||||
setHeight(RULE_HEIGHT);
|
||||
type = ColumnExpressionPanelType.RowDeleteByExpression;
|
||||
this.parentRowsDeleteByExpressionDialog = parentRowsDeleteByExpressionDialog;
|
||||
this.column = column;
|
||||
|
@ -246,14 +250,14 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
Log.debug("ConditionWidget" + conditionWidget);
|
||||
conditionsField.add(conditionWidget);
|
||||
|
||||
btnApply = new TextButton("Apply");
|
||||
btnApply.setIcon(ExpressionResources.INSTANCE.apply());
|
||||
btnApply = new TextButton("Save");
|
||||
btnApply.setIcon(ExpressionResources.INSTANCE.rule());
|
||||
btnApply.setIconAlign(IconAlign.RIGHT);
|
||||
btnApply.setToolTip("Apply rule");
|
||||
btnApply.setToolTip("Save rule");
|
||||
btnApply.addSelectHandler(new SelectHandler() {
|
||||
|
||||
public void onSelect(SelectEvent event) {
|
||||
Log.debug("Pressed Apply");
|
||||
Log.debug("Pressed Save");
|
||||
applySeleceted();
|
||||
|
||||
}
|
||||
|
@ -288,10 +292,21 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
// TODO
|
||||
private void createColumnMockUp(VerticalLayoutContainer propertiesLayout) {
|
||||
columnTag = new TextField();
|
||||
columnTag.setToolTip("Label");
|
||||
FieldLabel columnLabel=new FieldLabel(columnTag, "Column Label");
|
||||
columnTag.setToolTip("Column Label");
|
||||
columnTag.addValueChangeHandler(new ValueChangeHandler<String>() {
|
||||
|
||||
//combo TypeCode
|
||||
@Override
|
||||
public void onValueChange(ValueChangeEvent<String> event) {
|
||||
updateColumnTag(event.getValue());
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
FieldLabel columnLabel = new FieldLabel(columnTag, "Column Label");
|
||||
|
||||
// combo TypeCode
|
||||
ColumnTypeCodeProperties propsColumnTypeCode = GWT
|
||||
.create(ColumnTypeCodeProperties.class);
|
||||
ListStore<ColumnTypeCodeElement> storeComboTypeCode = new ListStore<ColumnTypeCodeElement>(
|
||||
|
@ -310,6 +325,8 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
comboColumnTypeCode.setTypeAhead(true);
|
||||
comboColumnTypeCode.setTriggerAction(TriggerAction.ALL);
|
||||
|
||||
comboColumnTypeCodeLabel=new FieldLabel(comboColumnTypeCode, "Column Type");
|
||||
|
||||
// comboMeasureType
|
||||
ColumnDataTypeProperties propsMeasureType = GWT
|
||||
.create(ColumnDataTypeProperties.class);
|
||||
|
@ -380,28 +397,25 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
|
||||
comboLocaleTypeLabel = new FieldLabel(comboLocaleType, "Locale");
|
||||
|
||||
|
||||
propertiesLayout.add(columnLabel,
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
propertiesLayout.add(new FieldLabel(comboColumnTypeCode, "Column Type"),
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
propertiesLayout.add(comboLocaleTypeLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0)));
|
||||
propertiesLayout.add(comboMeasureTypeLabel, new VerticalLayoutData(1, -1, new Margins(
|
||||
0)));
|
||||
propertiesLayout.add(comboAttributeTypeLabel, new VerticalLayoutData(1, -1,
|
||||
propertiesLayout.add(columnLabel, new VerticalLayoutData(1, -1,
|
||||
new Margins(0)));
|
||||
propertiesLayout.add(
|
||||
comboColumnTypeCodeLabel,
|
||||
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||
propertiesLayout.add(comboLocaleTypeLabel, new VerticalLayoutData(1,
|
||||
-1, new Margins(0)));
|
||||
propertiesLayout.add(comboMeasureTypeLabel, new VerticalLayoutData(1,
|
||||
-1, new Margins(0)));
|
||||
propertiesLayout.add(comboAttributeTypeLabel, new VerticalLayoutData(1,
|
||||
-1, new Margins(0)));
|
||||
|
||||
|
||||
comboColumnTypeCodeLabel.setVisible(false);
|
||||
comboMeasureTypeLabel.setVisible(false);
|
||||
comboAttributeTypeLabel.setVisible(false);
|
||||
comboLocaleTypeLabel.setVisible(false);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void addHandlersForComboColumnTypeCode(
|
||||
final LabelProvider<ColumnTypeCodeElement> labelProvider) {
|
||||
comboColumnTypeCode
|
||||
|
@ -493,6 +507,30 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
});
|
||||
}
|
||||
|
||||
protected void updateColumnTag(String value) {
|
||||
if(value==null|| value.isEmpty()){
|
||||
comboColumnTypeCodeLabel.setVisible(false);
|
||||
comboMeasureTypeLabel.setVisible(false);
|
||||
comboAttributeTypeLabel.setVisible(false);
|
||||
comboLocaleTypeLabel.setVisible(false);
|
||||
|
||||
} else {
|
||||
comboColumnTypeCodeLabel.setVisible(true);
|
||||
comboMeasureTypeLabel.setVisible(false);
|
||||
comboAttributeTypeLabel.setVisible(false);
|
||||
comboLocaleTypeLabel.setVisible(false);
|
||||
|
||||
}
|
||||
|
||||
comboColumnTypeCode.reset();
|
||||
comboMeasureType.reset();
|
||||
comboAttributeType.reset();
|
||||
comboLocaleType.reset();
|
||||
updateCondition();
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void updateColumnType(ColumnTypeCode type) {
|
||||
Log.debug("Update ColumnTypeCode " + type.toString());
|
||||
|
@ -521,29 +559,119 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
break;
|
||||
}
|
||||
|
||||
updateCondition();
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
protected void updateCondition() {
|
||||
ColumnMockUp columnMockUp = retrieveColumnMockUp();
|
||||
if (columnMockUp != null) {
|
||||
column = new ColumnData();
|
||||
column.setColumnId(columnMockUp.getColumnId());
|
||||
column.setLabel(columnMockUp.getLabel());
|
||||
column.setDataTypeName(columnMockUp.getColumnDataType().toString());
|
||||
column.setTypeCode(columnMockUp.getColumnType().toString());
|
||||
conditionWidget.update(column);
|
||||
conditionWidget.enable();
|
||||
} else {
|
||||
conditionWidget.disable();
|
||||
}
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
protected ColumnMockUp retrieveColumnMockUp() {
|
||||
ColumnMockUp columnMockUp = null;
|
||||
|
||||
String labelS = columnTag.getCurrentValue();
|
||||
|
||||
if (labelS != null && !labelS.isEmpty()) {
|
||||
ColumnTypeCodeElement columnTypeCodeElement = comboColumnTypeCode
|
||||
.getCurrentValue();
|
||||
if (columnTypeCodeElement != null) {
|
||||
ColumnTypeCode type = columnTypeCodeElement.getCode();
|
||||
ColumnDataTypeElement columnDataTypeElement;
|
||||
switch (type) {
|
||||
case MEASURE:
|
||||
columnDataTypeElement = comboMeasureType.getCurrentValue();
|
||||
if (columnDataTypeElement != null) {
|
||||
ColumnDataType dataType = columnDataTypeElement
|
||||
.getType();
|
||||
if (dataType != null) {
|
||||
columnMockUp = new ColumnMockUp(null, labelS,
|
||||
labelS, type, dataType, "");
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
break;
|
||||
case ATTRIBUTE:
|
||||
columnDataTypeElement = comboAttributeType
|
||||
.getCurrentValue();
|
||||
if (columnDataTypeElement != null) {
|
||||
ColumnDataType dataType = columnDataTypeElement
|
||||
.getType();
|
||||
if (dataType != null) {
|
||||
columnMockUp = new ColumnMockUp(null, labelS,
|
||||
labelS, type, dataType, "");
|
||||
|
||||
} else {
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
break;
|
||||
case CODE:
|
||||
case CODEDESCRIPTION:
|
||||
case ANNOTATION:
|
||||
columnMockUp = new ColumnMockUp(null, labelS, labelS, type,
|
||||
"");
|
||||
break;
|
||||
|
||||
case CODENAME:
|
||||
LocaleTypeElement locale = comboLocaleType
|
||||
.getCurrentValue();
|
||||
if (locale != null) {
|
||||
columnMockUp = new ColumnMockUp(null, labelS, labelS,
|
||||
type, locale.getLocaleName(), "");
|
||||
|
||||
} else {
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
} else {
|
||||
|
||||
}
|
||||
return columnMockUp;
|
||||
|
||||
}
|
||||
|
||||
protected void updateMeasureType(ColumnDataType type) {
|
||||
Log.debug("Update ColumnTypeCode " + type);
|
||||
updateCondition();
|
||||
|
||||
forceLayout();
|
||||
}
|
||||
|
||||
protected void updateAttributeType(ColumnDataType type) {
|
||||
Log.debug("Update ColumnTypeCode " + type);
|
||||
updateCondition();
|
||||
|
||||
forceLayout();
|
||||
|
||||
}
|
||||
|
||||
protected void updateLocaleType(LocaleTypeElement type) {
|
||||
Log.debug("Update LocalType" + type);
|
||||
|
||||
updateCondition();
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void retrieveLocales() {
|
||||
TDGWTServiceAsync.INSTANCE
|
||||
.getLocales(new AsyncCallback<ArrayList<String>>() {
|
||||
|
@ -590,7 +718,6 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
|
||||
}
|
||||
|
||||
|
||||
protected void createOnTemplate() {
|
||||
// Important: fixed rendering of widgets
|
||||
forceLayoutOnResize = true;
|
||||
|
@ -1071,14 +1198,6 @@ public class ColumnExpressionPanel extends FramedPanel {
|
|||
|
||||
}
|
||||
|
||||
protected void saveRule() {
|
||||
|
||||
}
|
||||
|
||||
protected void searchRule() {
|
||||
|
||||
}
|
||||
|
||||
protected void close() {
|
||||
switch (type) {
|
||||
case Template:
|
||||
|
|
|
@ -18,7 +18,7 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|||
*/
|
||||
public class RuleDialog extends Window {
|
||||
private static final String WIDTH = "660px";
|
||||
private static final String HEIGHT = "426px";
|
||||
private static final String HEIGHT = "460px";
|
||||
private ColumnExpressionPanel columnExpressionPanel;
|
||||
private EventBus eventBus;
|
||||
|
||||
|
@ -31,7 +31,6 @@ public class RuleDialog extends Window {
|
|||
public RuleDialog(EventBus eventBus) {
|
||||
initWindow();
|
||||
this.eventBus = eventBus;
|
||||
|
||||
create();
|
||||
|
||||
}
|
||||
|
@ -90,7 +89,7 @@ public class RuleDialog extends Window {
|
|||
|
||||
public void addRule(ExpressionWrapper exWrapper) {
|
||||
Log.debug("ExpressionWrapper: "+exWrapper);
|
||||
|
||||
close();
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue