Updated AddColumn
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@113836 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
639a7aa11b
commit
51bc2bbd8e
|
@ -20,6 +20,8 @@ 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;
|
||||||
import org.gcube.portlets.user.td.expressionwidget.client.expression.ExpressionWrapperNotification.ExpressionWrapperNotificationListener;
|
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.expressionwidget.client.expression.ReplaceExpressionDialog;
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.client.resources.ExpressionResources;
|
||||||
|
import org.gcube.portlets.user.td.expressionwidget.client.rpc.ExpressionServiceAsync;
|
||||||
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
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.TDGWTIsFinalException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||||
|
@ -50,8 +52,8 @@ import com.google.gwt.event.dom.client.ClickEvent;
|
||||||
import com.google.gwt.event.dom.client.ClickHandler;
|
import com.google.gwt.event.dom.client.ClickHandler;
|
||||||
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.regexp.shared.MatchResult;
|
//import com.google.gwt.regexp.shared.MatchResult;
|
||||||
import com.google.gwt.regexp.shared.RegExp;
|
//import com.google.gwt.regexp.shared.RegExp;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
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;
|
||||||
|
@ -61,6 +63,10 @@ import com.sencha.gxt.data.shared.LabelProvider;
|
||||||
import com.sencha.gxt.data.shared.ListStore;
|
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.BoxLayoutPack;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer;
|
||||||
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.VerticalLayoutData;
|
||||||
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
import com.sencha.gxt.widget.core.client.event.SelectEvent;
|
||||||
|
@ -79,8 +85,8 @@ import com.sencha.gxt.widget.core.client.info.Info;
|
||||||
*/
|
*/
|
||||||
public class AddColumnPanel extends FramedPanel implements
|
public class AddColumnPanel extends FramedPanel implements
|
||||||
CodelistSelectionListener, MonitorDialogListener {
|
CodelistSelectionListener, MonitorDialogListener {
|
||||||
private static final String GEOMETRY_REGEXPR = "(\\s*POINT\\s*\\(\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*\\)\\s*$)"
|
//private static final String GEOMETRY_REGEXPR = "(\\s*POINT\\s*\\(\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*\\)\\s*$)"
|
||||||
+ "|(\\s*LINESTRING\\s*\\((\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*,)+\\s*((-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*)\\)\\s*$)";
|
// + "|(\\s*LINESTRING\\s*\\((\\s*(-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*,)+\\s*((-)?\\d+(\\.\\d+)?\\s+(-)?\\d+(\\.\\d+)?\\s*)\\)\\s*$)";
|
||||||
|
|
||||||
private static final String WIDTH = "640px";
|
private static final String WIDTH = "640px";
|
||||||
private static final String HEIGHT = "520px";
|
private static final String HEIGHT = "520px";
|
||||||
|
@ -123,6 +129,9 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
private TextField defaultValueString;
|
private TextField defaultValueString;
|
||||||
private FieldLabel defaultStringLabel;
|
private FieldLabel defaultStringLabel;
|
||||||
|
|
||||||
|
private ExpressionWrapper exWrapper;
|
||||||
|
private TextButton btnRemoveExpression;
|
||||||
|
|
||||||
// private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
|
// private DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -167,10 +176,17 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
// Label
|
// Label
|
||||||
label = new TextField();
|
label = new TextField();
|
||||||
|
|
||||||
|
|
||||||
|
//Flow Expression
|
||||||
|
HBoxLayoutContainer flowExpression = new HBoxLayoutContainer();
|
||||||
|
flowExpression.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
|
flowExpression.setPack(BoxLayoutPack.START);
|
||||||
|
flowExpression.setAdjustForFlexRemainder(true);
|
||||||
|
|
||||||
// Default Value
|
// Default Value
|
||||||
defaultValueString = new TextField();
|
defaultValueString = new TextField();
|
||||||
defaultStringLabel = new FieldLabel(defaultValueString, "Expression");
|
//defaultValueString.setWidth("166px");
|
||||||
defaultStringLabel.addDomHandler(new ClickHandler() {
|
defaultValueString.addDomHandler(new ClickHandler() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(ClickEvent event) {
|
public void onClick(ClickEvent event) {
|
||||||
|
@ -179,6 +195,33 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
}, ClickEvent.getType());
|
}, ClickEvent.getType());
|
||||||
|
|
||||||
|
btnRemoveExpression = new TextButton();
|
||||||
|
btnRemoveExpression.setIcon(ExpressionResources.INSTANCE.delete());
|
||||||
|
btnRemoveExpression.setTitle("Remove expression");
|
||||||
|
btnRemoveExpression.addSelectHandler(new SelectHandler() {
|
||||||
|
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
Log.debug("Pressed Remove Expression");
|
||||||
|
removeExpression();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
btnRemoveExpression.setVisible(false);
|
||||||
|
|
||||||
|
BoxLayoutData flex1 = new BoxLayoutData(new Margins(0));
|
||||||
|
flex1.setFlex(0);
|
||||||
|
|
||||||
|
BoxLayoutData flex2 = new BoxLayoutData(new Margins(0));
|
||||||
|
flex2.setFlex(1);
|
||||||
|
|
||||||
|
flowExpression.add(btnRemoveExpression, flex1);
|
||||||
|
flowExpression.add(defaultValueString, flex2);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
defaultStringLabel = new FieldLabel(flowExpression, "Expression");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// comboColumnTypeCode
|
// comboColumnTypeCode
|
||||||
ColumnTypeCodeProperties propsColumnTypeCode = GWT
|
ColumnTypeCodeProperties propsColumnTypeCode = GWT
|
||||||
.create(ColumnTypeCodeProperties.class);
|
.create(ColumnTypeCodeProperties.class);
|
||||||
|
@ -385,6 +428,13 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void removeExpression() {
|
||||||
|
exWrapper=null;
|
||||||
|
defaultValueString.reset();
|
||||||
|
btnRemoveExpression.setVisible(false);
|
||||||
|
forceLayout();
|
||||||
|
}
|
||||||
|
|
||||||
protected void openReplaceExpressionDialog() {
|
protected void openReplaceExpressionDialog() {
|
||||||
ColumnMockUp columnMockUp = retrieveColumnMockUp();
|
ColumnMockUp columnMockUp = retrieveColumnMockUp();
|
||||||
if (columnMockUp != null) {
|
if (columnMockUp != null) {
|
||||||
|
@ -396,24 +446,31 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
@Override
|
@Override
|
||||||
public void onExpression(
|
public void onExpression(
|
||||||
ExpressionWrapperNotification expressionWrapperNotification) {
|
ExpressionWrapperNotification expressionWrapperNotification) {
|
||||||
ExpressionWrapper exWrapper=expressionWrapperNotification.getExpressionWrapper();
|
exWrapper = expressionWrapperNotification
|
||||||
|
.getExpressionWrapper();
|
||||||
if (exWrapper.isReplaceByValue()) {
|
if (exWrapper.isReplaceByValue()) {
|
||||||
defaultValueString.setValue(exWrapper.getReplaceValue());
|
defaultValueString.setValue(exWrapper
|
||||||
|
.getReplaceValue());
|
||||||
} else {
|
} else {
|
||||||
defaultValueString.setValue(exWrapper.getReplaceExpressionContainer().getReadableExpression());
|
defaultValueString.setValue(exWrapper
|
||||||
|
.getReplaceExpressionContainer()
|
||||||
|
.getReadableExpression());
|
||||||
}
|
}
|
||||||
|
btnRemoveExpression.setVisible(true);
|
||||||
|
forceLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void failed(Throwable throwable) {
|
public void failed(Throwable throwable) {
|
||||||
Log.error("Error in AddColumn during expression creation:"+throwable.getLocalizedMessage());
|
Log.error("Error in AddColumn during expression creation:"
|
||||||
|
+ throwable.getLocalizedMessage());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void aborted() {
|
public void aborted() {
|
||||||
defaultValueString.setValue(null);
|
|
||||||
Log.debug("Expression creation aborted");
|
Log.debug("Expression creation aborted");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -586,7 +643,11 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
comboDimensionTypeLabel.setVisible(false);
|
comboDimensionTypeLabel.setVisible(false);
|
||||||
comboColumnReferenceTypeLabel.setVisible(false);
|
comboColumnReferenceTypeLabel.setVisible(false);
|
||||||
comboTimeDimensionTypeLabel.setVisible(false);
|
comboTimeDimensionTypeLabel.setVisible(false);
|
||||||
|
exWrapper=null;
|
||||||
|
defaultValueString.reset();
|
||||||
|
btnRemoveExpression.setVisible(false);
|
||||||
defaultStringLabel.setVisible(true);
|
defaultStringLabel.setVisible(true);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case ATTRIBUTE:
|
case ATTRIBUTE:
|
||||||
comboLocaleTypeLabel.setVisible(false);
|
comboLocaleTypeLabel.setVisible(false);
|
||||||
|
@ -613,6 +674,9 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
comboDimensionTypeLabel.setVisible(false);
|
comboDimensionTypeLabel.setVisible(false);
|
||||||
comboColumnReferenceTypeLabel.setVisible(false);
|
comboColumnReferenceTypeLabel.setVisible(false);
|
||||||
comboTimeDimensionTypeLabel.setVisible(false);
|
comboTimeDimensionTypeLabel.setVisible(false);
|
||||||
|
exWrapper=null;
|
||||||
|
defaultValueString.reset();
|
||||||
|
btnRemoveExpression.setVisible(false);
|
||||||
defaultStringLabel.setVisible(true);
|
defaultStringLabel.setVisible(true);
|
||||||
break;
|
break;
|
||||||
case TIMEDIMENSION:
|
case TIMEDIMENSION:
|
||||||
|
@ -631,6 +695,9 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
comboDimensionTypeLabel.setVisible(false);
|
comboDimensionTypeLabel.setVisible(false);
|
||||||
comboColumnReferenceTypeLabel.setVisible(false);
|
comboColumnReferenceTypeLabel.setVisible(false);
|
||||||
comboTimeDimensionTypeLabel.setVisible(false);
|
comboTimeDimensionTypeLabel.setVisible(false);
|
||||||
|
exWrapper=null;
|
||||||
|
defaultValueString.reset();
|
||||||
|
btnRemoveExpression.setVisible(false);
|
||||||
defaultStringLabel.setVisible(true);
|
defaultStringLabel.setVisible(true);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -644,6 +711,9 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
|
|
||||||
protected void updateAttributeType(ColumnDataType type) {
|
protected void updateAttributeType(ColumnDataType type) {
|
||||||
Log.debug("Update ColumnTypeCode " + type.toString());
|
Log.debug("Update ColumnTypeCode " + type.toString());
|
||||||
|
exWrapper=null;
|
||||||
|
defaultValueString.reset();
|
||||||
|
btnRemoveExpression.setVisible(false);
|
||||||
defaultStringLabel.setVisible(true);
|
defaultStringLabel.setVisible(true);
|
||||||
forceLayout();
|
forceLayout();
|
||||||
|
|
||||||
|
@ -682,8 +752,27 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
ColumnDataType dataType = columnDataTypeElement
|
ColumnDataType dataType = columnDataTypeElement
|
||||||
.getType();
|
.getType();
|
||||||
if (dataType != null) {
|
if (dataType != null) {
|
||||||
columnMockUp = new ColumnMockUp(null, null, labelS,
|
if (defaultV == null || defaultV.isEmpty()) {
|
||||||
type, dataType, defaultV);
|
columnMockUp = new ColumnMockUp(null, null,
|
||||||
|
labelS, type, dataType, defaultV);
|
||||||
|
} else {
|
||||||
|
if (exWrapper.isReplaceByValue()) {
|
||||||
|
columnMockUp = new ColumnMockUp(null, null,
|
||||||
|
labelS, type, dataType,
|
||||||
|
exWrapper.getReplaceValue());
|
||||||
|
} else {
|
||||||
|
columnMockUp = new ColumnMockUp(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
labelS,
|
||||||
|
type,
|
||||||
|
dataType,
|
||||||
|
exWrapper
|
||||||
|
.getReplaceExpressionContainer()
|
||||||
|
.getExp());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
addColumnSession = new AddColumnSession(trId,
|
addColumnSession = new AddColumnSession(trId,
|
||||||
columnMockUp);
|
columnMockUp);
|
||||||
callAddColumm();
|
callAddColumm();
|
||||||
|
@ -705,34 +794,95 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
.getType();
|
.getType();
|
||||||
if (dataType != null) {
|
if (dataType != null) {
|
||||||
if (dataType == ColumnDataType.Geometry) {
|
if (dataType == ColumnDataType.Geometry) {
|
||||||
RegExp regExp = RegExp
|
// RegExp regExp = RegExp
|
||||||
.compile(GEOMETRY_REGEXPR);
|
// .compile(GEOMETRY_REGEXPR);
|
||||||
MatchResult matcher = regExp.exec(defaultV);
|
// MatchResult matcher = regExp.exec(defaultV);
|
||||||
boolean matchFound = matcher != null;
|
// boolean matchFound = matcher != null;
|
||||||
if (matchFound) {
|
// if (matchFound) {
|
||||||
|
if (defaultV == null || defaultV.isEmpty()) {
|
||||||
columnMockUp = new ColumnMockUp(null, null,
|
columnMockUp = new ColumnMockUp(null, null,
|
||||||
labelS, type, dataType, defaultV);
|
labelS, type, dataType, defaultV);
|
||||||
addColumnSession = new AddColumnSession(
|
|
||||||
trId, columnMockUp);
|
|
||||||
callAddColumm();
|
|
||||||
} else {
|
} else {
|
||||||
UtilsGXT3
|
if (exWrapper.isReplaceByValue()) {
|
||||||
.alert("Attention",
|
columnMockUp = new ColumnMockUp(null,
|
||||||
"The default value is not a valid text representation for geometry type ( e.g. POINT(34 56) or LINESTRING(65 34, 56.43 78.65)!");
|
null, labelS, type, dataType,
|
||||||
|
exWrapper.getReplaceValue());
|
||||||
|
} else {
|
||||||
|
columnMockUp = new ColumnMockUp(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
labelS,
|
||||||
|
type,
|
||||||
|
dataType,
|
||||||
|
exWrapper
|
||||||
|
.getReplaceExpressionContainer()
|
||||||
|
.getExp());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
addColumnSession = new AddColumnSession(trId,
|
||||||
|
columnMockUp);
|
||||||
|
callAddColumm();
|
||||||
|
// } else {
|
||||||
|
// UtilsGXT3
|
||||||
|
// .alert("Attention",
|
||||||
|
// "The default value is not a valid text representation for geometry type ( e.g. POINT(34 56) or LINESTRING(65 34, 56.43 78.65)!");
|
||||||
|
// }
|
||||||
} else {
|
} else {
|
||||||
if (dataType == ColumnDataType.Date) {
|
if (dataType == ColumnDataType.Date) {
|
||||||
columnMockUp = new ColumnMockUp(null, null,
|
if (defaultV == null || defaultV.isEmpty()) {
|
||||||
labelS, type, dataType, defaultV);
|
columnMockUp = new ColumnMockUp(null,
|
||||||
|
null, labelS, type, dataType,
|
||||||
|
defaultV);
|
||||||
|
} else {
|
||||||
|
if (exWrapper.isReplaceByValue()) {
|
||||||
|
columnMockUp = new ColumnMockUp(
|
||||||
|
null, null, labelS, type,
|
||||||
|
dataType,
|
||||||
|
exWrapper.getReplaceValue());
|
||||||
|
} else {
|
||||||
|
columnMockUp = new ColumnMockUp(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
labelS,
|
||||||
|
type,
|
||||||
|
dataType,
|
||||||
|
exWrapper
|
||||||
|
.getReplaceExpressionContainer()
|
||||||
|
.getExp());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
addColumnSession = new AddColumnSession(
|
addColumnSession = new AddColumnSession(
|
||||||
trId, columnMockUp);
|
trId, columnMockUp);
|
||||||
|
|
||||||
callAddColumm();
|
callAddColumm();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
if (defaultV == null || defaultV.isEmpty()) {
|
||||||
columnMockUp = new ColumnMockUp(null, null,
|
columnMockUp = new ColumnMockUp(null, null,
|
||||||
labelS, type, dataType, defaultV);
|
labelS, type, dataType, defaultV);
|
||||||
addColumnSession = new AddColumnSession(
|
} else {
|
||||||
trId, columnMockUp);
|
if (exWrapper.isReplaceByValue()) {
|
||||||
|
columnMockUp = new ColumnMockUp(null, null,
|
||||||
|
labelS, type, dataType,
|
||||||
|
exWrapper.getReplaceValue());
|
||||||
|
} else {
|
||||||
|
columnMockUp = new ColumnMockUp(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
labelS,
|
||||||
|
type,
|
||||||
|
dataType,
|
||||||
|
exWrapper
|
||||||
|
.getReplaceExpressionContainer()
|
||||||
|
.getExp());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addColumnSession = new AddColumnSession(trId,
|
||||||
|
columnMockUp);
|
||||||
callAddColumm();
|
callAddColumm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -748,17 +898,56 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CODE:
|
case CODE:
|
||||||
columnMockUp = new ColumnMockUp(null, null, labelS, type,
|
case CODEDESCRIPTION:
|
||||||
defaultV);
|
case ANNOTATION:
|
||||||
addColumnSession = new AddColumnSession(trId, columnMockUp);
|
if (defaultV == null || defaultV.isEmpty()) {
|
||||||
|
columnMockUp = new ColumnMockUp(null, null,
|
||||||
|
labelS, type, defaultV);
|
||||||
|
} else {
|
||||||
|
if (exWrapper.isReplaceByValue()) {
|
||||||
|
columnMockUp = new ColumnMockUp(null, null,
|
||||||
|
labelS, type,
|
||||||
|
exWrapper.getReplaceValue());
|
||||||
|
} else {
|
||||||
|
columnMockUp = new ColumnMockUp(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
labelS,
|
||||||
|
type,
|
||||||
|
exWrapper
|
||||||
|
.getReplaceExpressionContainer()
|
||||||
|
.getExp());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
addColumnSession = new AddColumnSession(trId,
|
||||||
|
columnMockUp);
|
||||||
callAddColumm();
|
callAddColumm();
|
||||||
break;
|
break;
|
||||||
case CODENAME:
|
case CODENAME:
|
||||||
LocaleTypeElement locale = comboLocaleType
|
LocaleTypeElement locale = comboLocaleType
|
||||||
.getCurrentValue();
|
.getCurrentValue();
|
||||||
if (locale != null) {
|
if (locale != null) {
|
||||||
columnMockUp = new ColumnMockUp(null, null, labelS,
|
if (defaultV == null || defaultV.isEmpty()) {
|
||||||
type, locale.getLocaleName(), defaultV);
|
columnMockUp = new ColumnMockUp(null, null,
|
||||||
|
labelS, type,locale.getLocaleName(), defaultV);
|
||||||
|
} else {
|
||||||
|
if (exWrapper.isReplaceByValue()) {
|
||||||
|
columnMockUp = new ColumnMockUp(null, null,
|
||||||
|
labelS, type, locale.getLocaleName(),
|
||||||
|
exWrapper.getReplaceValue());
|
||||||
|
} else {
|
||||||
|
columnMockUp = new ColumnMockUp(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
labelS,
|
||||||
|
type,locale.getLocaleName(),
|
||||||
|
exWrapper
|
||||||
|
.getReplaceExpressionContainer()
|
||||||
|
.getExp());
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
addColumnSession = new AddColumnSession(trId,
|
addColumnSession = new AddColumnSession(trId,
|
||||||
columnMockUp);
|
columnMockUp);
|
||||||
callAddColumm();
|
callAddColumm();
|
||||||
|
@ -766,18 +955,7 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
UtilsGXT3.alert("Attention", "No locale selected!");
|
UtilsGXT3.alert("Attention", "No locale selected!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CODEDESCRIPTION:
|
|
||||||
columnMockUp = new ColumnMockUp(null, null, labelS, type,
|
|
||||||
defaultV);
|
|
||||||
addColumnSession = new AddColumnSession(trId, columnMockUp);
|
|
||||||
callAddColumm();
|
|
||||||
break;
|
|
||||||
case ANNOTATION:
|
|
||||||
columnMockUp = new ColumnMockUp(null, null, labelS, type,
|
|
||||||
defaultV);
|
|
||||||
addColumnSession = new AddColumnSession(trId, columnMockUp);
|
|
||||||
callAddColumm();
|
|
||||||
break;
|
|
||||||
case DIMENSION:
|
case DIMENSION:
|
||||||
ColumnData columnReference = comboColumnReferenceType
|
ColumnData columnReference = comboColumnReferenceType
|
||||||
.getCurrentValue();
|
.getCurrentValue();
|
||||||
|
@ -871,6 +1049,8 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CODE:
|
case CODE:
|
||||||
|
case CODEDESCRIPTION:
|
||||||
|
case ANNOTATION:
|
||||||
columnMockUp = new ColumnMockUp(null, null, labelS, type,
|
columnMockUp = new ColumnMockUp(null, null, labelS, type,
|
||||||
"");
|
"");
|
||||||
break;
|
break;
|
||||||
|
@ -886,14 +1066,6 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
UtilsGXT3.alert("Attention", "No locale selected!");
|
UtilsGXT3.alert("Attention", "No locale selected!");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CODEDESCRIPTION:
|
|
||||||
columnMockUp = new ColumnMockUp(null, null, labelS, type,
|
|
||||||
"");
|
|
||||||
break;
|
|
||||||
case ANNOTATION:
|
|
||||||
columnMockUp = new ColumnMockUp(null, null, labelS, type,
|
|
||||||
"");
|
|
||||||
break;
|
|
||||||
case DIMENSION:
|
case DIMENSION:
|
||||||
ColumnData columnReference = comboColumnReferenceType
|
ColumnData columnReference = comboColumnReferenceType
|
||||||
.getCurrentValue();
|
.getCurrentValue();
|
||||||
|
@ -935,7 +1107,7 @@ public class AddColumnPanel extends FramedPanel implements
|
||||||
|
|
||||||
private void callAddColumm() {
|
private void callAddColumm() {
|
||||||
Log.debug(addColumnSession.toString());
|
Log.debug(addColumnSession.toString());
|
||||||
TDGWTServiceAsync.INSTANCE.startAddColumn(addColumnSession,
|
ExpressionServiceAsync.INSTANCE.startAddColumn(addColumnSession,
|
||||||
new AsyncCallback<String>() {
|
new AsyncCallback<String>() {
|
||||||
public void onFailure(Throwable caught) {
|
public void onFailure(Throwable caught) {
|
||||||
if (caught instanceof TDGWTSessionExpiredException) {
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
|
|
@ -50,6 +50,9 @@ 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.info.Info;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* This Panel is used only with Codelist,
|
||||||
|
* so only with CODE,CODENAME,CODEDESCRIPTION,ANNOTATION columns
|
||||||
|
*
|
||||||
*
|
*
|
||||||
* @author "Giancarlo Panichi"
|
* @author "Giancarlo Panichi"
|
||||||
*
|
*
|
||||||
|
@ -250,6 +253,7 @@ public class CreateDefColumnPanel extends FramedPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void save() {
|
protected void save() {
|
||||||
|
ColumnMockUp defNewColumn;
|
||||||
ColumnTypeCode currentType = null;
|
ColumnTypeCode currentType = null;
|
||||||
String localeName = null;
|
String localeName = null;
|
||||||
|
|
||||||
|
@ -280,7 +284,18 @@ public class CreateDefColumnPanel extends FramedPanel {
|
||||||
currentType = typeElement.getCode();
|
currentType = typeElement.getCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currentType != null && currentType == ColumnTypeCode.CODENAME) {
|
|
||||||
|
switch (currentType) {
|
||||||
|
case ATTRIBUTE:
|
||||||
|
return;
|
||||||
|
case CODE:
|
||||||
|
case CODEDESCRIPTION:
|
||||||
|
case ANNOTATION:
|
||||||
|
defNewColumn = new ColumnMockUp(null, null, lab, currentType,
|
||||||
|
valueDefault);
|
||||||
|
|
||||||
|
break;
|
||||||
|
case CODENAME:
|
||||||
if (localeElement == null) {
|
if (localeElement == null) {
|
||||||
UtilsGXT3.alert("Attention", "No locale selected");
|
UtilsGXT3.alert("Attention", "No locale selected");
|
||||||
btnSave.enable();
|
btnSave.enable();
|
||||||
|
@ -293,12 +308,21 @@ public class CreateDefColumnPanel extends FramedPanel {
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
localeName = localeElement.getLocaleName();
|
localeName = localeElement.getLocaleName();
|
||||||
|
defNewColumn = new ColumnMockUp(null, null, lab,
|
||||||
|
currentType, localeName, valueDefault);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
|
case DIMENSION:
|
||||||
|
return;
|
||||||
|
case MEASURE:
|
||||||
|
return;
|
||||||
|
case TIMEDIMENSION:
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
|
||||||
ColumnMockUp defNewColumn = new ColumnMockUp(null, null,
|
}
|
||||||
lab, currentType, localeName, valueDefault);
|
|
||||||
Log.debug("DefNewColumn:" + defNewColumn);
|
Log.debug("DefNewColumn:" + defNewColumn);
|
||||||
fireCompleted(defNewColumn);
|
fireCompleted(defNewColumn);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue