Fixed Final and Lock error

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-csv-export-widget@100228 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-09-26 15:04:16 +00:00
parent d3645cb653
commit 2c74fac2d2
3 changed files with 55 additions and 41 deletions

View File

@ -122,9 +122,11 @@ public class CSVExportConfigCard extends WizardCard {
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
GWT.log("Error loading charset list", caught);
Log.error("Error loading charset list", caught);
showErrorAndHide("Error loading charset list",
"Error loading charset list", "", caught);
"Error loading charset list", caught);
}
}
});
@ -192,7 +194,7 @@ public class CSVExportConfigCard extends WizardCard {
"The delimiter use to delimit the CSV fields"));
content.add(new FieldLabel(delimitersPanel, "Delimiter"));
csvColumnGridPanel = new ColumnDataGridPanel();
csvColumnGridPanel = new ColumnDataGridPanel(this);
csvColumnGridPanel
.addSelectionHandler(new SelectionHandler<ColumnData>() {

View File

@ -5,6 +5,7 @@ package org.gcube.portlets.user.td.csvexportwidget.client;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.csv.CSVExportSession;
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.monitorwidget.client.MonitorDialog;
import org.gcube.portlets.user.td.monitorwidget.client.MonitorDialogListener;
@ -20,13 +21,10 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.FlexTable;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.FramedPanel;
import com.sencha.gxt.widget.core.client.box.AlertMessageBox;
import com.sencha.gxt.widget.core.client.container.BoxLayoutContainer.BoxLayoutData;
import com.sencha.gxt.widget.core.client.container.HtmlLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer;
import com.sencha.gxt.widget.core.client.container.VBoxLayoutContainer.VBoxLayoutAlign;
import com.sencha.gxt.widget.core.client.event.HideEvent;
import com.sencha.gxt.widget.core.client.event.HideEvent.HideHandler;
/**
*
@ -102,11 +100,17 @@ public class CSVOperationInProgressCard extends WizardCard implements
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
showErrorAndHide(
"Error in exportCSV",
"An error occured in exportCSV: "
+ caught.getLocalizedMessage(),
caught.getStackTrace().toString(), caught);
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
showErrorAndHide("Error Locked",
caught.getLocalizedMessage(), caught);
} else {
showErrorAndHide("Error in exportCSV",
"An error occured in exportCSV: "
+ caught.getLocalizedMessage(),
caught);
}
}
}
});
@ -175,13 +179,8 @@ public class CSVOperationInProgressCard extends WizardCard implements
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
AlertMessageBox d = new AlertMessageBox("Error in CSV Export",
reason);
d.addHideHandler(new HideHandler() {
public void onHide(HideEvent event) {
}
});
d.show();
showErrorAndHide("Error in CSV Export",
reason,caught);
}
forceLayout();

View File

@ -4,7 +4,12 @@ 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.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.widgetcommonevent.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.wizardwidget.client.WizardCard;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.GWT;
@ -40,27 +45,26 @@ public class ColumnDataGridPanel extends ContentPanel implements
protected final CheckBoxSelectionModel<ColumnData> sm;
protected final Grid<ColumnData> grid;
private WizardCard parent;
public ColumnDataGridPanel() {
public ColumnDataGridPanel(WizardCard parent) {
this.parent=parent;
Log.debug("ColumnDataGridPanel");
setHeadingText("Columns");
ColumnConfig<ColumnData, String> labelCol = new ColumnConfig<ColumnData, String>(
props.label());
IdentityValueProvider<ColumnData> identity = new IdentityValueProvider<ColumnData>();
sm = new CheckBoxSelectionModel<ColumnData>(
identity);
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>>() {
@ -83,7 +87,7 @@ public class ColumnDataGridPanel extends ContentPanel implements
protected void onAfterFirstAttach() {
super.onAfterFirstAttach();
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
public void execute() {
loader.load();
}
@ -91,21 +95,18 @@ public class ColumnDataGridPanel extends ContentPanel implements
}
};
sm.setSelectionMode(SelectionMode.MULTI);
sm.setSelectionMode(SelectionMode.MULTI);
grid.setLoader(loader);
grid.setSelectionModel(sm);
grid.setHeight(300);
//grid.getView().setAutoExpandColumn(labelCol);
// grid.getView().setAutoExpandColumn(labelCol);
grid.getView().setStripeRows(true);
grid.getView().setColumnLines(true);
grid.getView().setAutoFill(true);
grid.setBorders(false);
grid.setLoadMask(true);
grid.setColumnReordering(true);
VerticalLayoutContainer con = new VerticalLayoutContainer();
con.setScrollMode(ScrollMode.AUTO);
con.add(grid, new VerticalLayoutData(-1, -1, new Margins(0)));
@ -122,10 +123,23 @@ public class ColumnDataGridPanel extends ContentPanel implements
TDGWTServiceAsync.INSTANCE
.getColumns(new AsyncCallback<ArrayList<ColumnData>>() {
public void onFailure(Throwable caught) {
Log.error("No load columns: "
+ caught.getLocalizedMessage());
if (caught instanceof TDGWTSessionExpiredException) {
parent.getEventBus()
.fireEvent(
new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
if (caught instanceof TDGWTIsLockedException) {
Log.error(caught.getLocalizedMessage());
parent.showErrorAndHide("Error Locked",
caught.getLocalizedMessage(), caught);
} else {
Log.error("No load columns: "
+ caught.getLocalizedMessage());
}
}
callback.onFailure(caught);
}
@ -140,11 +154,10 @@ public class ColumnDataGridPanel extends ContentPanel implements
}
public ArrayList<ColumnData> getSelectedItems() {
return new ArrayList<ColumnData>(grid
.getSelectionModel().getSelectedItems());
}
return new ArrayList<ColumnData>(grid.getSelectionModel()
.getSelectedItems());
}
public HandlerRegistration addSelectionHandler(
SelectionHandler<ColumnData> handler) {