|
|
|
@ -1,7 +1,6 @@
|
|
|
|
|
package org.gcube.portlets.user.td.columnwidget.client.create;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
|
|
import org.gcube.portlets.user.td.columnwidget.client.dimension.CodelistSelectionDialog;
|
|
|
|
|
import org.gcube.portlets.user.td.columnwidget.client.dimension.CodelistSelectionListener;
|
|
|
|
@ -18,12 +17,15 @@ import org.gcube.portlets.user.td.columnwidget.client.store.ColumnTypeCodeElemen
|
|
|
|
|
import org.gcube.portlets.user.td.columnwidget.client.store.ColumnTypeCodeStore;
|
|
|
|
|
import org.gcube.portlets.user.td.columnwidget.client.store.LocaleTypeElement;
|
|
|
|
|
import org.gcube.portlets.user.td.columnwidget.client.utils.UtilsGXT3;
|
|
|
|
|
import org.gcube.portlets.user.td.expressionwidget.client.expression.ExpressionWrapperNotification;
|
|
|
|
|
import org.gcube.portlets.user.td.expressionwidget.client.expression.ExpressionWrapperNotification.ExpressionWrapperNotificationListener;
|
|
|
|
|
import org.gcube.portlets.user.td.expressionwidget.client.expression.ReplaceExpressionDialog;
|
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
|
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.DefNewColumn;
|
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnMockUp;
|
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.PeriodDataType;
|
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
|
|
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.AddColumnSession;
|
|
|
|
@ -31,6 +33,7 @@ import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
|
|
|
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
|
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
|
|
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
|
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.expression.ExpressionWrapper;
|
|
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
|
|
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
|
|
|
|
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
|
|
|
@ -43,9 +46,10 @@ import com.allen_sauer.gwt.log.client.Log;
|
|
|
|
|
import com.google.gwt.core.client.GWT;
|
|
|
|
|
import com.google.gwt.core.client.Scheduler;
|
|
|
|
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
|
|
|
|
import com.google.gwt.event.dom.client.ClickEvent;
|
|
|
|
|
import com.google.gwt.event.dom.client.ClickHandler;
|
|
|
|
|
import com.google.gwt.event.logical.shared.SelectionEvent;
|
|
|
|
|
import com.google.gwt.event.logical.shared.SelectionHandler;
|
|
|
|
|
import com.google.gwt.i18n.client.DateTimeFormat;
|
|
|
|
|
import com.google.gwt.regexp.shared.MatchResult;
|
|
|
|
|
import com.google.gwt.regexp.shared.RegExp;
|
|
|
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
|
|
@ -64,7 +68,6 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|
|
|
|
import com.sencha.gxt.widget.core.client.event.TriggerClickEvent;
|
|
|
|
|
import com.sencha.gxt.widget.core.client.event.TriggerClickEvent.TriggerClickHandler;
|
|
|
|
|
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
|
|
|
|
import com.sencha.gxt.widget.core.client.form.DateField;
|
|
|
|
|
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
|
|
|
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
|
|
|
|
import com.sencha.gxt.widget.core.client.info.Info;
|
|
|
|
@ -86,10 +89,10 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
private AddColumnDialog parent;
|
|
|
|
|
private TRId trId;
|
|
|
|
|
|
|
|
|
|
//private AddColumnPanel thisPanel;
|
|
|
|
|
// private AddColumnPanel thisPanel;
|
|
|
|
|
|
|
|
|
|
private ComboBox<ColumnTypeCodeElement> comboColumnTypeCode = null;
|
|
|
|
|
//private FieldLabel comboColumnTypeCodeLabel;
|
|
|
|
|
// private FieldLabel comboColumnTypeCodeLabel;
|
|
|
|
|
|
|
|
|
|
private ComboBox<ColumnDataTypeElement> comboMeasureType = null;
|
|
|
|
|
private FieldLabel comboMeasureTypeLabel;
|
|
|
|
@ -118,14 +121,9 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
|
|
|
|
|
private TextField label;
|
|
|
|
|
private TextField defaultValueString;
|
|
|
|
|
private DateField defaultValueDate;
|
|
|
|
|
|
|
|
|
|
private FieldLabel defaultStringLabel;
|
|
|
|
|
private FieldLabel defaultDateLabel;
|
|
|
|
|
|
|
|
|
|
private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
@ -135,7 +133,7 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
public AddColumnPanel(AddColumnDialog parent, TRId trId, EventBus eventBus) {
|
|
|
|
|
super();
|
|
|
|
|
Log.debug("CreateDefColumnPanel[parent: " + parent + ", trId: " + trId);
|
|
|
|
|
//this.thisPanel = this;
|
|
|
|
|
// this.thisPanel = this;
|
|
|
|
|
this.parent = parent;
|
|
|
|
|
this.eventBus = eventBus;
|
|
|
|
|
this.trId = trId;
|
|
|
|
@ -151,7 +149,7 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
public AddColumnPanel(TRId trId, EventBus eventBus) {
|
|
|
|
|
super();
|
|
|
|
|
Log.debug("CreateDefColumnPanel[trId: " + trId);
|
|
|
|
|
//this.thisPanel = this;
|
|
|
|
|
// this.thisPanel = this;
|
|
|
|
|
this.eventBus = eventBus;
|
|
|
|
|
this.trId = trId;
|
|
|
|
|
init();
|
|
|
|
@ -173,9 +171,14 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
// Default Value
|
|
|
|
|
defaultValueString = new TextField();
|
|
|
|
|
defaultStringLabel = new FieldLabel(defaultValueString, "Default");
|
|
|
|
|
defaultStringLabel.addDomHandler(new ClickHandler() {
|
|
|
|
|
|
|
|
|
|
defaultValueDate = new DateField();
|
|
|
|
|
defaultDateLabel = new FieldLabel(defaultValueDate, "Default");
|
|
|
|
|
@Override
|
|
|
|
|
public void onClick(ClickEvent event) {
|
|
|
|
|
openReplaceExpressionDialog();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}, ClickEvent.getType());
|
|
|
|
|
|
|
|
|
|
// comboColumnTypeCode
|
|
|
|
|
ColumnTypeCodeProperties propsColumnTypeCode = GWT
|
|
|
|
@ -310,9 +313,9 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
.create(PeriodDataTypeProperties.class);
|
|
|
|
|
storeComboTimeDimensionType = new ListStore<PeriodDataType>(
|
|
|
|
|
propsTimeDimensionType.name());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
comboTimeDimensionType = new ComboBox<PeriodDataType>(
|
|
|
|
|
storeComboTimeDimensionType, propsTimeDimensionType.label()){
|
|
|
|
|
storeComboTimeDimensionType, propsTimeDimensionType.label()) {
|
|
|
|
|
protected void onAfterFirstAttach() {
|
|
|
|
|
super.onAfterFirstAttach();
|
|
|
|
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
|
|
|
@ -368,7 +371,6 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
new Margins(1)));
|
|
|
|
|
|
|
|
|
|
v.add(defaultStringLabel, new VerticalLayoutData(1, -1, new Margins(1)));
|
|
|
|
|
v.add(defaultDateLabel, new VerticalLayoutData(1, -1, new Margins(1)));
|
|
|
|
|
v.add(btnAddColumn, new VerticalLayoutData(-1, -1, new Margins(10, 0,
|
|
|
|
|
10, 0)));
|
|
|
|
|
add(v, new VerticalLayoutData(-1, -1, new Margins(0)));
|
|
|
|
@ -380,11 +382,49 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
comboTimeDimensionTypeLabel.setVisible(false);
|
|
|
|
|
comboLocaleTypeLabel.setVisible(false);
|
|
|
|
|
|
|
|
|
|
defaultDateLabel.setVisible(false);
|
|
|
|
|
defaultStringLabel.setVisible(false);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void openReplaceExpressionDialog() {
|
|
|
|
|
ColumnMockUp columnMockUp = retrieveColumnMockUp();
|
|
|
|
|
if (columnMockUp != null) {
|
|
|
|
|
ReplaceExpressionDialog replaceExpressionDialog = new ReplaceExpressionDialog(
|
|
|
|
|
columnMockUp, trId, eventBus);
|
|
|
|
|
replaceExpressionDialog
|
|
|
|
|
.addExpressionWrapperNotificationListener(new ExpressionWrapperNotificationListener() {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onExpression(
|
|
|
|
|
ExpressionWrapperNotification expressionWrapperNotification) {
|
|
|
|
|
ExpressionWrapper exWrapper=expressionWrapperNotification.getExpressionWrapper();
|
|
|
|
|
if(exWrapper.isReplaceByValue()){
|
|
|
|
|
defaultValueString.setValue(exWrapper.getReplaceValue());
|
|
|
|
|
} else {
|
|
|
|
|
defaultValueString.setValue(exWrapper.getReplaceExpressionContainer().getReadableExpression());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void failed(Throwable throwable) {
|
|
|
|
|
Log.error("Error in AddColumn during expression creation:"+throwable.getLocalizedMessage());
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void aborted() {
|
|
|
|
|
defaultValueString.setValue(null);
|
|
|
|
|
Log.debug("Expression creation aborted");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
replaceExpressionDialog.show();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void addHandlersForComboColumnTypeCode(
|
|
|
|
|
final LabelProvider<ColumnTypeCodeElement> labelProvider) {
|
|
|
|
|
comboColumnTypeCode
|
|
|
|
@ -519,8 +559,7 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
final LabelProvider<PeriodDataType> labelProvider) {
|
|
|
|
|
comboTimeDimensionType
|
|
|
|
|
.addSelectionHandler(new SelectionHandler<PeriodDataType>() {
|
|
|
|
|
public void onSelection(
|
|
|
|
|
SelectionEvent<PeriodDataType> event) {
|
|
|
|
|
public void onSelection(SelectionEvent<PeriodDataType> event) {
|
|
|
|
|
Info.display(
|
|
|
|
|
"Time Dimension Type Selected",
|
|
|
|
|
"You selected "
|
|
|
|
@ -549,7 +588,6 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
comboColumnReferenceTypeLabel.setVisible(false);
|
|
|
|
|
comboTimeDimensionTypeLabel.setVisible(false);
|
|
|
|
|
defaultStringLabel.setVisible(true);
|
|
|
|
|
defaultDateLabel.setVisible(false);
|
|
|
|
|
break;
|
|
|
|
|
case ATTRIBUTE:
|
|
|
|
|
comboLocaleTypeLabel.setVisible(false);
|
|
|
|
@ -559,7 +597,6 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
comboColumnReferenceTypeLabel.setVisible(false);
|
|
|
|
|
comboTimeDimensionTypeLabel.setVisible(false);
|
|
|
|
|
defaultStringLabel.setVisible(false);
|
|
|
|
|
defaultDateLabel.setVisible(false);
|
|
|
|
|
break;
|
|
|
|
|
case DIMENSION:
|
|
|
|
|
comboLocaleTypeLabel.setVisible(false);
|
|
|
|
@ -569,8 +606,6 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
comboColumnReferenceTypeLabel.setVisible(false);
|
|
|
|
|
comboTimeDimensionTypeLabel.setVisible(false);
|
|
|
|
|
defaultStringLabel.setVisible(false);
|
|
|
|
|
defaultDateLabel.setVisible(false);
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case MEASURE:
|
|
|
|
|
comboLocaleTypeLabel.setVisible(false);
|
|
|
|
@ -580,7 +615,6 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
comboColumnReferenceTypeLabel.setVisible(false);
|
|
|
|
|
comboTimeDimensionTypeLabel.setVisible(false);
|
|
|
|
|
defaultStringLabel.setVisible(true);
|
|
|
|
|
defaultDateLabel.setVisible(false);
|
|
|
|
|
break;
|
|
|
|
|
case TIMEDIMENSION:
|
|
|
|
|
comboLocaleTypeLabel.setVisible(false);
|
|
|
|
@ -590,7 +624,6 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
comboColumnReferenceTypeLabel.setVisible(false);
|
|
|
|
|
comboTimeDimensionTypeLabel.setVisible(true);
|
|
|
|
|
defaultStringLabel.setVisible(false);
|
|
|
|
|
defaultDateLabel.setVisible(false);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
comboLocaleTypeLabel.setVisible(false);
|
|
|
|
@ -600,7 +633,6 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
comboColumnReferenceTypeLabel.setVisible(false);
|
|
|
|
|
comboTimeDimensionTypeLabel.setVisible(false);
|
|
|
|
|
defaultStringLabel.setVisible(true);
|
|
|
|
|
defaultDateLabel.setVisible(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -613,37 +645,7 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
|
|
|
|
|
protected void updateAttributeType(ColumnDataType type) {
|
|
|
|
|
Log.debug("Update ColumnTypeCode " + type.toString());
|
|
|
|
|
switch (type) {
|
|
|
|
|
case Boolean:
|
|
|
|
|
defaultStringLabel.setVisible(true);
|
|
|
|
|
defaultDateLabel.setVisible(false);
|
|
|
|
|
break;
|
|
|
|
|
case Date:
|
|
|
|
|
defaultStringLabel.setVisible(false);
|
|
|
|
|
defaultDateLabel.setVisible(true);
|
|
|
|
|
break;
|
|
|
|
|
case Geometry:
|
|
|
|
|
defaultStringLabel.setVisible(true);
|
|
|
|
|
defaultDateLabel.setVisible(false);
|
|
|
|
|
break;
|
|
|
|
|
case Integer:
|
|
|
|
|
defaultStringLabel.setVisible(true);
|
|
|
|
|
defaultDateLabel.setVisible(false);
|
|
|
|
|
break;
|
|
|
|
|
case Numeric:
|
|
|
|
|
defaultStringLabel.setVisible(true);
|
|
|
|
|
defaultDateLabel.setVisible(false);
|
|
|
|
|
break;
|
|
|
|
|
case Text:
|
|
|
|
|
defaultStringLabel.setVisible(true);
|
|
|
|
|
defaultDateLabel.setVisible(false);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
defaultStringLabel.setVisible(true);
|
|
|
|
|
defaultDateLabel.setVisible(false);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
defaultStringLabel.setVisible(true);
|
|
|
|
|
forceLayout();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -663,7 +665,7 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void save() {
|
|
|
|
|
DefNewColumn defNewColumn;
|
|
|
|
|
ColumnMockUp columnMockUp;
|
|
|
|
|
|
|
|
|
|
String defaultV = defaultValueString.getCurrentValue();
|
|
|
|
|
String labelS = label.getCurrentValue();
|
|
|
|
@ -681,10 +683,10 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
ColumnDataType dataType = columnDataTypeElement
|
|
|
|
|
.getType();
|
|
|
|
|
if (dataType != null) {
|
|
|
|
|
defNewColumn = new DefNewColumn(labelS, type,
|
|
|
|
|
dataType, defaultV);
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS,
|
|
|
|
|
type, dataType, defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(trId,
|
|
|
|
|
defNewColumn);
|
|
|
|
|
columnMockUp);
|
|
|
|
|
callAddColumm();
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Attention",
|
|
|
|
@ -704,16 +706,15 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
.getType();
|
|
|
|
|
if (dataType != null) {
|
|
|
|
|
if (dataType == ColumnDataType.Geometry) {
|
|
|
|
|
// TODO
|
|
|
|
|
RegExp regExp = RegExp
|
|
|
|
|
.compile(GEOMETRY_REGEXPR);
|
|
|
|
|
MatchResult matcher = regExp.exec(defaultV);
|
|
|
|
|
boolean matchFound = matcher != null;
|
|
|
|
|
if (matchFound) {
|
|
|
|
|
defNewColumn = new DefNewColumn(labelS,
|
|
|
|
|
type, dataType, defaultV);
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null,
|
|
|
|
|
labelS, type, dataType, defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(
|
|
|
|
|
trId, defNewColumn);
|
|
|
|
|
trId, columnMockUp);
|
|
|
|
|
callAddColumm();
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3
|
|
|
|
@ -722,24 +723,17 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (dataType == ColumnDataType.Date) {
|
|
|
|
|
Date d = defaultValueDate.getCurrentValue();
|
|
|
|
|
if (d == null) {
|
|
|
|
|
UtilsGXT3
|
|
|
|
|
.alert("Attention",
|
|
|
|
|
"Column data type not selected!");
|
|
|
|
|
} else {
|
|
|
|
|
String dateS = sdf.format(d);
|
|
|
|
|
defNewColumn = new DefNewColumn(labelS,
|
|
|
|
|
type, dataType, dateS);
|
|
|
|
|
addColumnSession = new AddColumnSession(
|
|
|
|
|
trId, defNewColumn);
|
|
|
|
|
callAddColumm();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
defNewColumn = new DefNewColumn(labelS,
|
|
|
|
|
type, dataType, defaultV);
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null,
|
|
|
|
|
labelS, type, dataType, defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(
|
|
|
|
|
trId, defNewColumn);
|
|
|
|
|
trId, columnMockUp);
|
|
|
|
|
callAddColumm();
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null,
|
|
|
|
|
labelS, type, dataType, defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(
|
|
|
|
|
trId, columnMockUp);
|
|
|
|
|
callAddColumm();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -755,41 +749,44 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CODE:
|
|
|
|
|
defNewColumn = new DefNewColumn(labelS, type, defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(trId, defNewColumn);
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS, type,
|
|
|
|
|
defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(trId, columnMockUp);
|
|
|
|
|
callAddColumm();
|
|
|
|
|
break;
|
|
|
|
|
case CODENAME:
|
|
|
|
|
LocaleTypeElement locale = comboLocaleType
|
|
|
|
|
.getCurrentValue();
|
|
|
|
|
if (locale != null) {
|
|
|
|
|
defNewColumn = new DefNewColumn(labelS, type,
|
|
|
|
|
locale.getLocaleName(), defaultV);
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS,
|
|
|
|
|
type, locale.getLocaleName(), defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(trId,
|
|
|
|
|
defNewColumn);
|
|
|
|
|
columnMockUp);
|
|
|
|
|
callAddColumm();
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Attention", "No locale selected!");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CODEDESCRIPTION:
|
|
|
|
|
defNewColumn = new DefNewColumn(labelS, type, defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(trId, defNewColumn);
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS, type,
|
|
|
|
|
defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(trId, columnMockUp);
|
|
|
|
|
callAddColumm();
|
|
|
|
|
break;
|
|
|
|
|
case ANNOTATION:
|
|
|
|
|
defNewColumn = new DefNewColumn(labelS, type, defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(trId, defNewColumn);
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS, type,
|
|
|
|
|
defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(trId, columnMockUp);
|
|
|
|
|
callAddColumm();
|
|
|
|
|
break;
|
|
|
|
|
case DIMENSION:
|
|
|
|
|
ColumnData columnReference = comboColumnReferenceType
|
|
|
|
|
.getCurrentValue();
|
|
|
|
|
if (columnReference != null) {
|
|
|
|
|
defNewColumn = new DefNewColumn(labelS, type,
|
|
|
|
|
columnReference, defaultV);
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS,
|
|
|
|
|
type, columnReference, defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(trId,
|
|
|
|
|
defNewColumn);
|
|
|
|
|
columnMockUp);
|
|
|
|
|
callAddColumm();
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Attention",
|
|
|
|
@ -800,12 +797,12 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
PeriodDataType periodDataType = comboTimeDimensionType
|
|
|
|
|
.getCurrentValue();
|
|
|
|
|
if (periodDataType != null) {
|
|
|
|
|
defNewColumn = new DefNewColumn(labelS, type,
|
|
|
|
|
periodDataType, defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(trId,
|
|
|
|
|
defNewColumn);
|
|
|
|
|
callAddColumm();
|
|
|
|
|
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS,
|
|
|
|
|
type, periodDataType, defaultV);
|
|
|
|
|
addColumnSession = new AddColumnSession(trId,
|
|
|
|
|
columnMockUp);
|
|
|
|
|
callAddColumm();
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Attention",
|
|
|
|
|
"Time Dimension type not selected!");
|
|
|
|
@ -825,6 +822,118 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected ColumnMockUp retrieveColumnMockUp() {
|
|
|
|
|
ColumnMockUp columnMockUp = null;
|
|
|
|
|
|
|
|
|
|
String labelS = label.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, null, labelS,
|
|
|
|
|
type, dataType, "");
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Attention",
|
|
|
|
|
"Column data type not selected!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Attention",
|
|
|
|
|
"Column data type not selected!");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case ATTRIBUTE:
|
|
|
|
|
columnDataTypeElement = comboAttributeType
|
|
|
|
|
.getCurrentValue();
|
|
|
|
|
if (columnDataTypeElement != null) {
|
|
|
|
|
ColumnDataType dataType = columnDataTypeElement
|
|
|
|
|
.getType();
|
|
|
|
|
if (dataType != null) {
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS,
|
|
|
|
|
type, dataType, "");
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Attention",
|
|
|
|
|
"Column data type not selected!");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Attention",
|
|
|
|
|
"Column data type not selected!");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CODE:
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS, type,
|
|
|
|
|
"");
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case CODENAME:
|
|
|
|
|
LocaleTypeElement locale = comboLocaleType
|
|
|
|
|
.getCurrentValue();
|
|
|
|
|
if (locale != null) {
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS,
|
|
|
|
|
type, locale.getLocaleName(), "");
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Attention", "No locale selected!");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case CODEDESCRIPTION:
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS, type,
|
|
|
|
|
"");
|
|
|
|
|
break;
|
|
|
|
|
case ANNOTATION:
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS, type,
|
|
|
|
|
"");
|
|
|
|
|
break;
|
|
|
|
|
case DIMENSION:
|
|
|
|
|
ColumnData columnReference = comboColumnReferenceType
|
|
|
|
|
.getCurrentValue();
|
|
|
|
|
if (columnReference != null) {
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS,
|
|
|
|
|
type, columnReference, "");
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Attention",
|
|
|
|
|
"No column reference selected!");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case TIMEDIMENSION:
|
|
|
|
|
PeriodDataType periodDataType = comboTimeDimensionType
|
|
|
|
|
.getCurrentValue();
|
|
|
|
|
if (periodDataType != null) {
|
|
|
|
|
columnMockUp = new ColumnMockUp(null, null, labelS,
|
|
|
|
|
type, periodDataType, "");
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Attention",
|
|
|
|
|
"Time Dimension type not selected!");
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
UtilsGXT3.alert("Attention",
|
|
|
|
|
"This column type is not supported now!");
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Attention", "Select a column type!");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
UtilsGXT3.alert("Attntion", "Insert a valid label!");
|
|
|
|
|
}
|
|
|
|
|
return columnMockUp;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void callAddColumm() {
|
|
|
|
|
Log.debug(addColumnSession.toString());
|
|
|
|
|
TDGWTServiceAsync.INSTANCE.startAddColumn(addColumnSession,
|
|
|
|
@ -978,8 +1087,7 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void retrievePeriodDataType() {
|
|
|
|
|
TDGWTServiceAsync.INSTANCE
|
|
|
|
|
.getPeriodDataTypes(new AsyncCallback<ArrayList<PeriodDataType>>() {
|
|
|
|
@ -1001,12 +1109,13 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
caught.getLocalizedMessage());
|
|
|
|
|
} else {
|
|
|
|
|
Log.debug(caught.getLocalizedMessage());
|
|
|
|
|
UtilsGXT3.alert("Error retrieving period type",
|
|
|
|
|
UtilsGXT3.alert(
|
|
|
|
|
"Error retrieving period type",
|
|
|
|
|
caught.getLocalizedMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -1014,12 +1123,11 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
storeComboTimeDimensionType.clear();
|
|
|
|
|
storeComboTimeDimensionType.addAll(result);
|
|
|
|
|
storeComboTimeDimensionType.commitChanges();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected void setLocale(String locale) {
|
|
|
|
|
for (LocaleTypeElement loc : storeComboLocaleType.getAll()) {
|
|
|
|
@ -1047,7 +1155,8 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
public void operationComplete(OperationResult operationResult) {
|
|
|
|
|
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
|
|
|
|
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
|
|
|
|
ChangeTableRequestType.ADDCOLUMN, operationResult.getTrId(), why);
|
|
|
|
|
ChangeTableRequestType.ADDCOLUMN, operationResult.getTrId(),
|
|
|
|
|
why);
|
|
|
|
|
eventBus.fireEvent(changeTableRequestEvent);
|
|
|
|
|
close();
|
|
|
|
|
}
|
|
|
|
@ -1060,10 +1169,12 @@ public class AddColumnPanel extends FramedPanel implements
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void operationStopped(OperationResult operationResult, String reason, String details) {
|
|
|
|
|
public void operationStopped(OperationResult operationResult,
|
|
|
|
|
String reason, String details) {
|
|
|
|
|
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
|
|
|
|
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
|
|
|
|
ChangeTableRequestType.ADDCOLUMN, operationResult.getTrId(), why);
|
|
|
|
|
ChangeTableRequestType.ADDCOLUMN, operationResult.getTrId(),
|
|
|
|
|
why);
|
|
|
|
|
eventBus.fireEvent(changeTableRequestEvent);
|
|
|
|
|
close();
|
|
|
|
|
|
|
|
|
|