Minor Update
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-extractcodelist-widget@96224 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
7d2a96e0fa
commit
2e5eae85e2
|
@ -0,0 +1,174 @@
|
||||||
|
package org.gcube.portlets.user.td.extractcodelistwidget.client;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.extract.ExtractCodelistSession;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
||||||
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.user.client.Command;
|
||||||
|
import com.google.gwt.user.client.ui.VerticalPanel;
|
||||||
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
|
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.VerticalLayoutData;
|
||||||
|
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.form.FieldLabel;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.FieldSet;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.TextArea;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author "Giancarlo Panichi" <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class ExtractCodelistDetailsCard extends WizardCard {
|
||||||
|
|
||||||
|
protected final String TABLEDETAILPANELWIDTH = "100%";
|
||||||
|
protected final String TABLEDETAILPANELHEIGHT = "100%";
|
||||||
|
protected final String FORMWIDTH = "538px";
|
||||||
|
|
||||||
|
protected ExtractCodelistSession extractCodelistSession;
|
||||||
|
protected ExtractCodelistDetailsCard thisCard;
|
||||||
|
|
||||||
|
protected VerticalLayoutContainer p;
|
||||||
|
protected VerticalPanel tableDetailPanel;
|
||||||
|
|
||||||
|
protected TextField name;
|
||||||
|
protected TextArea description;
|
||||||
|
protected TextArea rights;
|
||||||
|
|
||||||
|
protected TabResource detail = new TabResource();
|
||||||
|
|
||||||
|
public ExtractCodelistDetailsCard(final ExtractCodelistSession extractCodelistSession) {
|
||||||
|
super("Codelist Detail", "");
|
||||||
|
|
||||||
|
this.extractCodelistSession = extractCodelistSession;
|
||||||
|
thisCard = this;
|
||||||
|
|
||||||
|
tableDetailPanel = new VerticalPanel();
|
||||||
|
|
||||||
|
tableDetailPanel.setSpacing(4);
|
||||||
|
tableDetailPanel.setWidth(TABLEDETAILPANELWIDTH);
|
||||||
|
tableDetailPanel.setHeight(TABLEDETAILPANELHEIGHT);
|
||||||
|
|
||||||
|
FramedPanel form = new FramedPanel();
|
||||||
|
form.setHeadingText("Details");
|
||||||
|
form.setWidth(FORMWIDTH);
|
||||||
|
|
||||||
|
FieldSet fieldSet = new FieldSet();
|
||||||
|
fieldSet.setHeadingText("Information");
|
||||||
|
fieldSet.setCollapsible(false);
|
||||||
|
form.add(fieldSet);
|
||||||
|
|
||||||
|
p = new VerticalLayoutContainer();
|
||||||
|
fieldSet.add(p);
|
||||||
|
|
||||||
|
name = new TextField();
|
||||||
|
name.setAllowBlank(false);
|
||||||
|
name.setEmptyText("Enter a name...");
|
||||||
|
name.setAllowBlank(false);
|
||||||
|
p.add(new FieldLabel(name, "Name"), new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
|
description = new TextArea();
|
||||||
|
description.setAllowBlank(false);
|
||||||
|
description.setEmptyText("Enter a description...");
|
||||||
|
description.setValue("File CSV");
|
||||||
|
description.setAllowBlank(false);
|
||||||
|
p.add(new FieldLabel(description, "Description"),
|
||||||
|
new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
|
rights = new TextArea();
|
||||||
|
rights.setEmptyText("Enter rights...");
|
||||||
|
rights.setAllowBlank(false);
|
||||||
|
p.add(new FieldLabel(rights, "Rights"), new VerticalLayoutData(1, -1));
|
||||||
|
|
||||||
|
tableDetailPanel.add(form);
|
||||||
|
|
||||||
|
setContent(tableDetailPanel);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setup() {
|
||||||
|
Command sayNextCard = new Command() {
|
||||||
|
|
||||||
|
|
||||||
|
public void execute() {
|
||||||
|
checkData();
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
getWizardWindow().setNextButtonCommand(sayNextCard);
|
||||||
|
|
||||||
|
Command sayPreviousCard = new Command() {
|
||||||
|
public void execute() {
|
||||||
|
try {
|
||||||
|
getWizardWindow().previousCard();
|
||||||
|
getWizardWindow().removeCard(thisCard);
|
||||||
|
Log.info("Remove ExtractCodelistDetailsCard");
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("sayPreviousCard :" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
getWizardWindow().setPreviousButtonCommand(sayPreviousCard);
|
||||||
|
getWizardWindow().setEnableNextButton(true);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void checkData() {
|
||||||
|
getWizardWindow().setEnableNextButton(false);
|
||||||
|
getWizardWindow().setEnableBackButton(false);
|
||||||
|
AlertMessageBox d;
|
||||||
|
HideHandler hideHandler = new HideHandler() {
|
||||||
|
|
||||||
|
public void onHide(HideEvent event) {
|
||||||
|
getWizardWindow().setEnableNextButton(true);
|
||||||
|
getWizardWindow().setEnableBackButton(false);
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (name.getValue() == null || name.getValue().isEmpty()
|
||||||
|
|| !name.isValid() || description.getValue() == null
|
||||||
|
|| description.getValue().isEmpty() || !description.isValid()
|
||||||
|
|| rights.getValue() == null || rights.getValue().isEmpty()
|
||||||
|
|| !rights.isValid()
|
||||||
|
|
||||||
|
) {
|
||||||
|
d = new AlertMessageBox("Attention!", "Fill in all fields");
|
||||||
|
d.addHideHandler(hideHandler);
|
||||||
|
d.show();
|
||||||
|
} else {
|
||||||
|
name.setReadOnly(true);
|
||||||
|
description.setReadOnly(true);
|
||||||
|
rights.setReadOnly(true);
|
||||||
|
goNext();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void goNext() {
|
||||||
|
try {
|
||||||
|
detail.setName(name.getCurrentValue());
|
||||||
|
detail.setDescription(description.getCurrentValue());
|
||||||
|
detail.setRight(rights.getCurrentValue());
|
||||||
|
|
||||||
|
extractCodelistSession.setTabResource(detail);
|
||||||
|
|
||||||
|
ExtractCodelistOperationInProgressCard csvOperationInProgressCard = new ExtractCodelistOperationInProgressCard(
|
||||||
|
extractCodelistSession);
|
||||||
|
getWizardWindow().addCard(csvOperationInProgressCard);
|
||||||
|
Log.info("NextCard ExtractCodelistOperationInProgressCard");
|
||||||
|
getWizardWindow().nextCard();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -7,8 +7,8 @@ import org.gcube.portlets.user.td.extractcodelistwidget.client.progress.ExtractC
|
||||||
import org.gcube.portlets.user.td.extractcodelistwidget.client.progress.ExtractCodelistProgressListener;
|
import org.gcube.portlets.user.td.extractcodelistwidget.client.progress.ExtractCodelistProgressListener;
|
||||||
import org.gcube.portlets.user.td.extractcodelistwidget.client.progress.ExtractCodelistProgressUpdater;
|
import org.gcube.portlets.user.td.extractcodelistwidget.client.progress.ExtractCodelistProgressUpdater;
|
||||||
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.csv.CSVExportSession;
|
|
||||||
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.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.TRId;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
@ -39,13 +39,13 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard implement
|
||||||
|
|
||||||
public static final int STATUS_POLLING_DELAY = 1000;
|
public static final int STATUS_POLLING_DELAY = 1000;
|
||||||
protected ExtractCodelistOperationInProgressCard thisCard;
|
protected ExtractCodelistOperationInProgressCard thisCard;
|
||||||
protected CSVExportSession exportSession;
|
protected ExtractCodelistSession extractCodelistSession;
|
||||||
protected ExtractCodelistProgressUpdater progressUpdater;
|
protected ExtractCodelistProgressUpdater progressUpdater;
|
||||||
|
|
||||||
public ExtractCodelistOperationInProgressCard(final CSVExportSession exportSession) {
|
public ExtractCodelistOperationInProgressCard(final ExtractCodelistSession extractCodelistSession) {
|
||||||
super("Operation In Progress", "");
|
super("Operation In Progress", "");
|
||||||
|
|
||||||
this.exportSession = exportSession;
|
this.extractCodelistSession = extractCodelistSession;
|
||||||
thisCard = this;
|
thisCard = this;
|
||||||
|
|
||||||
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
|
VBoxLayoutContainer operationInProgressPanel = new VBoxLayoutContainer();
|
||||||
|
@ -59,18 +59,18 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard implement
|
||||||
|
|
||||||
// display:block;vertical-align:text-top;
|
// display:block;vertical-align:text-top;
|
||||||
description.setHTML(0, 0,
|
description.setHTML(0, 0,
|
||||||
"<span style=\"font-weight:bold;\";>Destination: </span>");
|
"<span style=\"font-weight:bold;\";>Name: </span>");
|
||||||
description.setText(0, 1, exportSession.getDestination().getName());
|
description.setText(0, 1, extractCodelistSession.getTabResource().getName());
|
||||||
description.setHTML(1, 0,
|
description.setHTML(1, 0,
|
||||||
"<span style=\"font-weight:bold;\";>File Name: </span>");
|
"<span style=\"font-weight:bold;\";>Agency: </span>");
|
||||||
description.setText(1, 1, exportSession.getFileName());
|
description.setText(1, 1, extractCodelistSession.getTabResource().getAgency());
|
||||||
|
|
||||||
description.setHTML(2, 0,
|
description.setHTML(2, 0,
|
||||||
"<span style=\"font-weight:bold;\";>File Description: </span>");
|
"<span style=\"font-weight:bold;\";>File Description: </span>");
|
||||||
description.setText(2, 1, exportSession.getFileDescription());
|
description.setText(2, 1, extractCodelistSession.getTabResource().getRight());
|
||||||
|
|
||||||
FramedPanel summary = new FramedPanel();
|
FramedPanel summary = new FramedPanel();
|
||||||
summary.setHeadingText("Export Summary");
|
summary.setHeadingText("Extract Summary");
|
||||||
summary.setWidth(400);
|
summary.setWidth(400);
|
||||||
summary.add(description);
|
summary.add(description);
|
||||||
operationInProgressPanel.add(summary, new BoxLayoutData(new Margins(20,
|
operationInProgressPanel.add(summary, new BoxLayoutData(new Margins(20,
|
||||||
|
@ -92,8 +92,8 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard implement
|
||||||
|
|
||||||
// columnToImportMask
|
// columnToImportMask
|
||||||
|
|
||||||
public void exportCSV() {
|
public void extractCodelist() {
|
||||||
TDGWTServiceAsync.INSTANCE.startCSVExport(exportSession,
|
TDGWTServiceAsync.INSTANCE.startExtractCodelist(extractCodelistSession,
|
||||||
new AsyncCallback<Void>() {
|
new AsyncCallback<Void>() {
|
||||||
|
|
||||||
public void onSuccess(Void result) {
|
public void onSuccess(Void result) {
|
||||||
|
@ -108,8 +108,8 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard implement
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
} else {
|
} else {
|
||||||
showErrorAndHide(
|
showErrorAndHide(
|
||||||
"Error in exportCSV",
|
"Error in extract codelist",
|
||||||
"An error occured in exportCSV: "
|
"An error occured in extract codelist: "
|
||||||
+ caught.getLocalizedMessage(),
|
+ caught.getLocalizedMessage(),
|
||||||
caught.getStackTrace().toString(), caught);
|
caught.getStackTrace().toString(), caught);
|
||||||
}
|
}
|
||||||
|
@ -124,7 +124,7 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard implement
|
||||||
setNextButtonVisible(false);
|
setNextButtonVisible(false);
|
||||||
getWizardWindow().setEnableNextButton(false);
|
getWizardWindow().setEnableNextButton(false);
|
||||||
getWizardWindow().setNextButtonToFinish();
|
getWizardWindow().setNextButtonToFinish();
|
||||||
exportCSV();
|
extractCodelist();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void operationInitializing() {
|
public void operationInitializing() {
|
||||||
|
@ -167,7 +167,7 @@ public class ExtractCodelistOperationInProgressCard extends WizardCard implement
|
||||||
SessionExpiredType.EXPIREDONSERVER));
|
SessionExpiredType.EXPIREDONSERVER));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
AlertMessageBox d = new AlertMessageBox("Error in CSV Export",
|
AlertMessageBox d = new AlertMessageBox("Error in Extract Codelist",
|
||||||
reason);
|
reason);
|
||||||
d.addHideHandler(new HideHandler() {
|
d.addHideHandler(new HideHandler() {
|
||||||
public void onHide(HideEvent event) {
|
public void onHide(HideEvent event) {
|
||||||
|
|
|
@ -59,6 +59,29 @@ public class TargetColumnsSelectionCard extends WizardCard {
|
||||||
protected void checkData() {
|
protected void checkData() {
|
||||||
getWizardWindow().setEnableNextButton(false);
|
getWizardWindow().setEnableNextButton(false);
|
||||||
getWizardWindow().setEnableBackButton(false);
|
getWizardWindow().setEnableBackButton(false);
|
||||||
|
if(targetColumnsSelectionPanel.updateExtractCodelistSession()){
|
||||||
|
goNext();
|
||||||
|
} else {
|
||||||
|
getWizardWindow().setEnableNextButton(true);
|
||||||
|
getWizardWindow().setEnableBackButton(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void goNext() {
|
||||||
|
try {
|
||||||
|
ExtractCodelistDetailsCard destCard= new ExtractCodelistDetailsCard(
|
||||||
|
extractCodelistSession);
|
||||||
|
getWizardWindow().addCard(destCard);
|
||||||
|
getWizardWindow().nextCard();
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log.error("sayNextCard :" + e.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void dispose() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.TableType;
|
||||||
|
|
||||||
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.core.client.GWT;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeEvent;
|
||||||
|
import com.google.gwt.event.logical.shared.ValueChangeHandler;
|
||||||
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
|
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
|
||||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||||
|
@ -31,13 +33,18 @@ import com.sencha.gxt.core.client.util.Margins;
|
||||||
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.HBoxLayoutContainer;
|
||||||
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
import com.sencha.gxt.widget.core.client.container.SimpleContainer;
|
||||||
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.BoxLayoutContainer.BoxLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
|
||||||
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;
|
||||||
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
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;
|
||||||
import com.sencha.gxt.widget.core.client.event.TriggerClickEvent.TriggerClickHandler;
|
import com.sencha.gxt.widget.core.client.event.TriggerClickEvent.TriggerClickHandler;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.CheckBox;
|
||||||
import com.sencha.gxt.widget.core.client.form.ComboBox;
|
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.TextField;
|
import com.sencha.gxt.widget.core.client.form.TextField;
|
||||||
|
@ -52,6 +59,9 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
|
||||||
public class TargetColumnsSelectionPanel extends FramedPanel implements
|
public class TargetColumnsSelectionPanel extends FramedPanel implements
|
||||||
CodelistSelectionListener {
|
CodelistSelectionListener {
|
||||||
|
|
||||||
|
protected static final String COMBO_COLUMN = "comboColumn";
|
||||||
|
protected static final String COMBO_DEF_COLUMN = "comboDefColumn";
|
||||||
|
protected static final String CHECK_NEW = "checkNew";
|
||||||
protected static final String WIDTH = "526px";
|
protected static final String WIDTH = "526px";
|
||||||
protected static final String HEIGHT = "378px";
|
protected static final String HEIGHT = "378px";
|
||||||
protected static final String FIELDWIDTH = "526px";
|
protected static final String FIELDWIDTH = "526px";
|
||||||
|
@ -259,25 +269,113 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
||||||
|
|
||||||
protected FieldLabel retrieveReferenceColumnLabel(int index,
|
protected FieldLabel retrieveReferenceColumnLabel(int index,
|
||||||
final ColumnData col, String label) {
|
final ColumnData col, String label) {
|
||||||
|
// comboDefColumn
|
||||||
|
ExtractCodelistDefColumnPropertiesCombo props = GWT
|
||||||
|
.create(ExtractCodelistDefColumnPropertiesCombo.class);
|
||||||
|
ListStore<DefNewColumn> storeComboDefColumn = new ListStore<DefNewColumn>(
|
||||||
|
props.id());
|
||||||
|
|
||||||
|
final ComboBox<DefNewColumn> comboDefColumn = new ComboBox<DefNewColumn>(
|
||||||
|
storeComboDefColumn, props.label());
|
||||||
|
comboDefColumn.setItemId(COMBO_DEF_COLUMN);
|
||||||
|
|
||||||
|
Log.debug("ComboDefColumn created");
|
||||||
|
|
||||||
|
final CreateDefColumnListener createDefColumnListener = new CreateDefColumnListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void failedDefColumnCreation(String reason, String details) {
|
||||||
|
Log.error("Change Value Failed:" + reason + " " + details);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void completedDefColumnCreation(DefNewColumn defNewColumn) {
|
||||||
|
comboDefColumn.setValue(defNewColumn);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void abortedDefColumnCreation() {
|
||||||
|
Log.debug("Change Value Aborted");
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
final String indexS = String.valueOf(index);
|
||||||
|
|
||||||
|
comboDefColumn.addTriggerClickHandler(new TriggerClickHandler() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onTriggerClick(TriggerClickEvent event) {
|
||||||
|
Log.debug("ComboDefColumn TriggerClickEvent");
|
||||||
|
comboDefColumn.collapse();
|
||||||
|
|
||||||
|
CreateDefColumnDialog createDefColumnDialog = new CreateDefColumnDialog(
|
||||||
|
indexS, TableType.CODELIST, parent.getEventBus());
|
||||||
|
createDefColumnDialog.addListener(createDefColumnListener);
|
||||||
|
createDefColumnDialog.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
comboDefColumn.setEmptyText("Select a new column...");
|
||||||
|
comboDefColumn.setWidth(COMBOWIDTH);
|
||||||
|
comboDefColumn.setEditable(false);
|
||||||
|
comboDefColumn.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// comboColumn
|
// comboColumn
|
||||||
ColumnDataPropertiesCombo props = GWT
|
ColumnDataPropertiesCombo propsCod = GWT
|
||||||
.create(ColumnDataPropertiesCombo.class);
|
.create(ColumnDataPropertiesCombo.class);
|
||||||
ListStore<ColumnData> storeComboColumn = new ListStore<ColumnData>(
|
ListStore<ColumnData> storeComboColumn = new ListStore<ColumnData>(
|
||||||
props.id());
|
propsCod.id());
|
||||||
storeComboColumn.addAll(connectionColumns);
|
storeComboColumn.addAll(connectionColumns);
|
||||||
|
|
||||||
final ComboBox<ColumnData> comboColumn = new ComboBox<ColumnData>(
|
final ComboBox<ColumnData> comboColumn = new ComboBox<ColumnData>(
|
||||||
storeComboColumn, props.label());
|
storeComboColumn, propsCod.label());
|
||||||
|
comboColumn.setItemId(COMBO_COLUMN);
|
||||||
|
|
||||||
Log.debug("ComboColumn created");
|
Log.debug("ComboColumn created");
|
||||||
|
|
||||||
comboColumn.setEmptyText("Select a Column...");
|
comboColumn.setEmptyText("Select from Codelist...");
|
||||||
comboColumn.setWidth(COMBOWIDTH);
|
comboColumn.setWidth(COMBOWIDTH);
|
||||||
comboColumn.setEditable(false);
|
comboColumn.setEditable(false);
|
||||||
comboColumn.setTriggerAction(TriggerAction.ALL);
|
comboColumn.setTriggerAction(TriggerAction.ALL);
|
||||||
|
|
||||||
|
CheckBox checkNew = new CheckBox();
|
||||||
|
checkNew.setItemId(CHECK_NEW);
|
||||||
|
checkNew.setEnabled(true);
|
||||||
|
checkNew.setBoxLabel("New");
|
||||||
|
checkNew.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||||
|
if(event.getValue()){
|
||||||
|
comboColumn.setVisible(false);
|
||||||
|
comboDefColumn.setVisible(true);
|
||||||
|
forceLayout();
|
||||||
|
} else {
|
||||||
|
comboColumn.setVisible(true);
|
||||||
|
comboDefColumn.setVisible(false);
|
||||||
|
forceLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
|
||||||
|
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
|
||||||
|
flowButton.setPack(BoxLayoutPack.START);
|
||||||
|
|
||||||
FieldLabel columnLabel = new FieldLabel(comboColumn, label);
|
flowButton.add(checkNew, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
|
flowButton.add(comboColumn, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
|
flowButton.add(comboDefColumn, new BoxLayoutData(new Margins(2, 4, 2, 4)));
|
||||||
|
|
||||||
|
FieldLabel columnLabel = new FieldLabel(flowButton, label);
|
||||||
columnLabel.setId(col.getColumnId());
|
columnLabel.setId(col.getColumnId());
|
||||||
|
comboDefColumn.setVisible(false);
|
||||||
return columnLabel;
|
return columnLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -380,9 +478,9 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
||||||
forceLayout();
|
forceLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateExtractCodelistSession() {
|
public boolean updateExtractCodelistSession() {
|
||||||
targetColumns = new ArrayList<ExtractCodelistTargetColumn>();
|
targetColumns = new ArrayList<ExtractCodelistTargetColumn>();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int lenght = formLayout.getWidgetCount();
|
int lenght = formLayout.getWidgetCount();
|
||||||
|
|
||||||
|
@ -399,18 +497,51 @@ public class TargetColumnsSelectionPanel extends FramedPanel implements
|
||||||
}
|
}
|
||||||
if (colCurrent == null) {
|
if (colCurrent == null) {
|
||||||
UtilsGXT3.alert("Error creating form", "Error creating form!");
|
UtilsGXT3.alert("Error creating form", "Error creating form!");
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
ComboBox<ColumnData> comboColumn = (ComboBox<ColumnData>) fieldLabel
|
if(connection==null){
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
ComboBox<DefNewColumn> comboDefColumn = (ComboBox<DefNewColumn>) fieldLabel
|
||||||
.getWidget();
|
.getWidget();
|
||||||
ColumnData targetColumn = comboColumn.getValue();
|
DefNewColumn defNewColumn = comboDefColumn.getCurrentValue();
|
||||||
ExtractCodelistTargetColumn extractCodelistTargetColumn = new ExtractCodelistTargetColumn(
|
ExtractCodelistTargetColumn extractCodelistTargetColumn = new ExtractCodelistTargetColumn(colCurrent, defNewColumn);
|
||||||
colCurrent, targetColumn, connection.getTrId());
|
targetColumns.add(extractCodelistTargetColumn);
|
||||||
targetColumns.add(extractCodelistTargetColumn);
|
} else {
|
||||||
|
|
||||||
|
HBoxLayoutContainer flowButton=(HBoxLayoutContainer) fieldLabel
|
||||||
|
.getWidget();
|
||||||
|
CheckBox checkNew=(CheckBox)flowButton.getItemByItemId(CHECK_NEW);
|
||||||
|
if(checkNew==null){
|
||||||
|
UtilsGXT3.alert("Error creating form", "Error creating form for check radio!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(checkNew.getValue()){
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
ComboBox<DefNewColumn> comboDefColumn = (ComboBox<DefNewColumn>)flowButton.getItemByItemId(COMBO_DEF_COLUMN);
|
||||||
|
DefNewColumn defNewColumn = comboDefColumn.getCurrentValue();
|
||||||
|
ExtractCodelistTargetColumn extractCodelistTargetColumn = new ExtractCodelistTargetColumn(colCurrent, defNewColumn);
|
||||||
|
targetColumns.add(extractCodelistTargetColumn);
|
||||||
|
} else {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
ComboBox<ColumnData> comboColumn=(ComboBox<ColumnData>)flowButton.getItemByItemId(COMBO_COLUMN);
|
||||||
|
ColumnData columnData=comboColumn.getCurrentValue();
|
||||||
|
if(columnData==null){
|
||||||
|
UtilsGXT3.alert("Attention", "Fill all column!");
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
ExtractCodelistTargetColumn extractCodelistTargetColumn = new ExtractCodelistTargetColumn(
|
||||||
|
colCurrent, columnData, connection.getTrId());
|
||||||
|
targetColumns.add(extractCodelistTargetColumn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
parent.extractCodelistSession.setTargetColumns(targetColumns);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue