Updated ReplaceBatch

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@113709 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-03-24 18:13:41 +00:00
parent a333b5825f
commit f707692a40
2 changed files with 266 additions and 85 deletions

View File

@ -48,7 +48,7 @@ public class ReplaceBatchDialog extends Window implements MonitorDialogListener
} }
private static final String WIDTH = "650px"; private static final String WIDTH = "650px";
private static final String HEIGHT = "530px"; private static final String HEIGHT = "560px";
private TRId trId; private TRId trId;
private EventBus eventBus; private EventBus eventBus;

View File

@ -8,6 +8,7 @@ import org.gcube.portlets.user.td.columnwidget.client.dimension.ConnectCodelistD
import org.gcube.portlets.user.td.columnwidget.client.dimension.ConnectCodelistListener; import org.gcube.portlets.user.td.columnwidget.client.dimension.ConnectCodelistListener;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionDialog; import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionDialog;
import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionListener; import org.gcube.portlets.user.td.columnwidget.client.dimension.DimensionRowSelectionListener;
import org.gcube.portlets.user.td.columnwidget.client.properties.ColumnDataPropertiesCombo;
import org.gcube.portlets.user.td.columnwidget.client.properties.ShowOccurrencesTypeProperties; import org.gcube.portlets.user.td.columnwidget.client.properties.ShowOccurrencesTypeProperties;
import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle; import org.gcube.portlets.user.td.columnwidget.client.resources.ResourceBundle;
import org.gcube.portlets.user.td.columnwidget.client.store.ShowOccurrencesTypeElement; import org.gcube.portlets.user.td.columnwidget.client.store.ShowOccurrencesTypeElement;
@ -41,18 +42,22 @@ import com.google.gwt.cell.client.Cell.Context;
import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.GWT;
import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand; import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.dom.client.Style.Unit; import com.google.gwt.dom.client.Style.Unit;
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.safecss.shared.SafeStylesBuilder; import com.google.gwt.safecss.shared.SafeStylesBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder; import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HTML; import com.google.gwt.user.client.ui.HTML;
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;
import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction; import com.sencha.gxt.cell.core.client.form.ComboBoxCell.TriggerAction;
import com.sencha.gxt.core.client.IdentityValueProvider; import com.sencha.gxt.core.client.IdentityValueProvider;
import com.sencha.gxt.core.client.Style.SelectionMode; import com.sencha.gxt.core.client.Style.SelectionMode;
import com.sencha.gxt.core.client.dom.XElement;
import com.sencha.gxt.core.client.resources.ThemeStyles; import com.sencha.gxt.core.client.resources.ThemeStyles;
import com.sencha.gxt.core.client.util.Format; import com.sencha.gxt.core.client.util.Format;
import com.sencha.gxt.core.client.util.Margins; import com.sencha.gxt.core.client.util.Margins;
@ -72,11 +77,14 @@ import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutD
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutPack; 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;
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign; import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer.HBoxLayoutAlign;
import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer;
import com.sencha.gxt.widget.core.client.container.HorizontalLayoutContainer.HorizontalLayoutData;
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;
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.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.TextField; import com.sencha.gxt.widget.core.client.form.TextField;
import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel; import com.sencha.gxt.widget.core.client.grid.CheckBoxSelectionModel;
import com.sencha.gxt.widget.core.client.grid.ColumnConfig; import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
@ -84,7 +92,6 @@ import com.sencha.gxt.widget.core.client.grid.ColumnModel;
import com.sencha.gxt.widget.core.client.grid.Grid; import com.sencha.gxt.widget.core.client.grid.Grid;
import com.sencha.gxt.widget.core.client.grid.RowNumberer; import com.sencha.gxt.widget.core.client.grid.RowNumberer;
import com.sencha.gxt.widget.core.client.info.Info; import com.sencha.gxt.widget.core.client.info.Info;
import com.sencha.gxt.widget.core.client.toolbar.LabelToolItem;
import com.sencha.gxt.widget.core.client.toolbar.ToolBar; import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
/** /**
@ -98,16 +105,22 @@ public class ReplaceBatchPanel extends FramedPanel implements
ConnectCodelistListener { ConnectCodelistListener {
private static final String DON_T_REPLACE = "Don't replace"; private static final String DON_T_REPLACE = "Don't replace";
private static final String WIDTH = "560px"; private static final String WIDTH = "560px";
private static final String HEIGHT = "520px"; private static final String HEIGHT = "550px";
private static final String GRID_HEIGHT = "344px";
private static final String TOOLBAR_HEAD_HEIGHT = "102px";
private static final String CONNECTION_FIELD_WIDTH = "470px";
private static final int SHOW_OCCURENCE_TYPE_WIDTH = 100;
private static final String COMBOCOLS_WIDTH = "510px";
private EventBus eventBus; private EventBus eventBus;
private TRId trId; private TRId trId;
private ArrayList<ColumnData> columns;
private RefColumn refColumn; private RefColumn refColumn;
private String columnLocalId; private String columnLocalId;
private ConditionCode conditionCode; // For Curation private ConditionCode conditionCode; // For Curation
private String validationColumnColumnId; // For Curation private String validationColumnColumnId; // For Curation
private boolean curation; private boolean curation;
private ColumnData column; private ColumnData column;
private boolean hasValidationColumns; private boolean hasValidationColumns;
@ -138,6 +151,8 @@ public class ReplaceBatchPanel extends FramedPanel implements
private boolean simpleReplace; private boolean simpleReplace;
private ComboBox<ColumnData> comboCols;
public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId, public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId,
RequestProperties requestProperties, EventBus eventBus) { RequestProperties requestProperties, EventBus eventBus) {
this.curation = true; this.curation = true;
@ -149,7 +164,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
RequestPropertiesParameterType.InvocationS); RequestPropertiesParameterType.InvocationS);
columnLocalId = invocationS.getColumnId(); columnLocalId = invocationS.getColumnId();
refColumn = invocationS.getRefColumn(); refColumn = invocationS.getRefColumn();
conditionCode = (ConditionCode) requestProperties.getMap().get( conditionCode = (ConditionCode) requestProperties.getMap().get(
@ -181,7 +196,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
Log.debug("Create BatchReplacePanel(): [" + trId.toString() Log.debug("Create BatchReplacePanel(): [" + trId.toString()
+ " , columnLocalId:" + columnLocalId + "]"); + " , columnLocalId:" + columnLocalId + "]");
init(); init();
retrieveColumnByColumnId(); retrieveColumnsWithViewColumnIncluded();
} }
@ -195,8 +210,33 @@ public class ReplaceBatchPanel extends FramedPanel implements
protected void create() { protected void create() {
showOccurencesType = ShowOccurrencesType.ONLYERRORS; showOccurencesType = ShowOccurrencesType.ONLYERRORS;
toolBarHead = new ToolBar(); FlexTable flexTable = new FlexTable();
toolBarHead.add(new LabelToolItem("Show: ")); flexTable.setCellSpacing(1);
// Combo Column
ColumnDataPropertiesCombo propsCols = GWT
.create(ColumnDataPropertiesCombo.class);
Log.debug("Props: " + propsCols);
final ListStore<ColumnData> storeCols = new ListStore<ColumnData>(
propsCols.id());
Log.debug("Store Col: " + storeCols);
storeCols.addAll(columns);
Log.debug("StoreCol created");
comboCols = new ComboBox<ColumnData>(storeCols, propsCols.label());
Log.debug("Combo Threshold created");
comboCols.addSelectionHandler(comboColsSelection());
comboCols.setEmptyText("Select a column...");
comboCols.setEditable(false);
comboCols.setTriggerAction(TriggerAction.ALL);
comboCols.setWidth(COMBOCOLS_WIDTH);
FieldLabel columnField = new FieldLabel(comboCols, "Column");
flexTable.setWidget(0, 0, columnField);
// Create Combo Show // Create Combo Show
ShowOccurrencesTypeProperties propsShowOccurrencesType = GWT ShowOccurrencesTypeProperties propsShowOccurrencesType = GWT
@ -211,18 +251,21 @@ public class ReplaceBatchPanel extends FramedPanel implements
addHandlersForShowOccurrencesType(propsShowOccurrencesType.label()); addHandlersForShowOccurrencesType(propsShowOccurrencesType.label());
comboShowOccurrencesType.setEmptyText("Select a show type..."); comboShowOccurrencesType.setEmptyText("Select a show type...");
comboShowOccurrencesType.setWidth(100); comboShowOccurrencesType.setWidth(SHOW_OCCURENCE_TYPE_WIDTH);
comboShowOccurrencesType.setTypeAhead(true); comboShowOccurrencesType.setTypeAhead(true);
comboShowOccurrencesType.setEditable(false); comboShowOccurrencesType.setEditable(false);
comboShowOccurrencesType.setTriggerAction(TriggerAction.ALL); comboShowOccurrencesType.setTriggerAction(TriggerAction.ALL);
comboShowOccurrencesType comboShowOccurrencesType
.setValue(ShowOccurrencesTypeStore.onlyErrorsElement); .setValue(ShowOccurrencesTypeStore.onlyErrorsElement);
toolBarHead.add(comboShowOccurrencesType);
if (!column.isViewColumn()) { FieldLabel comboShowOccurrencesTypeField = new FieldLabel(
comboShowOccurrencesType, "Show");
flexTable.setWidget(1, 0, comboShowOccurrencesTypeField);
HorizontalLayoutContainer connectionLayout = new HorizontalLayoutContainer();
if (column == null || !column.isViewColumn()) {
// Connect Codelist // Connect Codelist
btnConnect = new TextButton(); btnConnect = new TextButton();
btnConnect.setIcon(ResourceBundle.INSTANCE.codelistLink24()); btnConnect.setIcon(ResourceBundle.INSTANCE.codelistLink24());
@ -239,7 +282,8 @@ public class ReplaceBatchPanel extends FramedPanel implements
}); });
toolBarHead.add(btnConnect); connectionLayout.add(btnConnect, new HorizontalLayoutData(-1, 1,
new Margins(1)));
// Disconnect Codelist // Disconnect Codelist
btnDisconnect = new TextButton(); btnDisconnect = new TextButton();
@ -257,16 +301,33 @@ public class ReplaceBatchPanel extends FramedPanel implements
} }
}); });
toolBarHead.add(btnDisconnect); connectionLayout.add(btnDisconnect, new HorizontalLayoutData(-1, 1,
new Margins(1)));
connectionField = new TextField(); connectionField = new TextField();
toolBarHead.add(connectionField); connectionField.setWidth(CONNECTION_FIELD_WIDTH);
connectionLayout.add(connectionField, new HorizontalLayoutData(-1,
1, new Margins(1)));
} else { } else {
connectionField = new TextField(); connectionField = new TextField();
toolBarHead.add(connectionField); connectionField.setWidth(CONNECTION_FIELD_WIDTH);
connectionLayout.add(connectionField, new HorizontalLayoutData(-1,
1, new Margins(1)));
} }
FieldLabel conField = new FieldLabel(connectionLayout, "Connection");
flexTable.setWidget(2, 0, conField);
cleanCells(flexTable.getElement());
toolBarHead = new ToolBar();
toolBarHead.setHeight(TOOLBAR_HEAD_HEIGHT);
// toolBarHead.setHeight("");
toolBarHead.add(flexTable, new BoxLayoutData(new Margins(0)));
// Create Grid // Create Grid
IdentityValueProvider<ReplaceEntry> identity = new IdentityValueProvider<ReplaceEntry>(); IdentityValueProvider<ReplaceEntry> identity = new IdentityValueProvider<ReplaceEntry>();
CheckBoxSelectionModel<ReplaceEntry> sm = new CheckBoxSelectionModel<ReplaceEntry>( CheckBoxSelectionModel<ReplaceEntry> sm = new CheckBoxSelectionModel<ReplaceEntry>(
@ -274,17 +335,10 @@ public class ReplaceBatchPanel extends FramedPanel implements
RowNumberer<ReplaceEntry> number = new RowNumberer<ReplaceEntry>( RowNumberer<ReplaceEntry> number = new RowNumberer<ReplaceEntry>(
identity); identity);
// number.setFixed(false);
// number.setResizable(false);
number.setWidth(50); number.setWidth(50);
//From gxt 3.1.1
number.setCellClassName(""); number.setCellClassName("");
number.setCellPadding(true); number.setCellPadding(true);
//GXT 3.0.1
//number.setColumnClassSuffix("");
number.setHeader("N."); number.setHeader("N.");
SafeStylesBuilder styleBuilder = new SafeStylesBuilder(); SafeStylesBuilder styleBuilder = new SafeStylesBuilder();
styleBuilder.width(50, Unit.PX); styleBuilder.width(50, Unit.PX);
@ -308,10 +362,13 @@ public class ReplaceBatchPanel extends FramedPanel implements
sb.appendHtmlConstant("<span " + style + ">" sb.appendHtmlConstant("<span " + style + ">"
+ DON_T_REPLACE + "</span>"); + DON_T_REPLACE + "</span>");
} else { } else {
String style = "style='color: green;font-weight:normal'"; String style = "style='color: green;font-weight:normal'";
sb.appendHtmlConstant("<span " + style + ">" + new SafeHtmlBuilder().appendEscaped(value).toSafeHtml().asString() sb.appendHtmlConstant("<span "
+ "</span>"); + style
+ ">"
+ new SafeHtmlBuilder().appendEscaped(value)
.toSafeHtml().asString() + "</span>");
} }
} }
@ -388,7 +445,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
grid.setLoader(loader); grid.setLoader(loader);
grid.setSelectionModel(sm); grid.setSelectionModel(sm);
number.initPlugin(grid); number.initPlugin(grid);
grid.setHeight("376px"); grid.setHeight(GRID_HEIGHT);
grid.getView().setStripeRows(true); grid.getView().setStripeRows(true);
grid.getView().setColumnLines(true); grid.getView().setColumnLines(true);
grid.getView().setAutoFill(true); grid.getView().setAutoFill(true);
@ -434,8 +491,8 @@ public class ReplaceBatchPanel extends FramedPanel implements
HBoxLayoutContainer flowButton = new HBoxLayoutContainer(); HBoxLayoutContainer flowButton = new HBoxLayoutContainer();
flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE); flowButton.setHBoxLayoutAlign(HBoxLayoutAlign.MIDDLE);
flowButton.setPack(BoxLayoutPack.CENTER); flowButton.setPack(BoxLayoutPack.CENTER);
BoxLayoutData boxLayoutData=new BoxLayoutData(new Margins(2, 4, 2, 4)); BoxLayoutData boxLayoutData = new BoxLayoutData(new Margins(2, 4, 2, 4));
flowButton.add(btnSave, boxLayoutData); flowButton.add(btnSave, boxLayoutData);
flowButton.add(btnClose, boxLayoutData); flowButton.add(btnClose, boxLayoutData);
@ -443,59 +500,157 @@ public class ReplaceBatchPanel extends FramedPanel implements
v.add(toolBarHead, new VerticalLayoutData(1, -1, new Margins(0))); v.add(toolBarHead, new VerticalLayoutData(1, -1, new Margins(0)));
v.add(grid, new VerticalLayoutData(1, -1, new Margins(0))); v.add(grid, new VerticalLayoutData(1, -1, new Margins(0)));
v.add(toolBar, new VerticalLayoutData(1, 25, new Margins(0))); v.add(toolBar, new VerticalLayoutData(1, 25, new Margins(0)));
v.add(flowButton, new VerticalLayoutData(1, 36, v.add(flowButton,
new Margins(5, 2, 5, 2))); new VerticalLayoutData(1, 36, new Margins(5, 2, 5, 2)));
add(v); add(v);
if (curation) { setSelectedColumn();
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
.getShowOccurrencesType());
if (connection != null) {
Log.debug("Selected connection: " + connection);
connectionField.setValue(connection.getLabel());
connectionField.setVisible(true);
btnDisconnect.setVisible(true);
btnConnect.setVisible(false);
btnConnect.enable();
} else {
}
toolBarHead.forceLayout();
} else {
if (column.isViewColumn()) {
Log.debug("Is View Column");
//storeShowOccurrencesType
// .add(ShowOccurrencesTypeStore.onlyErrorsElement);
storeShowOccurrencesType
.addAll(ShowOccurrencesTypeStore.getShowOccurrencesType());
ColumnViewData cViewData = column.getColumnViewData();
RefColumn refCol = new RefColumn(String.valueOf(cViewData
.getTargetTableId()),
cViewData.getTargetTableColumnId());
retrieveConnectionForViewColumn(refCol);
} else {
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
.getShowOccurrencesType());
Log.debug("Not Is View Column");
connectionField.setVisible(false);
btnDisconnect.setVisible(false);
toolBarHead.forceLayout();
}
}
} }
protected void update(ColumnData column) {
this.column = column;
if (column == null) {
setSelectedColumn();
} else {
columnLocalId = column.getColumnId();
connection=null;
conditionCode=null;
refColumn = null;
validationColumnColumnId = null;
hasValidationColumns = false;
clear();
retrieveValidationColumn();
}
}
protected void retrieveColumnByColumnId() { protected void setSelectedColumn() {
if (column == null) {
columnLocalId=null;
connection = null;
conditionCode=null;
refColumn = null;
validationColumnColumnId = null;
hasValidationColumns = false;
comboCols.reset();
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
.getShowOccurrencesType());
Log.debug("Not Is View Column");
connectionField.setVisible(false);
btnDisconnect.setVisible(false);
btnConnect.setVisible(false);
if(curation){
comboCols.setReadOnly(true);
}
toolBarHead.forceLayout();
} else {
comboCols.setValue(column);
if (curation) {
comboCols.setReadOnly(true);
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
.getShowOccurrencesType());
if (connection != null) {
Log.debug("Selected connection: " + connection);
connectionField.setValue(connection.getLabel());
connectionField.setVisible(true);
btnDisconnect.setVisible(true);
btnConnect.setVisible(false);
btnConnect.disable();
toolBarHead.forceLayout();
} else {
if (column.isViewColumn()) {
Log.debug("Is View Column");
// storeShowOccurrencesType
// .add(ShowOccurrencesTypeStore.onlyErrorsElement);
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
.getShowOccurrencesType());
ColumnViewData cViewData = column.getColumnViewData();
RefColumn refCol = new RefColumn(String.valueOf(cViewData
.getTargetTableId()),
cViewData.getTargetTableColumnId());
retrieveConnectionForViewColumn(refCol);
} else {
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
.getShowOccurrencesType());
Log.debug("Not Is View Column");
connectionField.setVisible(false);
btnDisconnect.setVisible(false);
btnConnect.setVisible(true);
btnConnect.setEnabled(true);
toolBarHead.forceLayout();
}
}
} else {
if (column.isViewColumn()) {
Log.debug("Is View Column");
// storeShowOccurrencesType
// .add(ShowOccurrencesTypeStore.onlyErrorsElement);
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
.getShowOccurrencesType());
ColumnViewData cViewData = column.getColumnViewData();
RefColumn refCol = new RefColumn(String.valueOf(cViewData
.getTargetTableId()),
cViewData.getTargetTableColumnId());
retrieveConnectionForViewColumn(refCol);
} else {
storeShowOccurrencesType.addAll(ShowOccurrencesTypeStore
.getShowOccurrencesType());
Log.debug("Not Is View Column");
connectionField.setVisible(false);
btnDisconnect.setVisible(false);
btnConnect.setVisible(true);
btnConnect.setEnabled(true);
toolBarHead.forceLayout();
}
}
}
}
protected SelectionHandler<ColumnData> comboColsSelection() {
SelectionHandler<ColumnData> selectionHandler = new SelectionHandler<ColumnData>() {
@Override
public void onSelection(SelectionEvent<ColumnData> event) {
if (event.getSelectedItem() != null) {
ColumnData col = event.getSelectedItem();
Log.debug("Col selected:" + col.toString());
column = col;
btnSave.enable();
update(col);
} else {
column = null;
btnSave.disable();
update(null);
}
}
};
return selectionHandler;
}
private void cleanCells(Element elem) {
NodeList<Element> tds = elem.<XElement> cast().select("td");
for (int i = 0; i < tds.getLength(); i++) {
Element td = tds.getItem(i);
if (!td.hasChildNodes() && td.getClassName().equals("")) {
td.removeFromParent();
}
}
}
protected void retrieveColumnsWithViewColumnIncluded() {
Log.debug("Retrieve Column by ColumnId: columnLocalId:" + columnLocalId Log.debug("Retrieve Column by ColumnId: columnLocalId:" + columnLocalId
+ ", trId:" + trId); + ", trId:" + trId);
TDGWTServiceAsync.INSTANCE.getColumn(columnLocalId, trId, TDGWTServiceAsync.INSTANCE.getColumnWithViewColumnIncluded(trId,
new AsyncCallback<ColumnData>() { new AsyncCallback<ArrayList<ColumnData>>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) { if (caught instanceof TDGWTSessionExpiredException) {
@ -521,17 +676,35 @@ public class ReplaceBatchPanel extends FramedPanel implements
} }
} }
public void onSuccess(ColumnData result) { public void onSuccess(ArrayList<ColumnData> result) {
Log.debug("Column: " + result); Log.debug("Column: " + result);
column = result; columns = result;
retriveValidationColumn(); retrieveColumn();
if (column == null) {
hasValidationColumns = false;
create();
} else {
retrieveValidationColumn();
}
} }
}); });
} }
protected void retriveValidationColumn() { protected void retrieveColumn() {
TDGWTServiceAsync.INSTANCE.getValidationColumns(columnLocalId,trId, for (ColumnData c : columns) {
if (columnLocalId != null
&& c.getColumnId().compareTo(columnLocalId) == 0) {
column = c;
return;
}
}
}
protected void retrieveValidationColumn() {
TDGWTServiceAsync.INSTANCE.getValidationColumns(columnLocalId, trId,
new AsyncCallback<ArrayList<ColumnData>>() { new AsyncCallback<ArrayList<ColumnData>>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
@ -616,7 +789,15 @@ public class ReplaceBatchPanel extends FramedPanel implements
*/ */
protected void loadData(ListLoadConfig loadConfig, protected void loadData(ListLoadConfig loadConfig,
final AsyncCallback<ListLoadResult<ReplaceEntry>> callback) { final AsyncCallback<ListLoadResult<ReplaceEntry>> callback) {
if(column==null){
ListLoadResultBean<ReplaceEntry> loadedResult = new ListLoadResultBean<ReplaceEntry>(
getRecord(new ArrayList<Occurrences>()));
Log.debug("created " + loadedResult.toString());
callback.onSuccess(loadedResult);
return;
}
OccurrencesForReplaceBatchColumnSession occurrencesSession = new OccurrencesForReplaceBatchColumnSession( OccurrencesForReplaceBatchColumnSession occurrencesSession = new OccurrencesForReplaceBatchColumnSession(
column, showOccurencesType, hasValidationColumns, column, showOccurencesType, hasValidationColumns,
conditionCode, validationColumnColumnId); conditionCode, validationColumnColumnId);
@ -1064,7 +1245,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
public void onSuccess(ColumnData result) { public void onSuccess(ColumnData result) {
Log.debug("Column: " + result); Log.debug("Column: " + result);
connection = result; connection = result;
retrieveColumnByColumnId(); retrieveColumnsWithViewColumnIncluded();
} }
}); });