121 lines
4.3 KiB
Java
121 lines
4.3 KiB
Java
package org.gcube.portlets.user.td.unionwizardwidget.client;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
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.tr.ColumnData;
|
|
import org.gcube.portlets.user.td.gwtservice.shared.tr.TabResource;
|
|
import org.gcube.portlets.user.td.unionwizardwidget.client.utils.UtilsGXT3;
|
|
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.shared.TRId;
|
|
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
|
|
import org.gcube.portlets.user.td.wizardwidget.client.dataresource.ResourceBundle;
|
|
|
|
import com.allen_sauer.gwt.log.client.Log;
|
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
|
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
|
import com.sencha.gxt.core.client.util.Margins;
|
|
import com.sencha.gxt.widget.core.client.ContentPanel;
|
|
import com.sencha.gxt.widget.core.client.Resizable;
|
|
import com.sencha.gxt.widget.core.client.Resizable.Dir;
|
|
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.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.event.SelectEvent;
|
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
|
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
|
|
|
public class ColumnMappingPanel extends ContentPanel {
|
|
|
|
protected ResourceBundle res;
|
|
private ColumnMappingCard parent;
|
|
|
|
public ColumnMappingPanel(ColumnMappingCard parent,ResourceBundle res) {
|
|
this.res = res;
|
|
this.parent = parent;
|
|
Log.debug("ColumnMappingPanel");
|
|
init();
|
|
retrieveColumns();
|
|
}
|
|
|
|
protected void init() {
|
|
setHeaderVisible(false);
|
|
new Resizable(this, Dir.E, Dir.SE, Dir.S);
|
|
|
|
}
|
|
|
|
protected void create() {
|
|
/*
|
|
itemIdSourceValueArg = "SourceArg" + selectedColumn.getName();
|
|
itemIdTargetValueArg = "TargetArg" + selectedColumn.getName();
|
|
|
|
SimpleContainer container = new SimpleContainer();
|
|
container.setHeight(CONTAINERHEIGHT);
|
|
container.setWidth(CONTAINERWIDTH);
|
|
|
|
vert = new VerticalLayoutContainer();
|
|
vert.setScrollMode(ScrollMode.AUTO);
|
|
vert.setAdjustForScroll(true);
|
|
|
|
setColumnMappingData();
|
|
|
|
container.add(vert);
|
|
container.forceLayout();
|
|
|
|
FieldLabel rowsLabel = new FieldLabel(null, "Select columns");
|
|
rowsLabel.getElement().applyStyles("font-weight:bold");
|
|
|
|
VerticalLayoutContainer vPanel = new VerticalLayoutContainer();
|
|
vPanel.add(rowsLabel, new VerticalLayoutData(1, -1, new Margins(1)));
|
|
vPanel.add(container, new VerticalLayoutData(1, -1));
|
|
|
|
add(vPanel);
|
|
forceLayout();
|
|
*/
|
|
}
|
|
|
|
private void retrieveColumns() {
|
|
TRId trId=parent.unionSession.getTrId();
|
|
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
|
new AsyncCallback<ArrayList<ColumnData>>() {
|
|
|
|
@Override
|
|
public void onFailure(Throwable caught) {
|
|
if (caught instanceof TDGWTSessionExpiredException) {
|
|
parent.getEventBus()
|
|
.fireEvent(
|
|
new SessionExpiredEvent(
|
|
SessionExpiredType.EXPIREDONSERVER));
|
|
} else {
|
|
Log.debug("Error retrieving columns: "
|
|
+ caught.getLocalizedMessage());
|
|
UtilsGXT3.alert("Error retrieving columns",
|
|
"Error retrieving columns on server!");
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void onSuccess(ArrayList<ColumnData> result) {
|
|
/*
|
|
* comboColumnReferenceType.reset();
|
|
* storeComboColumnReferenceType.clear();
|
|
* storeComboColumnReferenceType.addAll(result);
|
|
* storeComboColumnReferenceType.commitChanges();
|
|
* comboColumnReferenceTypeLabel.setVisible(true);
|
|
* forceLayout();
|
|
*/
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
}
|