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 TRId trId;
protected String columnName; protected String columnName;
protected ColumnData column; protected ColumnData column;
protected boolean hasValidationColumns;
protected ReplaceBatchDialog parent; protected ReplaceBatchDialog parent;
private ReplaceEntry currentReplaceEntry; private ReplaceEntry currentReplaceEntry;
private int currentRowIndex; private int currentRowIndex;
@ -90,13 +92,16 @@ public class ReplaceBatchPanel extends FramedPanel implements
protected Grid<ReplaceEntry> grid; protected Grid<ReplaceEntry> grid;
protected ListStore<ReplaceEntry> store; protected ListStore<ReplaceEntry> store;
protected HTML info; protected HTML info;
public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId, public ReplaceBatchPanel(ReplaceBatchDialog parent, TRId trId,
String columnName, EventBus eventBus) { String columnName, EventBus eventBus) {
this.parent = parent; this.parent = parent;
this.trId = trId; this.trId = trId;
this.columnName = columnName; this.columnName = columnName;
this.eventBus = eventBus; this.eventBus = eventBus;
hasValidationColumns=false;
Log.debug("Create BatchReplacePanel(): [" + trId.toString() Log.debug("Create BatchReplacePanel(): [" + trId.toString()
+ " , columnName:" + columnName + "]"); + " , columnName:" + columnName + "]");
init(); init();
@ -301,6 +306,37 @@ 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;
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(); create();
} }
@ -323,12 +359,12 @@ public class ReplaceBatchPanel extends FramedPanel implements
public void onSuccess(ArrayList<Occurrences> result) { public void onSuccess(ArrayList<Occurrences> result) {
Log.trace("loaded " + result.size() + " Occurrences"); Log.trace("loaded " + result.size() + " Occurrences");
ListLoadResultBean<ReplaceEntry> loadedResult=new ListLoadResultBean<ReplaceEntry>( ListLoadResultBean<ReplaceEntry> loadedResult = new ListLoadResultBean<ReplaceEntry>(
getRecord(result)); getRecord(result));
Log.debug("created "+loadedResult.toString()); Log.debug("created " + loadedResult.toString());
try { try {
callback.onSuccess(loadedResult); callback.onSuccess(loadedResult);
} catch(Throwable e){ } catch (Throwable e) {
Log.error("Too many different occurrences"); Log.error("Too many different occurrences");
UtilsGXT3.alert("Attention", UtilsGXT3.alert("Attention",
"Too many different occurrences"); "Too many different occurrences");
@ -370,7 +406,7 @@ public class ReplaceBatchPanel extends FramedPanel implements
records.add(getRecord(entry)); records.add(getRecord(entry));
} catch (Throwable e) { } catch (Throwable e) {
Log.debug("Error creating records:"+e.getLocalizedMessage()); Log.debug("Error creating records:" + e.getLocalizedMessage());
e.printStackTrace(); e.printStackTrace();
} }
return records; return records;