Updated Collateral Table
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-extractcodelist-widget@111579 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
b40852f708
commit
0af85614f6
2
pom.xml
2
pom.xml
|
@ -150,7 +150,7 @@
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- tabular-data-column-widget -->
|
<!-- tabular-data-column-widget-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.portlets.user</groupId>
|
<groupId>org.gcube.portlets.user</groupId>
|
||||||
<artifactId>tabular-data-column-widget</artifactId>
|
<artifactId>tabular-data-column-widget</artifactId>
|
||||||
|
|
|
@ -1,25 +1,38 @@
|
||||||
package org.gcube.portlets.user.td.extractcodelistwidget.client;
|
package org.gcube.portlets.user.td.extractcodelistwidget.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataPropertiesCombo;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||||
|
|
||||||
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.SelectionHandler;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||||
import com.google.gwt.user.client.Command;
|
import com.google.gwt.user.client.Command;
|
||||||
|
import com.google.gwt.user.client.ui.HasValue;
|
||||||
import com.google.gwt.user.client.ui.HorizontalPanel;
|
import com.google.gwt.user.client.ui.HorizontalPanel;
|
||||||
import com.google.gwt.user.client.ui.VerticalPanel;
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
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.core.client.util.ToggleGroup;
|
import com.sencha.gxt.core.client.util.ToggleGroup;
|
||||||
|
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.box.AlertMessageBox;
|
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
|
||||||
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.HideEvent;
|
import com.sencha.gxt.widget.core.client.event.HideEvent;
|
||||||
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
||||||
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
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.Radio;
|
import com.sencha.gxt.widget.core.client.form.Radio;
|
||||||
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.tips.ToolTip;
|
import com.sencha.gxt.widget.core.client.tips.ToolTip;
|
||||||
import com.sencha.gxt.widget.core.client.tips.ToolTipConfig;
|
import com.sencha.gxt.widget.core.client.tips.ToolTipConfig;
|
||||||
|
|
||||||
|
@ -30,14 +43,13 @@ import com.sencha.gxt.widget.core.client.tips.ToolTipConfig;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ExtractCodelistDetailsCard extends WizardCard {
|
public class ExtractCodelistDetailsCard extends WizardCard {
|
||||||
//private static DateTimeFormat sdf = DateTimeFormat.getFormat("yyyy-MM-dd");
|
// private static DateTimeFormat sdf =
|
||||||
|
// DateTimeFormat.getFormat("yyyy-MM-dd");
|
||||||
|
|
||||||
private static final String TABLEDETAILPANELWIDTH = "100%";
|
private static final String TABLEDETAILPANELWIDTH = "100%";
|
||||||
private static final String TABLEDETAILPANELHEIGHT = "100%";
|
private static final String TABLEDETAILPANELHEIGHT = "100%";
|
||||||
private static final String FORMWIDTH = "538px";
|
private static final String FORMWIDTH = "538px";
|
||||||
|
|
||||||
|
|
||||||
private ExtractCodelistSession extractCodelistSession;
|
private ExtractCodelistSession extractCodelistSession;
|
||||||
private ExtractCodelistDetailsCard thisCard;
|
private ExtractCodelistDetailsCard thisCard;
|
||||||
|
|
||||||
|
@ -49,12 +61,17 @@ public class ExtractCodelistDetailsCard extends WizardCard {
|
||||||
private Radio automaticallyAttachFalse;
|
private Radio automaticallyAttachFalse;
|
||||||
|
|
||||||
private TabResource detail;
|
private TabResource detail;
|
||||||
|
private ComboBox<ColumnData> comboAttachToColumn;
|
||||||
|
private ColumnData attachColumn;
|
||||||
|
private FieldLabel attachToColumnField;
|
||||||
|
|
||||||
public ExtractCodelistDetailsCard(final ExtractCodelistSession extractCodelistSession) {
|
public ExtractCodelistDetailsCard(
|
||||||
|
final ExtractCodelistSession extractCodelistSession) {
|
||||||
super("Codelist Detail", "");
|
super("Codelist Detail", "");
|
||||||
|
|
||||||
this.extractCodelistSession = extractCodelistSession;
|
this.extractCodelistSession = extractCodelistSession;
|
||||||
thisCard = this;
|
thisCard = this;
|
||||||
|
attachColumn = null;
|
||||||
|
|
||||||
tableDetailPanel = new VerticalPanel();
|
tableDetailPanel = new VerticalPanel();
|
||||||
|
|
||||||
|
@ -78,10 +95,10 @@ public class ExtractCodelistDetailsCard extends WizardCard {
|
||||||
name.setAllowBlank(false);
|
name.setAllowBlank(false);
|
||||||
name.setEmptyText("Enter a name...");
|
name.setEmptyText("Enter a name...");
|
||||||
name.setAllowBlank(false);
|
name.setAllowBlank(false);
|
||||||
p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1,new Margins(0)));
|
p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1,
|
||||||
|
new Margins(0)));
|
||||||
|
|
||||||
|
// /
|
||||||
///
|
|
||||||
automaticallyAttachTrue = new Radio();
|
automaticallyAttachTrue = new Radio();
|
||||||
automaticallyAttachTrue.setBoxLabel("True");
|
automaticallyAttachTrue.setBoxLabel("True");
|
||||||
automaticallyAttachTrue.setValue(true);
|
automaticallyAttachTrue.setValue(true);
|
||||||
|
@ -93,29 +110,107 @@ public class ExtractCodelistDetailsCard extends WizardCard {
|
||||||
automticallyAttachGroup.add(automaticallyAttachTrue);
|
automticallyAttachGroup.add(automaticallyAttachTrue);
|
||||||
automticallyAttachGroup.add(automaticallyAttachFalse);
|
automticallyAttachGroup.add(automaticallyAttachFalse);
|
||||||
|
|
||||||
|
automticallyAttachGroup
|
||||||
|
.addValueChangeHandler(new ValueChangeHandler<HasValue<Boolean>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChange(
|
||||||
|
ValueChangeEvent<HasValue<Boolean>> event) {
|
||||||
|
try {
|
||||||
|
if (automaticallyAttachTrue.getValue()) {
|
||||||
|
attachToColumnField.setVisible(true);
|
||||||
|
} else {
|
||||||
|
attachToColumnField.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
thisCard.forceLayout();
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("ToggleGroup: onValueChange "
|
||||||
|
+ e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
HorizontalPanel automaticallyAttachPanel = new HorizontalPanel();
|
HorizontalPanel automaticallyAttachPanel = new HorizontalPanel();
|
||||||
automaticallyAttachPanel.add(automaticallyAttachTrue);
|
automaticallyAttachPanel.add(automaticallyAttachTrue);
|
||||||
automaticallyAttachPanel.add(automaticallyAttachFalse);
|
automaticallyAttachPanel.add(automaticallyAttachFalse);
|
||||||
|
|
||||||
new ToolTip(automaticallyAttachPanel, new ToolTipConfig(
|
new ToolTip(automaticallyAttachPanel, new ToolTipConfig(
|
||||||
"Automatically attach the generated codelist"));
|
"Automatically attach the generated codelist"));
|
||||||
FieldLabel fieldAttach=new FieldLabel(automaticallyAttachPanel, "Attach");
|
FieldLabel fieldAttach = new FieldLabel(automaticallyAttachPanel,
|
||||||
|
"Attach");
|
||||||
p.add(fieldAttach, new VerticalLayoutData(1, -1, new Margins(0)));
|
p.add(fieldAttach, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
|
||||||
|
// //
|
||||||
|
|
||||||
|
// Column Data
|
||||||
|
ColumnDataPropertiesCombo propsColumnData = GWT
|
||||||
|
.create(ColumnDataPropertiesCombo.class);
|
||||||
|
ListStore<ColumnData> storeCombo = new ListStore<ColumnData>(
|
||||||
|
propsColumnData.id());
|
||||||
|
storeCombo.addAll(extractCodelistSession.getSourceColumns());
|
||||||
|
|
||||||
|
comboAttachToColumn = new ComboBox<ColumnData>(storeCombo,
|
||||||
|
propsColumnData.label());
|
||||||
|
|
||||||
|
Log.trace("Combo AttachToColumn created");
|
||||||
|
addHandlersForComboAttachToColumn(propsColumnData.label());
|
||||||
|
|
||||||
|
comboAttachToColumn.setEmptyText("Select a column...");
|
||||||
|
comboAttachToColumn.setWidth(191);
|
||||||
|
comboAttachToColumn.setTypeAhead(false);
|
||||||
|
comboAttachToColumn.setEditable(false);
|
||||||
|
comboAttachToColumn.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
attachToColumnField = new FieldLabel(comboAttachToColumn,
|
||||||
|
"Attach To Column");
|
||||||
|
|
||||||
|
p.add(attachToColumnField,
|
||||||
|
new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
|
||||||
|
// /
|
||||||
tableDetailPanel.add(form);
|
tableDetailPanel.add(form);
|
||||||
|
|
||||||
setContent(tableDetailPanel);
|
setContent(tableDetailPanel);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param label
|
||||||
|
*/
|
||||||
|
private void addHandlersForComboAttachToColumn(
|
||||||
|
final LabelProvider<ColumnData> label) {
|
||||||
|
comboAttachToColumn
|
||||||
|
.addSelectionHandler(new SelectionHandler<ColumnData>() {
|
||||||
|
public void onSelection(SelectionEvent<ColumnData> event) {
|
||||||
|
Info.display(
|
||||||
|
"Column Selected",
|
||||||
|
"You selected "
|
||||||
|
+ (event.getSelectedItem() == null ? "nothing"
|
||||||
|
: label.getLabel(event
|
||||||
|
.getSelectedItem())
|
||||||
|
+ "!"));
|
||||||
|
Log.debug("ComboAttachToColumn selected: "
|
||||||
|
+ event.getSelectedItem());
|
||||||
|
ColumnData column = event.getSelectedItem();
|
||||||
|
updateAttachColumn(column);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateAttachColumn(ColumnData column) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setup() {
|
public void setup() {
|
||||||
Command sayNextCard = new Command() {
|
Command sayNextCard = new Command() {
|
||||||
|
|
||||||
|
|
||||||
public void execute() {
|
public void execute() {
|
||||||
checkData();
|
checkData();
|
||||||
}
|
}
|
||||||
|
@ -155,40 +250,46 @@ public class ExtractCodelistDetailsCard extends WizardCard {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (name.getValue() == null || name.getValue().isEmpty()
|
if (name.getValue() == null || name.getValue().isEmpty()
|
||||||
|| !name.isValid()
|
|| !name.isValid()) {
|
||||||
/*|| description.getValue() == null
|
|
||||||
|| description.getValue().isEmpty() || !description.isValid()
|
|
||||||
|| rights.getValue() == null || rights.getValue().isEmpty()
|
|
||||||
|| !rights.isValid()*/
|
|
||||||
|
|
||||||
) {
|
|
||||||
d = new AlertMessageBox("Attention!", "Fill name fields");
|
d = new AlertMessageBox("Attention!", "Fill name fields");
|
||||||
d.addHideHandler(hideHandler);
|
d.addHideHandler(hideHandler);
|
||||||
d.show();
|
d.show();
|
||||||
} else {
|
} else {
|
||||||
name.setReadOnly(true);
|
if (getAutomaticallyAttach()) {
|
||||||
/*description.setReadOnly(true);
|
attachColumn = comboAttachToColumn.getCurrentValue();
|
||||||
rights.setReadOnly(true);*/
|
if (attachColumn == null) {
|
||||||
goNext();
|
d = new AlertMessageBox("Attention!",
|
||||||
|
"Select column to attach codelist!");
|
||||||
|
d.addHideHandler(hideHandler);
|
||||||
|
d.show();
|
||||||
|
} else {
|
||||||
|
name.setReadOnly(true);
|
||||||
|
goNext();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
name.setReadOnly(true);
|
||||||
|
goNext();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean getAutomaticallyAttach() {
|
protected boolean getAutomaticallyAttach() {
|
||||||
if(automaticallyAttachTrue.getValue()){
|
if (automaticallyAttachTrue.getValue()) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void goNext() {
|
protected void goNext() {
|
||||||
try {
|
try {
|
||||||
detail= new TabResource();
|
detail = new TabResource();
|
||||||
detail.setName(name.getCurrentValue());
|
detail.setName(name.getCurrentValue());
|
||||||
|
|
||||||
extractCodelistSession.setTabResource(detail);
|
extractCodelistSession.setTabResource(detail);
|
||||||
extractCodelistSession.setAutomaticallyAttach(getAutomaticallyAttach());
|
extractCodelistSession
|
||||||
|
.setAutomaticallyAttach(getAutomaticallyAttach());
|
||||||
|
extractCodelistSession.setAttachColumn(attachColumn);
|
||||||
ExtractCodelistOperationInProgressCard extractCodelistOperationInProgressCard = new ExtractCodelistOperationInProgressCard(
|
ExtractCodelistOperationInProgressCard extractCodelistOperationInProgressCard = new ExtractCodelistOperationInProgressCard(
|
||||||
extractCodelistSession);
|
extractCodelistSession);
|
||||||
getWizardWindow().addCard(extractCodelistOperationInProgressCard);
|
getWizardWindow().addCard(extractCodelistOperationInProgressCard);
|
||||||
|
@ -196,6 +297,7 @@ public class ExtractCodelistDetailsCard extends WizardCard {
|
||||||
getWizardWindow().nextCard();
|
getWizardWindow().nextCard();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
||||||
|
name.setReadOnly(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,15 +3,23 @@
|
||||||
*/
|
*/
|
||||||
package org.gcube.portlets.user.td.extractcodelistwidget.client;
|
package org.gcube.portlets.user.td.extractcodelistwidget.client;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
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.TDGWTSessionExpiredException;
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
|
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistTargetColumn;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.ColumnData;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.column.type.ChangeColumnTypeSession;
|
||||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||||
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnDataType;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeCode;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.column.ColumnTypeMap;
|
||||||
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||||
|
|
||||||
import com.allen_sauer.gwt.log.client.Log;
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
@ -34,10 +42,13 @@ import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayou
|
||||||
public class ExtractCodelistOperationInProgressCard extends WizardCard
|
public class ExtractCodelistOperationInProgressCard extends WizardCard
|
||||||
implements MonitorDialogListener {
|
implements MonitorDialogListener {
|
||||||
|
|
||||||
protected ExtractCodelistOperationInProgressCard thisCard;
|
@SuppressWarnings("unused")
|
||||||
protected ExtractCodelistSession extractCodelistSession;
|
private ExtractCodelistOperationInProgressCard thisCard;
|
||||||
protected TRId newTrId;
|
private ExtractCodelistSession extractCodelistSession;
|
||||||
protected HtmlLayoutContainer resultField;
|
private TRId newTrId;
|
||||||
|
private HtmlLayoutContainer resultField;
|
||||||
|
private boolean automaticallyAttached;
|
||||||
|
private TRId collateralTRId;
|
||||||
|
|
||||||
public ExtractCodelistOperationInProgressCard(
|
public ExtractCodelistOperationInProgressCard(
|
||||||
final ExtractCodelistSession extractCodelistSession) {
|
final ExtractCodelistSession extractCodelistSession) {
|
||||||
|
@ -45,6 +56,7 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard
|
||||||
|
|
||||||
this.extractCodelistSession = extractCodelistSession;
|
this.extractCodelistSession = extractCodelistSession;
|
||||||
thisCard = this;
|
thisCard = this;
|
||||||
|
automaticallyAttached = false;
|
||||||
|
|
||||||
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
|
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
|
||||||
operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
|
operationInProgressPanel.setVBoxLayoutAlign(VBoxLayoutAlign.CENTER);
|
||||||
|
@ -83,6 +95,158 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setCollateralTRIdFinal(ArrayList<TRId> collateralIds) {
|
||||||
|
if (collateralIds == null || collateralIds.isEmpty()) {
|
||||||
|
showErrorAndHide("Error in extract codelist",
|
||||||
|
"An error occured setting collateral table final.",
|
||||||
|
"No collateral id retrieved", new Throwable(
|
||||||
|
"No collateral id retrieved"));
|
||||||
|
}
|
||||||
|
collateralTRId = collateralIds.get(0);
|
||||||
|
if (collateralTRId == null) {
|
||||||
|
showErrorAndHide("Error in extract codelist",
|
||||||
|
"An error occured setting collateral table final.",
|
||||||
|
"Collateral id is null", new Throwable(
|
||||||
|
"Collateral id is null"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
TDGWTServiceAsync.INSTANCE.setTabResourceToFinal(collateralTRId,
|
||||||
|
new AsyncCallback<Void>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(Void result) {
|
||||||
|
retrieveCollateralColumn();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
getEventBus()
|
||||||
|
.fireEvent(
|
||||||
|
new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
showErrorAndHide(
|
||||||
|
"Error in extract codelist",
|
||||||
|
"An error occured setting collateral table final.",
|
||||||
|
caught.getLocalizedMessage(), caught);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void retrieveCollateralColumn() {
|
||||||
|
TDGWTServiceAsync.INSTANCE.getColumnsForDimension(collateralTRId,
|
||||||
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
getEventBus()
|
||||||
|
.fireEvent(
|
||||||
|
new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
showErrorAndHide(
|
||||||
|
"Error in extract codelist",
|
||||||
|
"An error occured retrieving column on collateral table.",
|
||||||
|
caught.getLocalizedMessage(), caught);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSuccess(ArrayList<ColumnData> result) {
|
||||||
|
createChangeColumnSession(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createChangeColumnSession(ArrayList<ColumnData> refColumns){
|
||||||
|
ColumnData orig=extractCodelistSession.getAttachColumn();
|
||||||
|
ColumnTypeCode origColumnTypeCode= ColumnTypeMap.getColumnTypeCode(orig.getTypeCode());
|
||||||
|
ColumnDataType origColumnDataType= ColumnTypeMap.getColumnDataType(orig.getDataTypeName());
|
||||||
|
|
||||||
|
String labelOfAttachColumn=null;
|
||||||
|
ColumnTypeCode typeCodeOfColumnAttach=null;
|
||||||
|
for(ExtractCodelistTargetColumn targetCol:extractCodelistSession.getTargetColumns()){
|
||||||
|
if(targetCol.getSourceColumn().getColumnId().compareTo(orig.getColumnId())==0){
|
||||||
|
if(targetCol.isNewColumn()){
|
||||||
|
labelOfAttachColumn=targetCol.getDefColumn().getLabel();
|
||||||
|
typeCodeOfColumnAttach=targetCol.getDefColumn().getColumnType();
|
||||||
|
} else {
|
||||||
|
labelOfAttachColumn=targetCol.getTargetColumn().getLabel();
|
||||||
|
typeCodeOfColumnAttach=ColumnTypeMap.getColumnTypeCode(targetCol.getTargetColumn().getTypeCode());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnData codelistColumnReference=null;
|
||||||
|
|
||||||
|
if(labelOfAttachColumn==null){
|
||||||
|
showErrorAndHide(
|
||||||
|
"Error in extract codelist",
|
||||||
|
"An error occured no label retrieved for attach column",
|
||||||
|
"No label retrieved for attach column", new Throwable("No label retrieved for attach column"));
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
for(ColumnData refColumn:refColumns){
|
||||||
|
if(refColumn.getLabel().compareTo(labelOfAttachColumn)==0){
|
||||||
|
if(ColumnTypeMap.getColumnTypeCode(refColumn.getTypeCode()).compareTo(typeCodeOfColumnAttach)==0){
|
||||||
|
codelistColumnReference=refColumn;
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(codelistColumnReference!=null){
|
||||||
|
ColumnTypeCode columnTypeCodeTarget = ColumnTypeMap.getColumnTypeCode(codelistColumnReference.getTypeCode());
|
||||||
|
ColumnDataType columnDataTypeTarget = ColumnTypeMap.getColumnDataType(codelistColumnReference.getDataTypeName());
|
||||||
|
|
||||||
|
ChangeColumnTypeSession changeColumnTypeSession=new
|
||||||
|
ChangeColumnTypeSession(orig, origColumnTypeCode, origColumnDataType, columnTypeCodeTarget, columnDataTypeTarget, codelistColumnReference);
|
||||||
|
callChangeColumnType(changeColumnTypeSession);
|
||||||
|
} else {
|
||||||
|
showErrorAndHide(
|
||||||
|
"Error in extract codelist",
|
||||||
|
"An error occured no attach column match",
|
||||||
|
"No attach column match", new Throwable("No attach column match"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void callChangeColumnType(
|
||||||
|
ChangeColumnTypeSession changeColumnTypeSession) {
|
||||||
|
TDGWTServiceAsync.INSTANCE.startChangeColumnType(
|
||||||
|
changeColumnTypeSession, new AsyncCallback<String>() {
|
||||||
|
public void onFailure(Throwable caught) {
|
||||||
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
getEventBus().fireEvent(new SessionExpiredEvent(
|
||||||
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
|
} else {
|
||||||
|
showErrorAndHide(
|
||||||
|
"Error in extract codelist",
|
||||||
|
"An error occured on start change column type.",
|
||||||
|
caught.getLocalizedMessage(), caught);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSuccess(String taskId) {
|
||||||
|
automaticallyAttached=true;
|
||||||
|
openMonitorDialog(taskId);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setup() {
|
public void setup() {
|
||||||
getWizardWindow().setEnableBackButton(false);
|
getWizardWindow().setEnableBackButton(false);
|
||||||
|
@ -102,10 +266,22 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard
|
||||||
@Override
|
@Override
|
||||||
public void operationComplete(OperationResult operationResult) {
|
public void operationComplete(OperationResult operationResult) {
|
||||||
newTrId = operationResult.getTrId();
|
newTrId = operationResult.getTrId();
|
||||||
|
if (extractCodelistSession.isAutomaticallyAttach()) {
|
||||||
|
if (automaticallyAttached) {
|
||||||
|
updateOnComplete();
|
||||||
|
} else {
|
||||||
|
setCollateralTRIdFinal(operationResult.getCollateralTRIds());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
updateOnComplete();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void updateOnComplete() {
|
||||||
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
||||||
safeHtmlBuilder
|
safeHtmlBuilder
|
||||||
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold; color:#009900;'>Operation Completed</div>"
|
.appendHtmlConstant("<div style='display:block;margin:auto;text-align:center;font-size:large;font-weight:bold; color:#009900;'>Operation Completed</div>"
|
||||||
+ "<div style=' margin-top:30px;text-align:center;font-size:medium;font-weight:bold; color:black;'>The Codelists is available in the list of yours tabular resources</div>");
|
+ "<div style='display:block;margin:auto; margin-top:30px;text-align:center;font-size:medium;font-weight:bold; color:black;'>The Codelists is available in the list of yours tabular resources</div>");
|
||||||
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
||||||
resultField.setVisible(true);
|
resultField.setVisible(true);
|
||||||
Command sayComplete = new Command() {
|
Command sayComplete = new Command() {
|
||||||
|
@ -127,14 +303,13 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard
|
||||||
setNextButtonVisible(true);
|
setNextButtonVisible(true);
|
||||||
getWizardWindow().setEnableNextButton(true);
|
getWizardWindow().setEnableNextButton(true);
|
||||||
forceLayout();
|
forceLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void operationFailed(Throwable caught, String reason, String details) {
|
public void operationFailed(Throwable caught, String reason, String details) {
|
||||||
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
||||||
safeHtmlBuilder
|
safeHtmlBuilder
|
||||||
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color:red;'>Operation Failed</div>");
|
.appendHtmlConstant("<div style='display:block;margin:auto;text-align:center;font-size:large;font-weight:bold;color:red;'>Operation Failed</div>");
|
||||||
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
||||||
resultField.setVisible(true);
|
resultField.setVisible(true);
|
||||||
if (caught instanceof TDGWTSessionExpiredException) {
|
if (caught instanceof TDGWTSessionExpiredException) {
|
||||||
|
@ -143,18 +318,20 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard
|
||||||
new SessionExpiredEvent(
|
new SessionExpiredEvent(
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
} else {
|
} else {
|
||||||
showErrorAndHide("Error in Extract Codelist", reason, details, caught);
|
showErrorAndHide("Error in Extract Codelist", reason, details,
|
||||||
|
caught);
|
||||||
|
|
||||||
}
|
}
|
||||||
forceLayout();
|
forceLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void operationStopped(OperationResult operationResult, String reason, String details) {
|
public void operationStopped(OperationResult operationResult,
|
||||||
|
String reason, String details) {
|
||||||
newTrId = operationResult.getTrId();
|
newTrId = operationResult.getTrId();
|
||||||
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
||||||
safeHtmlBuilder
|
safeHtmlBuilder
|
||||||
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #FF9900;'>Problems in the Operation</div>");
|
.appendHtmlConstant("<div style='display:block;margin:auto;text-align:center;font-size:large;font-weight:bold;color: #FF9900;'>Problems in the Operation</div>");
|
||||||
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
||||||
resultField.setVisible(true);
|
resultField.setVisible(true);
|
||||||
|
|
||||||
|
@ -185,7 +362,7 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard
|
||||||
public void operationAborted() {
|
public void operationAborted() {
|
||||||
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
||||||
safeHtmlBuilder
|
safeHtmlBuilder
|
||||||
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #AA00AA;'>Operation Aborted</div>");
|
.appendHtmlConstant("<div style='diplay:block;margin:auto;text-align:center;font-size:large;font-weight:bold;color: #AA00AA;'>Operation Aborted</div>");
|
||||||
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
||||||
resultField.setVisible(true);
|
resultField.setVisible(true);
|
||||||
|
|
||||||
|
@ -215,7 +392,7 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard
|
||||||
public void operationPutInBackground() {
|
public void operationPutInBackground() {
|
||||||
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
SafeHtmlBuilder safeHtmlBuilder = new SafeHtmlBuilder();
|
||||||
safeHtmlBuilder
|
safeHtmlBuilder
|
||||||
.appendHtmlConstant("<div style='text-align:center;font-size:large;font-weight:bold;color: #00AAAA;'>Operation in Background</div>");
|
.appendHtmlConstant("<div style='display:block;margin:auto;text-align:center;font-size:large;font-weight:bold;color: #00AAAA;'>Operation in Background</div>");
|
||||||
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
resultField.setHTML(safeHtmlBuilder.toSafeHtml());
|
||||||
resultField.setVisible(true);
|
resultField.setVisible(true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue