Updated Duplicate
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@113699 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
528c81f578
commit
e6d7e58038
|
@ -29,10 +29,10 @@ import com.google.web.bindery.event.shared.EventBus;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class DeleteRows implements MonitorDialogListener {
|
public class DeleteRows implements MonitorDialogListener {
|
||||||
protected TRId trId;
|
private TRId trId;
|
||||||
protected EventBus eventBus;
|
private EventBus eventBus;
|
||||||
protected ArrayList<String> rows;
|
private ArrayList<String> rows;
|
||||||
protected DeleteRowsSession deleteRowsSession;
|
private DeleteRowsSession deleteRowsSession;
|
||||||
|
|
||||||
public DeleteRows(TRId trId, ArrayList<String> rows, EventBus eventBus) {
|
public DeleteRows(TRId trId, ArrayList<String> rows, EventBus eventBus) {
|
||||||
this.trId = trId;
|
this.trId = trId;
|
||||||
|
|
|
@ -0,0 +1,320 @@
|
||||||
|
package org.gcube.portlets.user.td.tablewidget.client.rows;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsFinalException;
|
||||||
|
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTIsLockedException;
|
||||||
|
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.rows.DuplicatesSession;
|
||||||
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialog;
|
||||||
|
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
|
||||||
|
import org.gcube.portlets.user.td.tablewidget.client.properties.ColumnDataProperties;
|
||||||
|
import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle;
|
||||||
|
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableRequestType;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.OperationResult;
|
||||||
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
|
||||||
|
import com.allen_sauer.gwt.log.client.Log;
|
||||||
|
import com.google.gwt.core.client.GWT;
|
||||||
|
import com.google.gwt.core.client.Scheduler;
|
||||||
|
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||||
|
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||||
|
import com.google.web.bindery.event.shared.EventBus;
|
||||||
|
import com.sencha.gxt.cell.core.client.ButtonCell.IconAlign;
|
||||||
|
import com.sencha.gxt.core.client.IdentityValueProvider;
|
||||||
|
import com.sencha.gxt.core.client.Style.SelectionMode;
|
||||||
|
import com.sencha.gxt.core.client.dom.ScrollSupport.ScrollMode;
|
||||||
|
import com.sencha.gxt.core.client.util.Margins;
|
||||||
|
import com.sencha.gxt.data.client.loader.RpcProxy;
|
||||||
|
import com.sencha.gxt.data.shared.ListStore;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoadConfig;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoadResult;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoadResultBean;
|
||||||
|
import com.sencha.gxt.data.shared.loader.ListLoader;
|
||||||
|
import com.sencha.gxt.data.shared.loader.LoadResultListStoreBinding;
|
||||||
|
import com.sencha.gxt.widget.core.client.FramedPanel;
|
||||||
|
import com.sencha.gxt.widget.core.client.button.TextButton;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
|
||||||
|
import com.sencha.gxt.widget.core.client.container.HBoxLayoutContainer;
|
||||||
|
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.event.SelectEvent;
|
||||||
|
import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
|
import com.sencha.gxt.widget.core.client.form.FieldLabel;
|
||||||
|
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.ColumnModel;
|
||||||
|
import com.sencha.gxt.widget.core.client.grid.Grid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo email: <a
|
||||||
|
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DuplicatesRowsDeletePanel extends FramedPanel implements
|
||||||
|
MonitorDialogListener {
|
||||||
|
private static final String WIDTH = "640px";
|
||||||
|
private static final String HEIGHT = "520px";
|
||||||
|
|
||||||
|
private TRId trId;
|
||||||
|
private EventBus eventBus;
|
||||||
|
|
||||||
|
private DuplicatesSession duplicatesSession;
|
||||||
|
|
||||||
|
private ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader;
|
||||||
|
private Grid<ColumnData> grid;
|
||||||
|
private CheckBoxSelectionModel<ColumnData> sm;
|
||||||
|
|
||||||
|
private TextButton deleteButton;
|
||||||
|
|
||||||
|
public DuplicatesRowsDeletePanel(TRId trId, EventBus eventBus) {
|
||||||
|
setWidth(WIDTH);
|
||||||
|
setHeight(HEIGHT);
|
||||||
|
setHeaderVisible(false);
|
||||||
|
setBodyBorder(false);
|
||||||
|
this.trId = trId;
|
||||||
|
this.eventBus = eventBus;
|
||||||
|
Log.debug("Create DuplicatesPanel(): [" + trId.toString() + "]");
|
||||||
|
|
||||||
|
ColumnDataProperties props = GWT.create(ColumnDataProperties.class);
|
||||||
|
|
||||||
|
ColumnConfig<ColumnData, String> labelCol = new ColumnConfig<ColumnData, String>(
|
||||||
|
props.label());
|
||||||
|
|
||||||
|
IdentityValueProvider<ColumnData> identity = new IdentityValueProvider<ColumnData>();
|
||||||
|
sm = new CheckBoxSelectionModel<ColumnData>(identity);
|
||||||
|
|
||||||
|
List<ColumnConfig<ColumnData, ?>> l = new ArrayList<ColumnConfig<ColumnData, ?>>();
|
||||||
|
l.add(sm.getColumn());
|
||||||
|
l.add(labelCol);
|
||||||
|
ColumnModel<ColumnData> cm = new ColumnModel<ColumnData>(l);
|
||||||
|
|
||||||
|
ListStore<ColumnData> store = new ListStore<ColumnData>(props.id());
|
||||||
|
|
||||||
|
RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>> proxy = new RpcProxy<ListLoadConfig, ListLoadResult<ColumnData>>() {
|
||||||
|
|
||||||
|
public void load(ListLoadConfig loadConfig,
|
||||||
|
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||||
|
loadData(loadConfig, callback);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
loader = new ListLoader<ListLoadConfig, ListLoadResult<ColumnData>>(
|
||||||
|
proxy);
|
||||||
|
|
||||||
|
loader.setRemoteSort(false);
|
||||||
|
loader.addLoadHandler(new LoadResultListStoreBinding<ListLoadConfig, ColumnData, ListLoadResult<ColumnData>>(
|
||||||
|
store) {
|
||||||
|
});
|
||||||
|
|
||||||
|
grid = new Grid<ColumnData>(store, cm) {
|
||||||
|
@Override
|
||||||
|
protected void onAfterFirstAttach() {
|
||||||
|
super.onAfterFirstAttach();
|
||||||
|
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
|
||||||
|
|
||||||
|
public void execute() {
|
||||||
|
loader.load();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
sm.setSelectionMode(SelectionMode.MULTI);
|
||||||
|
grid.setLoader(loader);
|
||||||
|
grid.setSelectionModel(sm);
|
||||||
|
// grid.getView().setAutoExpandColumn(labelCol);
|
||||||
|
grid.setHeight(360);
|
||||||
|
grid.getView().setStripeRows(true);
|
||||||
|
grid.getView().setColumnLines(true);
|
||||||
|
grid.getView().setAutoFill(true);
|
||||||
|
grid.setBorders(false);
|
||||||
|
grid.setLoadMask(true);
|
||||||
|
grid.setColumnReordering(true);
|
||||||
|
grid.setColumnResize(false);
|
||||||
|
|
||||||
|
// Delete Button
|
||||||
|
deleteButton = new TextButton("Delete");
|
||||||
|
deleteButton
|
||||||
|
.setIcon(ResourceBundle.INSTANCE.tableDuplicateRowsRemove());
|
||||||
|
deleteButton.setIconAlign(IconAlign.RIGHT);
|
||||||
|
deleteButton.setTitle("Delete Duplicates Rows");
|
||||||
|
|
||||||
|
SelectHandler deleteHandler = new SelectHandler() {
|
||||||
|
|
||||||
|
public void onSelect(SelectEvent event) {
|
||||||
|
onDeleteDuplicate();
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
deleteButton.addSelectHandler(deleteHandler);
|
||||||
|
|
||||||
|
FieldLabel columnsLabel = new FieldLabel(null, "Columns");
|
||||||
|
columnsLabel.getElement().applyStyles("font-weight:bold");
|
||||||
|
HBoxLayoutContainer hBox = new HBoxLayoutContainer();
|
||||||
|
hBox.add(deleteButton, new BoxLayoutData(new Margins(2, 5, 2, 5)));
|
||||||
|
|
||||||
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||||
|
v.setScrollMode(ScrollMode.AUTOY);
|
||||||
|
v.setAdjustForScroll(true);
|
||||||
|
v.add(columnsLabel, new VerticalLayoutData(-1, -1, new Margins(2, 1, 5,
|
||||||
|
1)));
|
||||||
|
v.add(grid, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
v.add(hBox, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0)));
|
||||||
|
add(v, new VerticalLayoutData(1, -1, new Margins(0)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ArrayList<ColumnData> getSelectedItems() {
|
||||||
|
return new ArrayList<ColumnData>(grid.getSelectionModel()
|
||||||
|
.getSelectedItems());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void update(TRId trId) {
|
||||||
|
this.trId = trId;
|
||||||
|
loader.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void loadData(ListLoadConfig loadConfig,
|
||||||
|
final AsyncCallback<ListLoadResult<ColumnData>> callback) {
|
||||||
|
TDGWTServiceAsync.INSTANCE.getColumns(trId,
|
||||||
|
new AsyncCallback<ArrayList<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 {
|
||||||
|
Log.error("load columns failure:"
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error retrieving columns",
|
||||||
|
"Error retrieving columns");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
callback.onFailure(caught);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSuccess(ArrayList<ColumnData> result) {
|
||||||
|
Log.trace("loaded " + result.size() + " ColumnData");
|
||||||
|
callback.onSuccess(new ListLoadResultBean<ColumnData>(
|
||||||
|
result));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void onDeleteDuplicate() {
|
||||||
|
ArrayList<ColumnData> col = getSelectedItems();
|
||||||
|
if (col == null || col.size() < 1) {
|
||||||
|
UtilsGXT3.alert("Attention", "Attention no column selected!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
duplicatesSession = new DuplicatesSession(trId, col,
|
||||||
|
DuplicatesSession.DuplicateOp.DELETE);
|
||||||
|
|
||||||
|
TDGWTServiceAsync.INSTANCE.startDuplicates(duplicatesSession,
|
||||||
|
new AsyncCallback<String>() {
|
||||||
|
|
||||||
|
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.debug("Delete Duplicates Error: "
|
||||||
|
+ caught.getLocalizedMessage());
|
||||||
|
UtilsGXT3.alert("Error Deleting Rows",
|
||||||
|
caught.getLocalizedMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onSuccess(String taskId) {
|
||||||
|
openMonitorDialog(taskId);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void close() {
|
||||||
|
/*
|
||||||
|
* if (parent != null) { parent.close(); }
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
// /
|
||||||
|
protected void openMonitorDialog(String taskId) {
|
||||||
|
MonitorDialog monitorDialog = new MonitorDialog(taskId, eventBus);
|
||||||
|
monitorDialog.addProgressDialogListener(this);
|
||||||
|
monitorDialog.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationComplete(OperationResult operationResult) {
|
||||||
|
ChangeTableWhy why = ChangeTableWhy.TABLEUPDATED;
|
||||||
|
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||||
|
ChangeTableRequestType.DUPLICATES, operationResult.getTrId(),
|
||||||
|
why);
|
||||||
|
eventBus.fireEvent(changeTableRequestEvent);
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationFailed(Throwable caught, String reason, String details) {
|
||||||
|
UtilsGXT3.alert(reason, details);
|
||||||
|
close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationStopped(OperationResult operationResult,
|
||||||
|
String reason, String details) {
|
||||||
|
ChangeTableWhy why = ChangeTableWhy.TABLECURATION;
|
||||||
|
ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
|
||||||
|
ChangeTableRequestType.DUPLICATES, operationResult.getTrId(),
|
||||||
|
why);
|
||||||
|
eventBus.fireEvent(changeTableRequestEvent);
|
||||||
|
close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationAborted() {
|
||||||
|
close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void operationPutInBackground() {
|
||||||
|
close();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -54,32 +54,35 @@ import com.sencha.gxt.widget.core.client.grid.ColumnConfig;
|
||||||
import com.sencha.gxt.widget.core.client.grid.ColumnModel;
|
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;
|
||||||
|
|
||||||
public class DuplicatesRowsPanel extends FramedPanel implements
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DuplicatesRowsDetectionPanel extends FramedPanel implements
|
||||||
MonitorDialogListener {
|
MonitorDialogListener {
|
||||||
protected String WIDTH = "640px";
|
private static final String WIDTH = "640px";
|
||||||
protected String HEIGHT = "520px";
|
private static final String HEIGHT = "520px";
|
||||||
|
|
||||||
protected TRId trId;
|
private TRId trId;
|
||||||
protected EventBus eventBus;
|
private EventBus eventBus;
|
||||||
protected ArrayList<String> rows;
|
|
||||||
|
|
||||||
protected DuplicatesSession duplicatesSession;
|
private DuplicatesSession duplicatesSession;
|
||||||
|
|
||||||
protected ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader;
|
private ListLoader<ListLoadConfig, ListLoadResult<ColumnData>> loader;
|
||||||
protected Grid<ColumnData> grid;
|
private Grid<ColumnData> grid;
|
||||||
protected CheckBoxSelectionModel<ColumnData> sm;
|
private CheckBoxSelectionModel<ColumnData> sm;
|
||||||
protected FieldLabel columnsSelectLabel;
|
private TextButton validatesButton;
|
||||||
protected TextButton deleteButton;
|
|
||||||
protected TextButton validatesButton;
|
|
||||||
|
|
||||||
public DuplicatesRowsPanel(TRId trId, EventBus eventBus) {
|
public DuplicatesRowsDetectionPanel(TRId trId, EventBus eventBus) {
|
||||||
setWidth(WIDTH);
|
setWidth(WIDTH);
|
||||||
setHeight(HEIGHT);
|
setHeight(HEIGHT);
|
||||||
setHeaderVisible(false);
|
setHeaderVisible(false);
|
||||||
setBodyBorder(false);
|
setBodyBorder(false);
|
||||||
this.trId = trId;
|
this.trId = trId;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
Log.debug("Create DuplicatesPanel(): [" + trId.toString() + "]");
|
Log.debug("Create DuplicatesRowsDetectionPanel(): [" + trId.toString() + "]");
|
||||||
|
|
||||||
ColumnDataProperties props = GWT.create(ColumnDataProperties.class);
|
ColumnDataProperties props = GWT.create(ColumnDataProperties.class);
|
||||||
|
|
||||||
|
@ -137,21 +140,7 @@ public class DuplicatesRowsPanel extends FramedPanel implements
|
||||||
grid.setColumnReordering(true);
|
grid.setColumnReordering(true);
|
||||||
grid.setColumnResize(false);
|
grid.setColumnResize(false);
|
||||||
|
|
||||||
// Delete Button
|
|
||||||
deleteButton = new TextButton("Delete");
|
|
||||||
deleteButton
|
|
||||||
.setIcon(ResourceBundle.INSTANCE.tableDuplicateRowsRemove());
|
|
||||||
deleteButton.setIconAlign(IconAlign.RIGHT);
|
|
||||||
deleteButton.setTitle("Delete Duplicates Rows");
|
|
||||||
|
|
||||||
SelectHandler deleteHandler = new SelectHandler() {
|
|
||||||
|
|
||||||
public void onSelect(SelectEvent event) {
|
|
||||||
onDeleteDuplicate();
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
deleteButton.addSelectHandler(deleteHandler);
|
|
||||||
|
|
||||||
// Validates Button
|
// Validates Button
|
||||||
validatesButton = new TextButton("Validate");
|
validatesButton = new TextButton("Validate");
|
||||||
|
@ -172,7 +161,6 @@ public class DuplicatesRowsPanel extends FramedPanel implements
|
||||||
columnsLabel.getElement().applyStyles("font-weight:bold");
|
columnsLabel.getElement().applyStyles("font-weight:bold");
|
||||||
HBoxLayoutContainer hBox = new HBoxLayoutContainer();
|
HBoxLayoutContainer hBox = new HBoxLayoutContainer();
|
||||||
hBox.add(validatesButton, new BoxLayoutData(new Margins(2, 5, 2, 5)));
|
hBox.add(validatesButton, new BoxLayoutData(new Margins(2, 5, 2, 5)));
|
||||||
hBox.add(deleteButton, new BoxLayoutData(new Margins(2, 5, 2, 5)));
|
|
||||||
|
|
||||||
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
VerticalLayoutContainer v = new VerticalLayoutContainer();
|
||||||
v.setScrollMode(ScrollMode.AUTOY);
|
v.setScrollMode(ScrollMode.AUTOY);
|
||||||
|
@ -231,50 +219,7 @@ public class DuplicatesRowsPanel extends FramedPanel implements
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void onDeleteDuplicate() {
|
|
||||||
ArrayList<ColumnData> col = getSelectedItems();
|
|
||||||
if (col == null || col.size() < 1) {
|
|
||||||
UtilsGXT3.alert("Attention", "Attention no column selected!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
duplicatesSession = new DuplicatesSession(trId, col,
|
|
||||||
DuplicatesSession.DuplicateOp.DELETE);
|
|
||||||
|
|
||||||
TDGWTServiceAsync.INSTANCE.startDuplicates(duplicatesSession,
|
|
||||||
new AsyncCallback<String>() {
|
|
||||||
|
|
||||||
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.debug("Delete Duplicates Error: "
|
|
||||||
+ caught.getLocalizedMessage());
|
|
||||||
UtilsGXT3
|
|
||||||
.alert("Error Deleting Rows",
|
|
||||||
caught.getLocalizedMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onSuccess(String taskId) {
|
|
||||||
openMonitorDialog(taskId);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void onValidatesDuplicate() {
|
protected void onValidatesDuplicate() {
|
||||||
ArrayList<ColumnData> col = getSelectedItems();
|
ArrayList<ColumnData> col = getSelectedItems();
|
|
@ -2,7 +2,6 @@ package org.gcube.portlets.user.td.tablewidget.client.rows;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsSession;
|
|
||||||
import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle;
|
import org.gcube.portlets.user.td.tablewidget.client.resources.ResourceBundle;
|
||||||
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
|
import org.gcube.portlets.user.td.tablewidget.client.util.UtilsGXT3;
|
||||||
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
|
||||||
|
@ -20,13 +19,8 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class EditRowDialog extends Window {
|
public class EditRowDialog extends Window {
|
||||||
protected String WIDTH = "690px";
|
private static final String WIDTH = "690px";
|
||||||
protected String HEIGHT = "456px";
|
private static final String HEIGHT = "456px";
|
||||||
protected TRId trId;
|
|
||||||
protected EventBus eventBus;
|
|
||||||
protected ArrayList<RowRaw> rows;
|
|
||||||
protected DeleteRowsSession deleteRowsSession;
|
|
||||||
|
|
||||||
private boolean addRow;
|
private boolean addRow;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -37,9 +31,6 @@ public class EditRowDialog extends Window {
|
||||||
* @param eventBus
|
* @param eventBus
|
||||||
*/
|
*/
|
||||||
public EditRowDialog(TRId trId, ArrayList<RowRaw> rows, EventBus eventBus) {
|
public EditRowDialog(TRId trId, ArrayList<RowRaw> rows, EventBus eventBus) {
|
||||||
this.trId = trId;
|
|
||||||
//this.rows = rows;
|
|
||||||
this.eventBus = eventBus;
|
|
||||||
addRow = false;
|
addRow = false;
|
||||||
if (rows == null) {
|
if (rows == null) {
|
||||||
UtilsGXT3.alert("Attentions", "No row selected");
|
UtilsGXT3.alert("Attentions", "No row selected");
|
||||||
|
@ -59,8 +50,6 @@ public class EditRowDialog extends Window {
|
||||||
* @param eventBus
|
* @param eventBus
|
||||||
*/
|
*/
|
||||||
public EditRowDialog(TRId trId, EventBus eventBus) {
|
public EditRowDialog(TRId trId, EventBus eventBus) {
|
||||||
this.trId = trId;
|
|
||||||
this.eventBus = eventBus;
|
|
||||||
addRow = true;
|
addRow = true;
|
||||||
initWindow();
|
initWindow();
|
||||||
EditRowPanel editRowPanel = new EditRowPanel(this, trId, eventBus);
|
EditRowPanel editRowPanel = new EditRowPanel(this, trId, eventBus);
|
||||||
|
|
|
@ -8,27 +8,27 @@ import com.google.gwt.http.client.RequestCallback;
|
||||||
import com.google.gwt.http.client.RequestException;
|
import com.google.gwt.http.client.RequestException;
|
||||||
import com.google.gwt.http.client.Response;
|
import com.google.gwt.http.client.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class RowsDataClient {
|
public class RowsDataClient {
|
||||||
public void retrievesRowsAsJson() {
|
public void retrievesRowsAsJson() {
|
||||||
// Send request to server and catch any errors.
|
// Send request to server and catch any errors.
|
||||||
String path = GWT.getModuleBaseURL() + "tdwxrowsdata";
|
String path = GWT.getModuleBaseURL() + "tdwxrowsdata";
|
||||||
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, path);
|
RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, path);
|
||||||
//builder.setHeader(ServletParameters.TD_SESSION_ID,
|
|
||||||
// String.valueOf(tdSessionId));
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Request request = builder.sendRequest(null, new RequestCallback() {
|
Request request = builder.sendRequest(null, new RequestCallback() {
|
||||||
public void onError(Request request, Throwable exception) {
|
public void onError(Request request, Throwable exception) {
|
||||||
//displayError("Couldn't retrieve JSON");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onResponseReceived(Request request,
|
public void onResponseReceived(Request request,
|
||||||
Response response) {
|
Response response) {
|
||||||
if (200 == response.getStatusCode()) {
|
if (200 == response.getStatusCode()) {
|
||||||
//updateTable(JsonUtils.safeEval(response.getText()));
|
|
||||||
} else {
|
} else {
|
||||||
//displayError("Couldn't retrieve JSON ("
|
|
||||||
// + response.getStatusText() + ")");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,8 +15,8 @@ public class TableTypeElement implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = -5913441587564742269L;
|
private static final long serialVersionUID = -5913441587564742269L;
|
||||||
|
|
||||||
protected Integer id;
|
private Integer id;
|
||||||
protected TableType tableType;
|
private TableType tableType;
|
||||||
|
|
||||||
public TableTypeElement(Integer id, TableType tableType){
|
public TableTypeElement(Integer id, TableType tableType){
|
||||||
this.id=id;
|
this.id=id;
|
||||||
|
|
|
@ -6,6 +6,12 @@ import com.sencha.gxt.data.shared.LabelProvider;
|
||||||
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
import com.sencha.gxt.data.shared.ModelKeyProvider;
|
||||||
import com.sencha.gxt.data.shared.PropertyAccess;
|
import com.sencha.gxt.data.shared.PropertyAccess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author giancarlo
|
||||||
|
* email: <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface TableTypeProperties extends PropertyAccess<TableTypeElement> {
|
public interface TableTypeProperties extends PropertyAccess<TableTypeElement> {
|
||||||
|
|
||||||
@Path("id")
|
@Path("id")
|
||||||
|
|
|
@ -12,9 +12,9 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.tr.TableType;
|
||||||
*/
|
*/
|
||||||
public class TableTypeStore {
|
public class TableTypeStore {
|
||||||
|
|
||||||
protected static TableTypeElement genericElement=new TableTypeElement(1, TableType.GENERIC);
|
private static TableTypeElement genericElement=new TableTypeElement(1, TableType.GENERIC);
|
||||||
protected static TableTypeElement codelistElement=new TableTypeElement(2, TableType.CODELIST);
|
private static TableTypeElement codelistElement=new TableTypeElement(2, TableType.CODELIST);
|
||||||
protected static TableTypeElement datasetElement=new TableTypeElement(3, TableType.DATASET);
|
private static TableTypeElement datasetElement=new TableTypeElement(3, TableType.DATASET);
|
||||||
|
|
||||||
|
|
||||||
protected static ArrayList<TableTypeElement> tableType = new ArrayList<TableTypeElement>() {
|
protected static ArrayList<TableTypeElement> tableType = new ArrayList<TableTypeElement>() {
|
||||||
|
|
Loading…
Reference in New Issue