Updated ReplaceBatchPanel

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-column-widget@94357 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-04-04 14:04:09 +00:00
parent ee7af95a57
commit 7c7f1e06a5
1 changed files with 42 additions and 6 deletions

View File

@ -77,6 +77,8 @@ public class ReplaceBatchPanel extends FramedPanel implements
protected TRId trId;
protected String columnName;
protected ColumnData column;
protected boolean hasValidationColumns;
protected ReplaceBatchDialog parent;
private ReplaceEntry currentReplaceEntry;
private int currentRowIndex;
@ -90,13 +92,16 @@ public class ReplaceBatchPanel extends FramedPanel implements
protected Grid<ReplaceEntry> grid;
protected ListStore<ReplaceEntry> store;
protected HTML info;
public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId,
String columnName, EventBus eventBus) {
this.parent = parent;
this.trId = trId;
this.columnName = columnName;
this.eventBus = eventBus;
hasValidationColumns=false;
Log.debug("Create BatchReplacePanel(): [" + trId.toString()
+ " , columnName:" + columnName + "]");
init();
@ -301,6 +306,37 @@ public class ReplaceBatchPanel extends FramedPanel implements
public void onSuccess(ColumnData result) {
Log.debug("Column: " + result);
column = result;
retriveValidationColumn();
}
});
}
protected void retriveValidationColumn() {
TDGWTServiceAsync.INSTANCE.getValidationColumns(trId, columnName,
new AsyncCallback<ArrayList<ColumnData>>() {
public void onFailure(Throwable caught) {
Log.error("load column failure:"
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving column",
"Error retrieving column");
}
public void onSuccess(ArrayList<ColumnData> result) {
Log.debug("Validation Columns: " + result.size());
ArrayList<String> validationColumnReferences = new ArrayList<String>();
if (result.size() > 0) {
hasValidationColumns=true;
for (ColumnData columnData : result) {
validationColumnReferences.add(columnData
.getColumnId());
}
column.setValidationColumnReferences(validationColumnReferences);
} else {
hasValidationColumns=false;
}
create();
}
@ -323,12 +359,12 @@ public class ReplaceBatchPanel extends FramedPanel implements
public void onSuccess(ArrayList<Occurrences> result) {
Log.trace("loaded " + result.size() + " Occurrences");
ListLoadResultBean<ReplaceEntry> loadedResult=new ListLoadResultBean<ReplaceEntry>(
ListLoadResultBean<ReplaceEntry> loadedResult = new ListLoadResultBean<ReplaceEntry>(
getRecord(result));
Log.debug("created "+loadedResult.toString());
Log.debug("created " + loadedResult.toString());
try {
callback.onSuccess(loadedResult);
} catch(Throwable e){
callback.onSuccess(loadedResult);
} catch (Throwable e) {
Log.error("Too many different occurrences");
UtilsGXT3.alert("Attention",
"Too many different occurrences");
@ -370,7 +406,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
records.add(getRecord(entry));
} catch (Throwable e) {
Log.debug("Error creating records:"+e.getLocalizedMessage());
Log.debug("Error creating records:" + e.getLocalizedMessage());
e.printStackTrace();
}
return records;