Updated Batch Replace

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@113683 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2015-03-20 17:51:30 +00:00
parent 5f81ff3a85
commit a333b5825f
2 changed files with 40 additions and 81 deletions

View File

@ -47,31 +47,30 @@ public class ReplaceBatchDialog extends Window implements MonitorDialogListener
REPLACEBATH, RESUME; REPLACEBATH, RESUME;
} }
protected String WIDTH = "650px"; private static final String WIDTH = "650px";
protected String HEIGHT = "530px"; private static final String HEIGHT = "530px";
protected TRId trId; private TRId trId;
protected String columnName = null;
protected RequestProperties requestProperties; private EventBus eventBus;
protected EventBus eventBus; private String taskIdOfInvocationS;
protected String taskIdOfInvocationS; private CALLTYPE callType;
protected CALLTYPE callType;
private InvocationS invocationS; private InvocationS invocationS;
private ConditionCode conditionCode; // For Curation private ConditionCode conditionCode; // For Curation
/** /**
* *
* @param trId * @param trId
* @param columnName * @param columnName
* @param eventBus * @param eventBus
*/ */
public ReplaceBatchDialog(TRId trId, String columnName, EventBus eventBus) { public ReplaceBatchDialog(TRId trId, String columnLocalId, EventBus eventBus) {
this.trId = trId; this.trId = trId;
this.columnName = columnName;
this.eventBus = eventBus; this.eventBus = eventBus;
taskIdOfInvocationS = null; taskIdOfInvocationS = null;
initWindow(); initWindow();
ReplaceBatchPanel batchRepalcePanel = new ReplaceBatchPanel(this, trId, ReplaceBatchPanel batchRepalcePanel = new ReplaceBatchPanel(this, trId,
columnName, eventBus); columnLocalId, eventBus);
add(batchRepalcePanel); add(batchRepalcePanel);
} }
@ -86,7 +85,6 @@ public class ReplaceBatchDialog extends Window implements MonitorDialogListener
Log.debug("ReplaceBatchDialog: " + trId + ", RequestProperties:" Log.debug("ReplaceBatchDialog: " + trId + ", RequestProperties:"
+ requestProperties); + requestProperties);
this.trId = trId; this.trId = trId;
this.requestProperties = requestProperties;
this.eventBus = eventBus; this.eventBus = eventBus;
invocationS = (InvocationS) requestProperties.getMap().get( invocationS = (InvocationS) requestProperties.getMap().get(

View File

@ -96,31 +96,29 @@ import com.sencha.gxt.widget.core.client.toolbar.ToolBar;
public class ReplaceBatchPanel extends FramedPanel implements public class ReplaceBatchPanel extends FramedPanel implements
SingleValueReplaceListener, DimensionRowSelectionListener, SingleValueReplaceListener, DimensionRowSelectionListener,
ConnectCodelistListener { ConnectCodelistListener {
protected String WIDTH = "560px"; private static final String DON_T_REPLACE = "Don't replace";
protected String HEIGHT = "520px"; private static final String WIDTH = "560px";
protected EventBus eventBus; private static final String HEIGHT = "520px";
protected TextField label = null;
protected TRId trId;
protected String columnName;
protected RefColumn refColumn; private EventBus eventBus;
protected String columnId; private TRId trId;
protected ConditionCode conditionCode; // For Curation
protected String validationColumnColumnId; // For Curation
protected RequestProperties requestProperties;
protected boolean curation;
protected ColumnData column;
protected boolean hasValidationColumns;
protected ShowOccurrencesType showOccurencesType;
protected ColumnData connection;
protected ReplaceBatchDialog parent; private RefColumn refColumn;
private String columnLocalId;
private ConditionCode conditionCode; // For Curation
private String validationColumnColumnId; // For Curation
private boolean curation;
private ColumnData column;
private boolean hasValidationColumns;
private ShowOccurrencesType showOccurencesType;
private ColumnData connection;
private ReplaceBatchDialog parent;
private ReplaceEntry currentReplaceEntry; private ReplaceEntry currentReplaceEntry;
private int currentRowIndex; private int currentRowIndex;
protected static final String DON_T_REPLACE = "Don't replace";
private TextButton btnSave; private TextButton btnSave;
private TextButton btnClose; private TextButton btnClose;
@ -133,10 +131,10 @@ public class ReplaceBatchPanel extends FramedPanel implements
private TextButton btnDisconnect; private TextButton btnDisconnect;
private TextField connectionField; private TextField connectionField;
protected ListLoader<ListLoadConfig, ListLoadResult<ReplaceEntry>> loader; private ListLoader<ListLoadConfig, ListLoadResult<ReplaceEntry>> loader;
protected Grid<ReplaceEntry> grid; private Grid<ReplaceEntry> grid;
protected ListStore<ReplaceEntry> store; private ListStore<ReplaceEntry> store;
protected HTML info; private HTML info;
private boolean simpleReplace; private boolean simpleReplace;
@ -145,13 +143,12 @@ public class ReplaceBatchPanel extends FramedPanel implements
this.curation = true; this.curation = true;
this.parent = parent; this.parent = parent;
this.trId = trId; this.trId = trId;
this.requestProperties = requestProperties;
this.eventBus = eventBus; this.eventBus = eventBus;
InvocationS invocationS = (InvocationS) requestProperties.getMap().get( InvocationS invocationS = (InvocationS) requestProperties.getMap().get(
RequestPropertiesParameterType.InvocationS); RequestPropertiesParameterType.InvocationS);
columnId = invocationS.getColumnId(); columnLocalId = invocationS.getColumnId();
refColumn = invocationS.getRefColumn(); refColumn = invocationS.getRefColumn();
@ -170,11 +167,11 @@ public class ReplaceBatchPanel extends FramedPanel implements
} }
public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId, public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId,
String columnName, EventBus eventBus) { String columnLocalId, EventBus eventBus) {
this.curation = false; this.curation = false;
this.parent = parent; this.parent = parent;
this.trId = trId; this.trId = trId;
this.columnName = columnName; this.columnLocalId = columnLocalId;
this.eventBus = eventBus; this.eventBus = eventBus;
this.conditionCode = null; this.conditionCode = null;
this.validationColumnColumnId = null; this.validationColumnColumnId = null;
@ -182,9 +179,9 @@ public class ReplaceBatchPanel extends FramedPanel implements
connection = null; connection = null;
hasValidationColumns = false; hasValidationColumns = false;
Log.debug("Create BatchReplacePanel(): [" + trId.toString() Log.debug("Create BatchReplacePanel(): [" + trId.toString()
+ " , columnName:" + columnName + "]"); + " , columnLocalId:" + columnLocalId + "]");
init(); init();
retrieveColumn(); retrieveColumnByColumnId();
} }
@ -492,47 +489,12 @@ public class ReplaceBatchPanel extends FramedPanel implements
} }
protected void retrieveColumn() {
TDGWTServiceAsync.INSTANCE.getColumn(trId, columnName,
new AsyncCallback<ColumnData>() {
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Locked",
caught.getLocalizedMessage());
} else {
if (caught instanceof TDGWTIsFinalException) {
Log.error(caught.getLocalizedMessage());
UtilsGXT3.alert("Error Final",
caught.getLocalizedMessage());
} else {
Log.error("load column failure:"
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving column",
"Error retrieving column");
}
}
}
}
public void onSuccess(ColumnData result) {
Log.debug("Column: " + result);
column = result;
retriveValidationColumn();
}
});
}
protected void retrieveColumnByColumnId() { protected void retrieveColumnByColumnId() {
Log.debug("Retrieve Column by ColumnId: columnId:" + columnId Log.debug("Retrieve Column by ColumnId: columnLocalId:" + columnLocalId
+ ", trId:" + trId); + ", trId:" + trId);
TDGWTServiceAsync.INSTANCE.getColumn(columnId, trId, TDGWTServiceAsync.INSTANCE.getColumn(columnLocalId, trId,
new AsyncCallback<ColumnData>() { new AsyncCallback<ColumnData>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
@ -562,7 +524,6 @@ public class ReplaceBatchPanel extends FramedPanel implements
public void onSuccess(ColumnData result) { public void onSuccess(ColumnData result) {
Log.debug("Column: " + result); Log.debug("Column: " + result);
column = result; column = result;
columnName = result.getName();
retriveValidationColumn(); retriveValidationColumn();
} }
@ -570,7 +531,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
} }
protected void retriveValidationColumn() { protected void retriveValidationColumn() {
TDGWTServiceAsync.INSTANCE.getValidationColumns(trId, columnName, TDGWTServiceAsync.INSTANCE.getValidationColumns(columnLocalId,trId,
new AsyncCallback<ArrayList<ColumnData>>() { new AsyncCallback<ArrayList<ColumnData>>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {