Added SessionExpiredShow

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-table-widget@95793 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-05-16 14:21:10 +00:00 committed by Giancarlo Panichi
parent 5ec8a3d7ac
commit ed0e9fdef3
14 changed files with 890 additions and 783 deletions

View File

@ -1,8 +1,7 @@
package org.gcube.portlets.user.td.tablewidget.client; package org.gcube.portlets.user.td.tablewidget.client;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData; import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession;
import org.gcube.portlets.user.td.tablewidget.client.progress.ChangeTableTypeProgressDialog; import org.gcube.portlets.user.td.tablewidget.client.progress.ChangeTableTypeProgressDialog;
@ -10,6 +9,8 @@ import org.gcube.portlets.user.td.tablewidget.client.type.TableTypeElement;
import org.gcube.portlets.user.td.tablewidget.client.type.TableTypeProperties; import org.gcube.portlets.user.td.tablewidget.client.type.TableTypeProperties;
import org.gcube.portlets.user.td.tablewidget.client.type.TableTypeStore; import org.gcube.portlets.user.td.tablewidget.client.type.TableTypeStore;
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.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -29,50 +30,47 @@ import com.sencha.gxt.widget.core.client.event.SelectEvent.SelectHandler;
import com.sencha.gxt.widget.core.client.form.ComboBox; import com.sencha.gxt.widget.core.client.form.ComboBox;
import com.sencha.gxt.widget.core.client.form.FieldLabel; import com.sencha.gxt.widget.core.client.form.FieldLabel;
/** /**
* *
* @author "Giancarlo Panichi" * @author "Giancarlo Panichi" <a
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
*/ */
public class ChangeTableTypePanel extends FramedPanel { public class ChangeTableTypePanel extends FramedPanel {
protected String WIDTH = "640px"; protected String WIDTH = "640px";
protected String HEIGHT = "520px"; protected String HEIGHT = "520px";
protected TRId trId; protected TRId trId;
protected TableData table; protected TableData table;
protected String headingTitle; protected String headingTitle;
protected VerticalLayoutContainer vl; protected VerticalLayoutContainer vl;
protected EventBus eventBus; protected EventBus eventBus;
protected ChangeTableTypeSession changeTableTypeSession; protected ChangeTableTypeSession changeTableTypeSession;
protected ChangeTableTypeProgressDialog changeTableTypeProgressDialog; protected ChangeTableTypeProgressDialog changeTableTypeProgressDialog;
protected ComboBox<TableTypeElement> comboTableType; protected ComboBox<TableTypeElement> comboTableType;
protected TextButton change; protected TextButton change;
public ChangeTableTypePanel(TRId trId, EventBus eventBus) { public ChangeTableTypePanel(TRId trId, EventBus eventBus) {
super(); super();
this.trId=trId; this.trId = trId;
this.eventBus = eventBus; this.eventBus = eventBus;
forceLayoutOnResize=true; forceLayoutOnResize = true;
create(); create();
} }
protected void create(){ protected void create() {
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
setHeaderVisible(false); setHeaderVisible(false);
setBodyBorder(false); setBodyBorder(false);
TableTypeProperties props = GWT.create(TableTypeProperties.class); TableTypeProperties props = GWT.create(TableTypeProperties.class);
ListStore<TableTypeElement> storeTableType = new ListStore<TableTypeElement>(props.id()); ListStore<TableTypeElement> storeTableType = new ListStore<TableTypeElement>(
props.id());
storeTableType.addAll(TableTypeStore.getTableTypes()); storeTableType.addAll(TableTypeStore.getTableTypes());
Log.trace("Store created"); Log.trace("Store created");
comboTableType = new ComboBox<TableTypeElement>(storeTableType, comboTableType = new ComboBox<TableTypeElement>(storeTableType,
@ -80,104 +78,110 @@ public class ChangeTableTypePanel extends FramedPanel {
Log.trace("ComboTableType created"); Log.trace("ComboTableType created");
comboTableType.setEmptyText("Select a Table Type..."); comboTableType.setEmptyText("Select a Table Type...");
comboTableType.setItemId("ComboTableType"); comboTableType.setItemId("ComboTableType");
comboTableType.setWidth("200px"); comboTableType.setWidth("200px");
comboTableType.setEditable(false); comboTableType.setEditable(false);
comboTableType.setTriggerAction(TriggerAction.ALL); comboTableType.setTriggerAction(TriggerAction.ALL);
change = new TextButton("Change");
change=new TextButton("Change");
change.addSelectHandler(new SelectHandler() { change.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) { public void onSelect(SelectEvent event) {
onChangeTableType(); onChangeTableType();
} }
}); });
vl = new VerticalLayoutContainer(); vl = new VerticalLayoutContainer();
vl.setScrollMode(ScrollMode.AUTO); vl.setScrollMode(ScrollMode.AUTO);
vl.setAdjustForScroll(true); vl.setAdjustForScroll(true);
vl.add(new FieldLabel(comboTableType, "Table Type"),
vl.add(new FieldLabel(comboTableType, "Table Type"), new VerticalLayoutData(1, new VerticalLayoutData(1, -1));
-1)); vl.add(change,
vl.add(change, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0))); new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0)));
add(vl); add(vl);
show(); show();
load(); load();
} }
protected void onChangeTableType(){ protected void onChangeTableType() {
TableTypeElement tableTypeElement = comboTableType.getCurrentValue(); TableTypeElement tableTypeElement = comboTableType.getCurrentValue();
if(tableTypeElement!=null){ if (tableTypeElement != null) {
changeTableTypeSession=new ChangeTableTypeSession(trId,tableTypeElement.getTableType()); changeTableTypeSession = new ChangeTableTypeSession(trId,
tableTypeElement.getTableType());
callChangeTableType(); callChangeTableType();
} else { } else {
UtilsGXT3.alert("Attention", "Select a table type!"); UtilsGXT3.alert("Attention", "Select a table type!");
} }
} }
private void callChangeTableType() { private void callChangeTableType() {
TDGWTServiceAsync.INSTANCE.startChangeTableType( TDGWTServiceAsync.INSTANCE.startChangeTableType(changeTableTypeSession,
changeTableTypeSession, new AsyncCallback<Void>() { new AsyncCallback<Void>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.debug("Change The Table Type Error: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error Changing The Table Type", SessionExpiredType.EXPIREDONSERVER));
"Error in invocation of Change Table Type operation!"); } else {
Log.debug("Change The Table Type Error: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error Changing The Table Type",
"Error in invocation of Change Table Type operation!");
}
} }
public void onSuccess(Void result) { public void onSuccess(Void result) {
changeTableTypeProgressDialog= new ChangeTableTypeProgressDialog(changeTableTypeSession, eventBus); changeTableTypeProgressDialog = new ChangeTableTypeProgressDialog(
changeTableTypeSession, eventBus);
} }
}); });
} }
protected void setCurrentType() {
protected void setCurrentType(){ TableTypeElement tElement = TableTypeStore.getTableTypeElement(table
TableTypeElement tElement=TableTypeStore.getTableTypeElement(table.getTypeName()); .getTypeName());
comboTableType.setValue(tElement); comboTableType.setValue(tElement);
} }
private void load() { private void load() {
TDGWTServiceAsync.INSTANCE.getTable(trId, TDGWTServiceAsync.INSTANCE.getTable(trId,
new AsyncCallback<TableData>() { new AsyncCallback<TableData>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error retrieving table: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error retrieving table",caught.getMessage()); SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error retrieving table: "
+ caught.getMessage());
UtilsGXT3.alert("Error retrieving table",
caught.getMessage());
}
} }
public void onSuccess(TableData result) { public void onSuccess(TableData result) {
Log.debug("Retrieved table: "+result.toString()); Log.debug("Retrieved table: " + result.toString());
table=result; table = result;
setCurrentType(); setCurrentType();
} }
}); });
} }
public void update(TRId trId) { public void update(TRId trId) {
this.trId = trId; this.trId = trId;
load(); load();
} }
} }

View File

@ -1,11 +1,14 @@
package org.gcube.portlets.user.td.tablewidget.client; package org.gcube.portlets.user.td.tablewidget.client;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.clone.CloneTabularResourceSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.clone.CloneTabularResourceSession;
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.client.event.ChangeTableRequestEvent; 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.ChangeTableRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; 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.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -34,24 +37,29 @@ public class CloneTabularResource {
cloneTabularResourceSession, new AsyncCallback<TRId>() { cloneTabularResourceSession, new AsyncCallback<TRId>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.debug("Clone Error: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error Cloning Tabular Resource", SessionExpiredType.EXPIREDONSERVER));
"Error in clone operation!"); } else {
Log.debug("Clone Error: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error Cloning Tabular Resource",
"Error in clone operation!");
}
} }
public void onSuccess(TRId result) { public void onSuccess(TRId result) {
Log.info("TR Clone:"+result); Log.info("TR Clone:" + result);
final ChangeTableRequestEvent event=new ChangeTableRequestEvent(ChangeTableRequestType.CLONETABULARRESOURCE,result,ChangeTableWhy.TABLEUPDATED); final ChangeTableRequestEvent event = new ChangeTableRequestEvent(
ChangeTableRequestType.CLONETABULARRESOURCE,
result, ChangeTableWhy.TABLEUPDATED);
eventBus.fireEvent(event); eventBus.fireEvent(event);
UtilsGXT3.info("Clone", "Clone Tabular Resource Succed"); UtilsGXT3
.info("Clone", "Clone Tabular Resource Succed");
} }
}); });
} }
} }

View File

@ -1,9 +1,12 @@
package org.gcube.portlets.user.td.tablewidget.client.history; package org.gcube.portlets.user.td.tablewidget.client.history;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
import org.gcube.portlets.user.td.tablewidget.client.progress.RollBackProgressDialog; import org.gcube.portlets.user.td.tablewidget.client.progress.RollBackProgressDialog;
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.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -26,11 +29,15 @@ public class HistoryDiscard {
TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback<TRId>() { TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback<TRId>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error retrieving trId: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error", SessionExpiredType.EXPIREDONSERVER));
"Error retrieving current tabular resource id"); } else {
Log.error("Error retrieving trId: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrieving current tabular resource id");
}
} }
public void onSuccess(TRId result) { public void onSuccess(TRId result) {
@ -47,10 +54,15 @@ public class HistoryDiscard {
new AsyncCallback<RollBackSession>() { new AsyncCallback<RollBackSession>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error in discard: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error in discard", "Error in discard"); SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error in discard: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error in discard",
"Error in discard");
}
} }
public void onSuccess(RollBackSession result) { public void onSuccess(RollBackSession result) {

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory; import org.gcube.portlets.user.td.gwtservice.shared.history.OpHistory;
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData; import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
@ -12,6 +13,8 @@ import org.gcube.portlets.user.td.tablewidget.client.progress.RollBackProgressDi
import org.gcube.portlets.user.td.tablewidget.client.properties.OpHistoryProperties; import org.gcube.portlets.user.td.tablewidget.client.properties.OpHistoryProperties;
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.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -120,8 +123,8 @@ public class HistoryPanel extends FramedPanel {
@Override @Override
public void render(Context context, String value, SafeHtmlBuilder sb) { public void render(Context context, String value, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<span title='"+value+"'>" sb.appendHtmlConstant("<span title='" + value + "'>" + value
+ value + "</span>"); + "</span>");
} }
@ -132,8 +135,6 @@ public class HistoryPanel extends FramedPanel {
ColumnConfig<OpHistory, String> rollBackColumn = new ColumnConfig<OpHistory, String>( ColumnConfig<OpHistory, String> rollBackColumn = new ColumnConfig<OpHistory, String>(
props.date(), 40, "Undo"); props.date(), 40, "Undo");
ActionButtonCellNoFirst button = new ActionButtonCellNoFirst(); ActionButtonCellNoFirst button = new ActionButtonCellNoFirst();
button.setIcon(ResourceBundle.INSTANCE.undo()); button.setIcon(ResourceBundle.INSTANCE.undo());
@ -150,9 +151,7 @@ public class HistoryPanel extends FramedPanel {
}); });
rollBackColumn.setCell(button); rollBackColumn.setCell(button);
List<ColumnConfig<OpHistory, ?>> l = new ArrayList<ColumnConfig<OpHistory, ?>>(); List<ColumnConfig<OpHistory, ?>> l = new ArrayList<ColumnConfig<OpHistory, ?>>();
l.add(expander); l.add(expander);
l.add(nameCol); l.add(nameCol);
@ -219,7 +218,7 @@ public class HistoryPanel extends FramedPanel {
protected void startSearchRollBackId(int rowIndex) { protected void startSearchRollBackId(int rowIndex) {
currentRowIndex = rowIndex; currentRowIndex = rowIndex;
currentOpHistory = store.get(rowIndex-1); currentOpHistory = store.get(rowIndex - 1);
Log.debug(currentOpHistory.toString() + " was clicked.[rowIndex=" Log.debug(currentOpHistory.toString() + " was clicked.[rowIndex="
+ currentRowIndex + " ]"); + currentRowIndex + " ]");
callRollBack(); callRollBack();
@ -233,11 +232,15 @@ public class HistoryPanel extends FramedPanel {
new AsyncCallback<Void>() { new AsyncCallback<Void>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error in rollback: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error in rollback", SessionExpiredType.EXPIREDONSERVER));
"Error in rollback"); } else {
Log.error("Error in rollback: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error in rollback",
"Error in rollback");
}
} }
public void onSuccess(Void result) { public void onSuccess(Void result) {
@ -262,10 +265,15 @@ public class HistoryPanel extends FramedPanel {
new AsyncCallback<ArrayList<OpHistory>>() { new AsyncCallback<ArrayList<OpHistory>>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error Retrieving History: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error retrieving history", SessionExpiredType.EXPIREDONSERVER));
"Error retrieving history"); } else {
Log.error("Error Retrieving History: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving history",
"Error retrieving history");
}
callback.onFailure(caught); callback.onFailure(caught);
} }
@ -288,11 +296,15 @@ public class HistoryPanel extends FramedPanel {
TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback<TRId>() { TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback<TRId>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error retrieving current TRId: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error", SessionExpiredType.EXPIREDONSERVER));
"Error retrieving current tabular resource id"); } else {
Log.error("Error retrieving current TRId: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrieving current tabular resource id");
}
} }
public void onSuccess(TRId result) { public void onSuccess(TRId result) {

View File

@ -1,10 +1,13 @@
package org.gcube.portlets.user.td.tablewidget.client.progress; package org.gcube.portlets.user.td.tablewidget.client.progress;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.ChangeTableTypeSession;
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.client.event.ChangeTableRequestEvent; 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.ChangeTableRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; 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.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -19,125 +22,130 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.Verti
import com.sencha.gxt.widget.core.client.event.SelectEvent; 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.event.SelectEvent.SelectHandler;
/** /**
* LabelColumnProgressDialog is a Dialog that show progress of change the column label * LabelColumnProgressDialog is a Dialog that show progress of change the column
* label
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/ */
public class ChangeTableTypeProgressDialog extends Window implements ChangeTableTypeProgressListener { public class ChangeTableTypeProgressDialog extends Window implements
public static final int STATUS_POLLING_DELAY = 1000; ChangeTableTypeProgressListener {
protected String WIDTH = "400px"; public static final int STATUS_POLLING_DELAY = 1000;
protected String HEIGHT = "120px"; protected String WIDTH = "400px";
protected ChangeTableTypeSession changeTableTypeSession; protected String HEIGHT = "120px";
protected EventBus eventBus; protected ChangeTableTypeSession changeTableTypeSession;
protected ChangeTableTypeProgressUpdater progressUpdater; protected EventBus eventBus;
protected TextButton ok; protected ChangeTableTypeProgressUpdater progressUpdater;
protected TRId trId; protected TextButton ok;
private ChangeTableWhy why; protected TRId trId;
private ChangeTableWhy why;
public ChangeTableTypeProgressDialog(ChangeTableTypeSession changeTableTypeSession, EventBus eventBus) {
this.changeTableTypeSession=changeTableTypeSession;
this.eventBus=eventBus;
setWidth(WIDTH);
setHeight(HEIGHT);
setBodyBorder(false);
setResizable(true);
setModal(true);
setHeadingText("Change The Table Type Progress");
trId=null;
FramedPanel panel=new FramedPanel();
panel.setHeaderVisible(false);
panel.setBodyBorder(false);
VerticalLayoutContainer v = new VerticalLayoutContainer();
ProgressBar progressBar = new ProgressBar();
ok=new TextButton("OK");
ok.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
updateInvocation();
}
});
v.add(progressBar, new VerticalLayoutData(1,
1, new Margins(5, 5, 5, 5)));
panel.add(v);
panel.addButton(ok);
add(panel);
progressUpdater = new ChangeTableTypeProgressUpdater();
progressUpdater.addListener(new ChangeTableTypeProgressBarUpdater(progressBar));
progressUpdater.addListener(this); public ChangeTableTypeProgressDialog(
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); ChangeTableTypeSession changeTableTypeSession, EventBus eventBus) {
show(); this.changeTableTypeSession = changeTableTypeSession;
ok.setVisible(false); this.eventBus = eventBus;
setWidth(WIDTH);
} setHeight(HEIGHT);
setBodyBorder(false);
setResizable(true);
setModal(true);
setHeadingText("Change The Table Type Progress");
public void operationInitializing() { trId = null;
// TODO Auto-generated method stub
}
public void operationUpdate(float elaborated) { FramedPanel panel = new FramedPanel();
// TODO Auto-generated method stub panel.setHeaderVisible(false);
panel.setBodyBorder(false);
}
public void operationComplete(TRId trId) { VerticalLayoutContainer v = new VerticalLayoutContainer();
Log.debug("Operation Complete return: "+trId.toString());
this.trId=trId; ProgressBar progressBar = new ProgressBar();
why=ChangeTableWhy.TABLEUPDATED;
updateInvocation(); ok = new TextButton("OK");
} ok.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
updateInvocation();
public void operationFailed(Throwable caught, String reason,
String failureDetails) {
ok.setVisible(true);
this.trId=null;
UtilsGXT3.alert("Error Changing The Table Type", reason);
}
public void updateInvocation(){
if(trId!=null){
ChangeTableRequestEvent changeTableRequestEvent=
new ChangeTableRequestEvent(ChangeTableRequestType.CHANGETABLETYPE, trId,why);
eventBus.fireEvent(changeTableRequestEvent);
} }
hide(); });
}
@Override v.add(progressBar,
public void operationStopped(TRId trId,String reason, String details) { new VerticalLayoutData(1, 1, new Margins(5, 5, 5, 5)));
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]");
panel.add(v);
panel.addButton(ok);
add(panel);
progressUpdater = new ChangeTableTypeProgressUpdater();
progressUpdater.addListener(new ChangeTableTypeProgressBarUpdater(
progressBar));
progressUpdater.addListener(this);
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
show();
ok.setVisible(false);
}
public void operationInitializing() {
// TODO Auto-generated method stub
}
public void operationUpdate(float elaborated) {
// TODO Auto-generated method stub
}
public void operationComplete(TRId trId) {
Log.debug("Operation Complete return: " + trId.toString());
this.trId = trId;
why = ChangeTableWhy.TABLEUPDATED;
updateInvocation();
}
public void operationFailed(Throwable caught, String reason,
String failureDetails) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
ok.setVisible(true); ok.setVisible(true);
this.trId=trId; this.trId = null;
why=ChangeTableWhy.TABLECURATION; UtilsGXT3.alert("Error Changing The Table Type", reason);
} }
}
@Override public void updateInvocation() {
public void operationGeneratingView() { if (trId != null) {
// TODO Auto-generated method stub ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.CHANGETABLETYPE, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
} }
hide();
}
@Override @Override
public void operationValidate(float elaborated) { public void operationStopped(TRId trId, String reason, String details) {
// TODO Auto-generated method stub Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason
+ ", " + details + "]");
} ok.setVisible(true);
this.trId = trId;
why = ChangeTableWhy.TABLECURATION;
}
@Override
public void operationGeneratingView() {
// TODO Auto-generated method stub
}
@Override
public void operationValidate(float elaborated) {
// TODO Auto-generated method stub
}
} }

View File

@ -1,10 +1,13 @@
package org.gcube.portlets.user.td.tablewidget.client.progress; package org.gcube.portlets.user.td.tablewidget.client.progress;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsSession;
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.client.event.ChangeTableRequestEvent; 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.ChangeTableRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; 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.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -19,126 +22,131 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.Verti
import com.sencha.gxt.widget.core.client.event.SelectEvent; 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.event.SelectEvent.SelectHandler;
/** /**
* LabelColumnProgressDialog is a Dialog that show progress of change the column label * LabelColumnProgressDialog is a Dialog that show progress of change the column
* label
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/ */
public class DeleteRowsProgressDialog extends Window implements DeleteRowsProgressListener { public class DeleteRowsProgressDialog extends Window implements
public static final int STATUS_POLLING_DELAY = 1000; DeleteRowsProgressListener {
protected String WIDTH = "400px"; public static final int STATUS_POLLING_DELAY = 1000;
protected String HEIGHT = "120px"; protected String WIDTH = "400px";
protected DeleteRowsSession deleteRowsSession; protected String HEIGHT = "120px";
protected EventBus eventBus; protected DeleteRowsSession deleteRowsSession;
protected DeleteRowsProgressUpdater progressUpdater; protected EventBus eventBus;
protected TextButton ok; protected DeleteRowsProgressUpdater progressUpdater;
protected TRId trId; protected TextButton ok;
private ChangeTableWhy why; protected TRId trId;
private ChangeTableWhy why;
public DeleteRowsProgressDialog(DeleteRowsSession deleteRowsSession, EventBus eventBus) {
this.deleteRowsSession=deleteRowsSession;
this.eventBus=eventBus;
setWidth(WIDTH);
setHeight(HEIGHT);
setBodyBorder(false);
setResizable(true);
setModal(true);
setHeadingText("Delete Rows Progress");
trId=null;
FramedPanel panel=new FramedPanel();
panel.setHeaderVisible(false);
panel.setBodyBorder(false);
VerticalLayoutContainer v = new VerticalLayoutContainer();
ProgressBar progressBar = new ProgressBar();
ok=new TextButton("OK");
ok.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
updateInvocation();
}
});
v.add(progressBar, new VerticalLayoutData(1,
1, new Margins(5, 5, 5, 5)));
panel.add(v);
panel.addButton(ok);
add(panel);
progressUpdater = new DeleteRowsProgressUpdater();
progressUpdater.addListener(new DeleteRowsProgressBarUpdater(progressBar));
progressUpdater.addListener(this); public DeleteRowsProgressDialog(DeleteRowsSession deleteRowsSession,
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); EventBus eventBus) {
show(); this.deleteRowsSession = deleteRowsSession;
ok.setVisible(false); this.eventBus = eventBus;
setWidth(WIDTH);
} setHeight(HEIGHT);
setBodyBorder(false);
setResizable(true);
setModal(true);
setHeadingText("Delete Rows Progress");
public void operationInitializing() { trId = null;
// TODO Auto-generated method stub
}
public void operationUpdate(float elaborated) { FramedPanel panel = new FramedPanel();
// TODO Auto-generated method stub panel.setHeaderVisible(false);
panel.setBodyBorder(false);
}
public void operationComplete(TRId trId) { VerticalLayoutContainer v = new VerticalLayoutContainer();
Log.debug("Operation Complete return: "+trId.toString());
this.trId=trId; ProgressBar progressBar = new ProgressBar();
why=ChangeTableWhy.TABLEUPDATED;
updateInvocation(); ok = new TextButton("OK");
ok.addSelectHandler(new SelectHandler() {
}
public void onSelect(SelectEvent event) {
updateInvocation();
public void operationFailed(Throwable caught, String reason,
String failureDetails) {
ok.setVisible(true);
this.trId=null;
UtilsGXT3.alert("Error Deleting Rows", reason);
}
public void updateInvocation(){
if(trId!=null){
ChangeTableRequestEvent changeTableRequestEvent=
new ChangeTableRequestEvent(ChangeTableRequestType.DELETEROWS, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
} }
hide(); });
}
@Override v.add(progressBar,
public void operationStopped(TRId trId,String reason, String details) { new VerticalLayoutData(1, 1, new Margins(5, 5, 5, 5)));
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]");
panel.add(v);
panel.addButton(ok);
add(panel);
progressUpdater = new DeleteRowsProgressUpdater();
progressUpdater.addListener(new DeleteRowsProgressBarUpdater(
progressBar));
progressUpdater.addListener(this);
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
show();
ok.setVisible(false);
}
public void operationInitializing() {
// TODO Auto-generated method stub
}
public void operationUpdate(float elaborated) {
// TODO Auto-generated method stub
}
public void operationComplete(TRId trId) {
Log.debug("Operation Complete return: " + trId.toString());
this.trId = trId;
why = ChangeTableWhy.TABLEUPDATED;
updateInvocation();
}
public void operationFailed(Throwable caught, String reason,
String failureDetails) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
ok.setVisible(true); ok.setVisible(true);
this.trId=trId; this.trId = null;
why=ChangeTableWhy.TABLECURATION; UtilsGXT3.alert("Error Deleting Rows", reason);
} }
}
@Override public void updateInvocation() {
public void operationGeneratingView() { if (trId != null) {
// TODO Auto-generated method stub ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.DELETEROWS, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
} }
hide();
}
@Override @Override
public void operationValidate(float elaborated) { public void operationStopped(TRId trId, String reason, String details) {
// TODO Auto-generated method stub Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason
+ ", " + details + "]");
} ok.setVisible(true);
this.trId = trId;
why = ChangeTableWhy.TABLECURATION;
}
@Override
public void operationGeneratingView() {
// TODO Auto-generated method stub
}
@Override
public void operationValidate(float elaborated) {
// TODO Auto-generated method stub
}
} }

View File

@ -1,10 +1,13 @@
package org.gcube.portlets.user.td.tablewidget.client.progress; package org.gcube.portlets.user.td.tablewidget.client.progress;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession;
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.client.event.ChangeTableRequestEvent; 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.ChangeTableRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; 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.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -19,124 +22,130 @@ import com.sencha.gxt.widget.core.client.container.VerticalLayoutContainer.Verti
import com.sencha.gxt.widget.core.client.event.SelectEvent; 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.event.SelectEvent.SelectHandler;
/** /**
* LabelColumnProgressDialog is a Dialog that show progress of change the column label * LabelColumnProgressDialog is a Dialog that show progress of change the column
* label
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
* *
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/ */
public class DuplicatesRowsProgressDialog extends Window implements DuplicatesRowsProgressListener { public class DuplicatesRowsProgressDialog extends Window implements
public static final int STATUS_POLLING_DELAY = 1000; DuplicatesRowsProgressListener {
protected String WIDTH = "400px"; public static final int STATUS_POLLING_DELAY = 1000;
protected String HEIGHT = "120px"; protected String WIDTH = "400px";
protected DuplicatesSession duplicatesSession; protected String HEIGHT = "120px";
protected EventBus eventBus; protected DuplicatesSession duplicatesSession;
protected DuplicatesRowsProgressUpdater progressUpdater; protected EventBus eventBus;
protected TextButton ok; protected DuplicatesRowsProgressUpdater progressUpdater;
protected TRId trId; protected TextButton ok;
private ChangeTableWhy why; protected TRId trId;
private ChangeTableWhy why;
public DuplicatesRowsProgressDialog(DuplicatesSession duplicatesSession, EventBus eventBus) {
this.duplicatesSession=duplicatesSession;
this.eventBus=eventBus;
setWidth(WIDTH);
setHeight(HEIGHT);
setBodyBorder(false);
setResizable(true);
setModal(true);
setHeadingText("Duplicates Rows Progress");
trId=null;
FramedPanel panel=new FramedPanel();
panel.setHeaderVisible(false);
panel.setBodyBorder(false);
VerticalLayoutContainer v = new VerticalLayoutContainer();
ProgressBar progressBar = new ProgressBar();
ok=new TextButton("OK");
ok.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
updateInvocation();
}
});
v.add(progressBar, new VerticalLayoutData(1,
1, new Margins(5, 5, 5, 5)));
panel.add(v);
panel.addButton(ok);
add(panel);
progressUpdater = new DuplicatesRowsProgressUpdater();
progressUpdater.addListener(new DuplicatesRowsProgressBarUpdater(progressBar));
progressUpdater.addListener(this); public DuplicatesRowsProgressDialog(DuplicatesSession duplicatesSession,
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); EventBus eventBus) {
show(); this.duplicatesSession = duplicatesSession;
ok.setVisible(false); this.eventBus = eventBus;
setWidth(WIDTH);
} setHeight(HEIGHT);
setBodyBorder(false);
setResizable(true);
setModal(true);
setHeadingText("Duplicates Rows Progress");
public void operationInitializing() { trId = null;
// TODO Auto-generated method stub
}
public void operationUpdate(float elaborated) { FramedPanel panel = new FramedPanel();
// TODO Auto-generated method stub panel.setHeaderVisible(false);
panel.setBodyBorder(false);
}
public void operationComplete(TRId trId) { VerticalLayoutContainer v = new VerticalLayoutContainer();
Log.debug("Operation Complete return: "+trId.toString());
this.trId=trId;
why=ChangeTableWhy.TABLEUPDATED;
updateInvocation();
}
public void operationFailed(Throwable caught, String reason, ProgressBar progressBar = new ProgressBar();
String failureDetails) {
ok = new TextButton("OK");
ok.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
updateInvocation();
}
});
v.add(progressBar,
new VerticalLayoutData(1, 1, new Margins(5, 5, 5, 5)));
panel.add(v);
panel.addButton(ok);
add(panel);
progressUpdater = new DuplicatesRowsProgressUpdater();
progressUpdater.addListener(new DuplicatesRowsProgressBarUpdater(
progressBar));
progressUpdater.addListener(this);
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
show();
ok.setVisible(false);
}
public void operationInitializing() {
// TODO Auto-generated method stub
}
public void operationUpdate(float elaborated) {
// TODO Auto-generated method stub
}
public void operationComplete(TRId trId) {
Log.debug("Operation Complete return: " + trId.toString());
this.trId = trId;
why = ChangeTableWhy.TABLEUPDATED;
updateInvocation();
}
public void operationFailed(Throwable caught, String reason,
String failureDetails) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
ok.setVisible(true); ok.setVisible(true);
this.trId=null; this.trId = null;
UtilsGXT3.alert("Error Deleting Rows", reason); UtilsGXT3.alert("Error Deleting Rows", reason);
} }
}
public void updateInvocation(){
if(trId!=null){
ChangeTableRequestEvent changeTableRequestEvent=
new ChangeTableRequestEvent(ChangeTableRequestType.DUPLICATES, trId,why);
eventBus.fireEvent(changeTableRequestEvent);
}
hide();
}
@Override public void updateInvocation() {
public void operationStopped(TRId trId,String reason, String details) { if (trId != null) {
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]"); ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ok.setVisible(true); ChangeTableRequestType.DUPLICATES, trId, why);
this.trId=trId; eventBus.fireEvent(changeTableRequestEvent);
why=ChangeTableWhy.TABLECURATION;
} }
hide();
}
@Override @Override
public void operationGeneratingView() { public void operationStopped(TRId trId, String reason, String details) {
// TODO Auto-generated method stub Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason
+ ", " + details + "]");
} ok.setVisible(true);
this.trId = trId;
why = ChangeTableWhy.TABLECURATION;
}
@Override @Override
public void operationValidate(float elaborated) { public void operationGeneratingView() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
@Override
public void operationValidate(float elaborated) {
// TODO Auto-generated method stub
}
} }

View File

@ -1,10 +1,13 @@
package org.gcube.portlets.user.td.tablewidget.client.progress; package org.gcube.portlets.user.td.tablewidget.client.progress;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.tablewidget.client.rows.EditRowPanel; import org.gcube.portlets.user.td.tablewidget.client.rows.EditRowPanel;
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.client.event.ChangeTableRequestEvent; 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.ChangeTableRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; 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.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -20,123 +23,127 @@ 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.event.SelectEvent.SelectHandler;
/** /**
*
* *
* @author "Giancarlo Panichi" *
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * @author "Giancarlo Panichi" <a
* * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/ */
public class EditRowProgressDialog extends Window implements EditRowProgressListener { public class EditRowProgressDialog extends Window implements
public static final int STATUS_POLLING_DELAY = 1000; EditRowProgressListener {
protected String WIDTH = "400px"; public static final int STATUS_POLLING_DELAY = 1000;
protected String HEIGHT = "120px"; protected String WIDTH = "400px";
protected EditRowPanel parent; protected String HEIGHT = "120px";
protected EventBus eventBus; protected EditRowPanel parent;
protected EditRowProgressUpdater progressUpdater; protected EventBus eventBus;
protected TextButton ok; protected EditRowProgressUpdater progressUpdater;
protected TRId trId; protected TextButton ok;
private ChangeTableWhy why; protected TRId trId;
private ChangeTableWhy why;
public EditRowProgressDialog(EditRowPanel editRowPanel, EventBus eventBus) {
this.parent=editRowPanel;
this.eventBus=eventBus;
setWidth(WIDTH);
setHeight(HEIGHT);
setBodyBorder(false);
setResizable(true);
setModal(true);
setHeadingText("Rollback Progress");
trId=null;
FramedPanel panel=new FramedPanel();
panel.setHeaderVisible(false);
panel.setBodyBorder(false);
VerticalLayoutContainer v = new VerticalLayoutContainer();
ProgressBar progressBar = new ProgressBar();
ok=new TextButton("OK");
ok.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
updateInvocation();
}
});
v.add(progressBar, new VerticalLayoutData(1,
1, new Margins(5, 5, 5, 5)));
panel.add(v);
panel.addButton(ok);
add(panel);
progressUpdater = new EditRowProgressUpdater();
progressUpdater.addListener(new EditRowProgressBarUpdater(progressBar));
progressUpdater.addListener(this); public EditRowProgressDialog(EditRowPanel editRowPanel, EventBus eventBus) {
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); this.parent = editRowPanel;
show(); this.eventBus = eventBus;
ok.setVisible(false); setWidth(WIDTH);
setHeight(HEIGHT);
} setBodyBorder(false);
setResizable(true);
setModal(true);
setHeadingText("Rollback Progress");
public void operationInitializing() { trId = null;
// TODO Auto-generated method stub
}
public void operationUpdate(float elaborated) { FramedPanel panel = new FramedPanel();
// TODO Auto-generated method stub panel.setHeaderVisible(false);
panel.setBodyBorder(false);
}
public void operationComplete(TRId trId) { VerticalLayoutContainer v = new VerticalLayoutContainer();
Log.debug("Operation Complete return: "+trId.toString());
this.trId=trId; ProgressBar progressBar = new ProgressBar();
why=ChangeTableWhy.TABLEUPDATED;
updateInvocation(); ok = new TextButton("OK");
} ok.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
updateInvocation();
public void operationFailed(Throwable caught, String reason,
String failureDetails) {
ok.setVisible(true);
this.trId=null;
UtilsGXT3.alert("Error", reason);
}
public void updateInvocation(){
if(trId!=null){
ChangeTableRequestEvent changeTableRequestEvent=
new ChangeTableRequestEvent(ChangeTableRequestType.EDITROW, trId,why);
eventBus.fireEvent(changeTableRequestEvent);
} }
parent.close(); });
hide();
}
@Override v.add(progressBar,
public void operationStopped(TRId trId,String reason, String details) { new VerticalLayoutData(1, 1, new Margins(5, 5, 5, 5)));
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]");
panel.add(v);
panel.addButton(ok);
add(panel);
progressUpdater = new EditRowProgressUpdater();
progressUpdater.addListener(new EditRowProgressBarUpdater(progressBar));
progressUpdater.addListener(this);
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
show();
ok.setVisible(false);
}
public void operationInitializing() {
// TODO Auto-generated method stub
}
public void operationUpdate(float elaborated) {
// TODO Auto-generated method stub
}
public void operationComplete(TRId trId) {
Log.debug("Operation Complete return: " + trId.toString());
this.trId = trId;
why = ChangeTableWhy.TABLEUPDATED;
updateInvocation();
}
public void operationFailed(Throwable caught, String reason,
String failureDetails) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
ok.setVisible(true); ok.setVisible(true);
this.trId=trId; this.trId = null;
why=ChangeTableWhy.TABLECURATION; UtilsGXT3.alert("Error", reason);
} }
}
@Override public void updateInvocation() {
public void operationGeneratingView() { if (trId != null) {
// TODO Auto-generated method stub ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.EDITROW, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
} }
parent.close();
hide();
}
@Override @Override
public void operationValidate(float elaborated) { public void operationStopped(TRId trId, String reason, String details) {
// TODO Auto-generated method stub Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason
+ ", " + details + "]");
} ok.setVisible(true);
this.trId = trId;
why = ChangeTableWhy.TABLECURATION;
}
@Override
public void operationGeneratingView() {
// TODO Auto-generated method stub
}
@Override
public void operationValidate(float elaborated) {
// TODO Auto-generated method stub
}
} }

View File

@ -1,10 +1,13 @@
package org.gcube.portlets.user.td.tablewidget.client.progress; package org.gcube.portlets.user.td.tablewidget.client.progress;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession; import org.gcube.portlets.user.td.gwtservice.shared.history.RollBackSession;
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.client.event.ChangeTableRequestEvent; 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.ChangeTableRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.ChangeTableWhy; 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.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -20,122 +23,128 @@ 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.event.SelectEvent.SelectHandler;
/** /**
*
* *
* @author "Giancarlo Panichi" *
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> * @author "Giancarlo Panichi" <a
* * href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/ */
public class RollBackProgressDialog extends Window implements RollBackProgressListener { public class RollBackProgressDialog extends Window implements
public static final int STATUS_POLLING_DELAY = 1000; RollBackProgressListener {
protected String WIDTH = "400px"; public static final int STATUS_POLLING_DELAY = 1000;
protected String HEIGHT = "120px"; protected String WIDTH = "400px";
protected RollBackSession rollBackSession; protected String HEIGHT = "120px";
protected EventBus eventBus; protected RollBackSession rollBackSession;
protected RollBackProgressUpdater progressUpdater; protected EventBus eventBus;
protected TextButton ok; protected RollBackProgressUpdater progressUpdater;
protected TRId trId; protected TextButton ok;
private ChangeTableWhy why; protected TRId trId;
private ChangeTableWhy why;
public RollBackProgressDialog(RollBackSession rollBackSession, EventBus eventBus) {
this.rollBackSession=rollBackSession;
this.eventBus=eventBus;
setWidth(WIDTH);
setHeight(HEIGHT);
setBodyBorder(false);
setResizable(true);
setModal(true);
setHeadingText("Rollback Progress");
trId=null;
FramedPanel panel=new FramedPanel();
panel.setHeaderVisible(false);
panel.setBodyBorder(false);
VerticalLayoutContainer v = new VerticalLayoutContainer();
ProgressBar progressBar = new ProgressBar();
ok=new TextButton("OK");
ok.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
updateInvocation();
}
});
v.add(progressBar, new VerticalLayoutData(1,
1, new Margins(5, 5, 5, 5)));
panel.add(v);
panel.addButton(ok);
add(panel);
progressUpdater = new RollBackProgressUpdater();
progressUpdater.addListener(new RollBackProgressBarUpdater(progressBar));
progressUpdater.addListener(this); public RollBackProgressDialog(RollBackSession rollBackSession,
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY); EventBus eventBus) {
show(); this.rollBackSession = rollBackSession;
ok.setVisible(false); this.eventBus = eventBus;
setWidth(WIDTH);
} setHeight(HEIGHT);
setBodyBorder(false);
setResizable(true);
setModal(true);
setHeadingText("Rollback Progress");
public void operationInitializing() { trId = null;
// TODO Auto-generated method stub
}
public void operationUpdate(float elaborated) { FramedPanel panel = new FramedPanel();
// TODO Auto-generated method stub panel.setHeaderVisible(false);
panel.setBodyBorder(false);
}
public void operationComplete(TRId trId) { VerticalLayoutContainer v = new VerticalLayoutContainer();
Log.debug("Operation Complete return: "+trId.toString());
this.trId=trId; ProgressBar progressBar = new ProgressBar();
why=ChangeTableWhy.TABLEUPDATED;
updateInvocation(); ok = new TextButton("OK");
} ok.addSelectHandler(new SelectHandler() {
public void onSelect(SelectEvent event) {
updateInvocation();
public void operationFailed(Throwable caught, String reason,
String failureDetails) {
ok.setVisible(true);
this.trId=null;
UtilsGXT3.alert("Error in RollBack", reason);
}
public void updateInvocation(){
if(trId!=null){
ChangeTableRequestEvent changeTableRequestEvent=
new ChangeTableRequestEvent(ChangeTableRequestType.DELETEROWS, trId,why);
eventBus.fireEvent(changeTableRequestEvent);
} }
hide(); });
}
@Override v.add(progressBar,
public void operationStopped(TRId trId,String reason, String details) { new VerticalLayoutData(1, 1, new Margins(5, 5, 5, 5)));
Log.debug("Operation Stopped: ["+trId.toString()+", "+reason+", "+details+"]");
panel.add(v);
panel.addButton(ok);
add(panel);
progressUpdater = new RollBackProgressUpdater();
progressUpdater
.addListener(new RollBackProgressBarUpdater(progressBar));
progressUpdater.addListener(this);
progressUpdater.scheduleRepeating(STATUS_POLLING_DELAY);
show();
ok.setVisible(false);
}
public void operationInitializing() {
// TODO Auto-generated method stub
}
public void operationUpdate(float elaborated) {
// TODO Auto-generated method stub
}
public void operationComplete(TRId trId) {
Log.debug("Operation Complete return: " + trId.toString());
this.trId = trId;
why = ChangeTableWhy.TABLEUPDATED;
updateInvocation();
}
public void operationFailed(Throwable caught, String reason,
String failureDetails) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
ok.setVisible(true); ok.setVisible(true);
this.trId=trId; this.trId = null;
why=ChangeTableWhy.TABLECURATION; UtilsGXT3.alert("Error in RollBack", reason);
} }
}
@Override public void updateInvocation() {
public void operationGeneratingView() { if (trId != null) {
// TODO Auto-generated method stub ChangeTableRequestEvent changeTableRequestEvent = new ChangeTableRequestEvent(
ChangeTableRequestType.DELETEROWS, trId, why);
eventBus.fireEvent(changeTableRequestEvent);
} }
hide();
}
@Override @Override
public void operationValidate(float elaborated) { public void operationStopped(TRId trId, String reason, String details) {
// TODO Auto-generated method stub Log.debug("Operation Stopped: [" + trId.toString() + ", " + reason
+ ", " + details + "]");
} ok.setVisible(true);
this.trId = trId;
why = ChangeTableWhy.TABLECURATION;
}
@Override
public void operationGeneratingView() {
// TODO Auto-generated method stub
}
@Override
public void operationValidate(float elaborated) {
// TODO Auto-generated method stub
}
} }

View File

@ -3,9 +3,12 @@ package org.gcube.portlets.user.td.tablewidget.client.rows;
import java.util.ArrayList; import java.util.ArrayList;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DeleteRowsSession;
import org.gcube.portlets.user.td.tablewidget.client.progress.DeleteRowsProgressDialog; import org.gcube.portlets.user.td.tablewidget.client.progress.DeleteRowsProgressDialog;
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.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -16,46 +19,50 @@ import com.google.web.bindery.event.shared.EventBus;
* Delete rows in table * Delete rows in table
* *
* @author "Giancarlo Panichi" * @author "Giancarlo Panichi"
* *
*/ */
public class DeleteRows { public class DeleteRows {
protected TRId trId; protected TRId trId;
protected EventBus eventBus; protected EventBus eventBus;
protected ArrayList<String> rows; protected ArrayList<String> rows;
protected DeleteRowsSession deleteRowsSession; protected DeleteRowsSession deleteRowsSession;
protected DeleteRowsProgressDialog deleteRowsProgressDialog; protected DeleteRowsProgressDialog deleteRowsProgressDialog;
public DeleteRows(TRId trId, ArrayList<String> rows,EventBus eventBus) { public DeleteRows(TRId trId, ArrayList<String> rows, EventBus eventBus) {
this.trId = trId; this.trId = trId;
this.rows=rows; this.rows = rows;
this.eventBus = eventBus; this.eventBus = eventBus;
} }
public void delete(){ public void delete() {
deleteRowsSession =new DeleteRowsSession(trId, rows); deleteRowsSession = new DeleteRowsSession(trId, rows);
onDelete(); onDelete();
} }
protected void onDelete(){
TDGWTServiceAsync.INSTANCE.startDeleteRows(
deleteRowsSession, new AsyncCallback<Void>() {
public void onFailure(Throwable caught) { protected void onDelete() {
TDGWTServiceAsync.INSTANCE.startDeleteRows(deleteRowsSession,
new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.debug("Delete Rows Error: " Log.debug("Delete Rows Error: "
+ caught.getLocalizedMessage()); + caught.getLocalizedMessage());
UtilsGXT3.alert("Error Deleting Rows", UtilsGXT3
"Error in invocation Delete Rows operation!"); .alert("Error Deleting Rows",
"Error in invocation Delete Rows operation!");
} }
}
public void onSuccess(Void result) { public void onSuccess(Void result) {
deleteRowsProgressDialog= new DeleteRowsProgressDialog(deleteRowsSession, eventBus); deleteRowsProgressDialog = new DeleteRowsProgressDialog(
} deleteRowsSession, eventBus);
}
}); });
} }
} }

View File

@ -4,11 +4,14 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
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.ColumnData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession; import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.DuplicatesSession;
import org.gcube.portlets.user.td.tablewidget.client.progress.DuplicatesRowsProgressDialog; import org.gcube.portlets.user.td.tablewidget.client.progress.DuplicatesRowsProgressDialog;
import org.gcube.portlets.user.td.tablewidget.client.properties.ColumnDataProperties; import org.gcube.portlets.user.td.tablewidget.client.properties.ColumnDataProperties;
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.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -115,16 +118,16 @@ public class DuplicatesRowsPanel extends FramedPanel {
sm.setSelectionMode(SelectionMode.MULTI); sm.setSelectionMode(SelectionMode.MULTI);
grid.setLoader(loader); grid.setLoader(loader);
grid.setSelectionModel(sm); grid.setSelectionModel(sm);
//grid.getView().setAutoExpandColumn(labelCol); // grid.getView().setAutoExpandColumn(labelCol);
grid.setHeight(360); grid.setHeight(360);
grid.getView().setStripeRows(true); grid.getView().setStripeRows(true);
grid.getView().setColumnLines(true); grid.getView().setColumnLines(true);
grid.getView().setAutoFill(true); grid.getView().setAutoFill(true);
grid.setBorders(false); grid.setBorders(false);
grid.setLoadMask(true); grid.setLoadMask(true);
grid.setColumnReordering(true); grid.setColumnReordering(true);
grid.setColumnResize(false); grid.setColumnResize(false);
// Delete Button // Delete Button
deleteButton = new TextButton("Delete"); deleteButton = new TextButton("Delete");
SelectHandler deleteHandler = new SelectHandler() { SelectHandler deleteHandler = new SelectHandler() {
@ -146,21 +149,19 @@ public class DuplicatesRowsPanel extends FramedPanel {
} }
}; };
validatesButton.addSelectHandler(validatesHandler); validatesButton.addSelectHandler(validatesHandler);
FieldLabel columnsLabel = new FieldLabel(null, "Columns"); FieldLabel columnsLabel = new FieldLabel(null, "Columns");
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))); hBox.add(deleteButton, new BoxLayoutData(new Margins(2, 5, 2, 5)));
VerticalLayoutContainer v = new VerticalLayoutContainer(); VerticalLayoutContainer v = new VerticalLayoutContainer();
v.setScrollMode(ScrollMode.AUTO); v.setScrollMode(ScrollMode.AUTO);
v.add(columnsLabel, new VerticalLayoutData(-1, -1, new Margins(2,1,5,1))); 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(grid, new VerticalLayoutData(1, -1, new Margins(0)));
v.add(hBox, new VerticalLayoutData(-1, -1, new Margins(10, 0, v.add(hBox, new VerticalLayoutData(-1, -1, new Margins(10, 0, 10, 0)));
10, 0)));
add(v, new VerticalLayoutData(-1, -1, new Margins(0))); add(v, new VerticalLayoutData(-1, -1, new Margins(0)));
} }
@ -182,10 +183,15 @@ public class DuplicatesRowsPanel extends FramedPanel {
new AsyncCallback<ArrayList<ColumnData>>() { new AsyncCallback<ArrayList<ColumnData>>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("load columns failure:" if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error retrieving columns", SessionExpiredType.EXPIREDONSERVER));
"Error retrieving columns"); } else {
Log.error("load columns failure:"
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving columns",
"Error retrieving columns");
}
callback.onFailure(caught); callback.onFailure(caught);
} }
@ -201,10 +207,9 @@ public class DuplicatesRowsPanel extends FramedPanel {
} }
protected void onDeleteDuplicate() { protected void onDeleteDuplicate() {
ArrayList<ColumnData> col=getSelectedItems(); ArrayList<ColumnData> col = getSelectedItems();
if(col==null||col.size()<1){ if (col == null || col.size() < 1) {
UtilsGXT3.alert("Attention", UtilsGXT3.alert("Attention", "Attention no column selected!");
"Attention no column selected!");
return; return;
} }
duplicatesSession = new DuplicatesSession(trId, col, duplicatesSession = new DuplicatesSession(trId, col,
@ -214,11 +219,16 @@ public class DuplicatesRowsPanel extends FramedPanel {
new AsyncCallback<Void>() { new AsyncCallback<Void>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.debug("Delete Duplicates Error: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error Deleting Rows", SessionExpiredType.EXPIREDONSERVER));
"Error in invocation Delete Duplicates operation!"); } else {
Log.debug("Delete Duplicates Error: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error Deleting Rows",
"Error in invocation Delete Duplicates operation!");
}
} }
public void onSuccess(Void result) { public void onSuccess(Void result) {
@ -229,13 +239,11 @@ public class DuplicatesRowsPanel extends FramedPanel {
}); });
} }
protected void onValidatesDuplicate() { protected void onValidatesDuplicate() {
ArrayList<ColumnData> col=getSelectedItems(); ArrayList<ColumnData> col = getSelectedItems();
if(col==null||col.size()<1){ if (col == null || col.size() < 1) {
UtilsGXT3.alert("Attention", UtilsGXT3.alert("Attention", "Attention no column selected!");
"Attention no column selected!");
return; return;
} }
duplicatesSession = new DuplicatesSession(trId, col, duplicatesSession = new DuplicatesSession(trId, col,
@ -245,11 +253,16 @@ public class DuplicatesRowsPanel extends FramedPanel {
new AsyncCallback<Void>() { new AsyncCallback<Void>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.debug("Validates Duplicates Error: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error Deleting Rows", SessionExpiredType.EXPIREDONSERVER));
"Error in invocation Validates Duplicates operation!"); } else {
Log.debug("Validates Duplicates Error: "
+ caught.getLocalizedMessage());
UtilsGXT3
.alert("Error Deleting Rows",
"Error in invocation Validates Duplicates operation!");
}
} }
public void onSuccess(Void result) { public void onSuccess(Void result) {
@ -260,8 +273,5 @@ public class DuplicatesRowsPanel extends FramedPanel {
}); });
} }
} }

View File

@ -15,6 +15,8 @@ import org.gcube.portlets.user.td.gwtservice.shared.tr.rows.EditRowSession;
import org.gcube.portlets.user.td.tablewidget.client.progress.EditRowProgressDialog; import org.gcube.portlets.user.td.tablewidget.client.progress.EditRowProgressDialog;
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.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.CellData; import org.gcube.portlets.user.td.widgetcommonevent.shared.CellData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.grid.model.RowRaw; import org.gcube.portlets.user.td.widgetcommonevent.shared.grid.model.RowRaw;
@ -72,9 +74,9 @@ public class EditRowPanel extends FramedPanel {
protected ArrayList<ColumnData> columns; protected ArrayList<ColumnData> columns;
protected RowRaw rowRaw; protected RowRaw rowRaw;
protected boolean editRow; protected boolean editRow;
protected EditRowProgressDialog editRowProgressDialog; protected EditRowProgressDialog editRowProgressDialog;
protected VerticalLayoutContainer v; protected VerticalLayoutContainer v;
private TextButton btnSave; private TextButton btnSave;
private TextButton btnClose; private TextButton btnClose;
@ -195,11 +197,15 @@ public class EditRowPanel extends FramedPanel {
new AsyncCallback<ArrayList<ColumnData>>() { new AsyncCallback<ArrayList<ColumnData>>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("load columns failure:" if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error retrieving columns", SessionExpiredType.EXPIREDONSERVER));
"Error retrieving columns"); } else {
Log.error("load columns failure:"
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error retrieving columns",
"Error retrieving columns");
}
} }
public void onSuccess(ArrayList<ColumnData> result) { public void onSuccess(ArrayList<ColumnData> result) {
@ -587,33 +593,31 @@ public class EditRowPanel extends FramedPanel {
parent.close(); parent.close();
} }
} }
protected void callEditRow(EditRowSession editRowSession) { protected void callEditRow(EditRowSession editRowSession) {
final EditRowPanel panel=this; final EditRowPanel panel = this;
TDGWTServiceAsync.INSTANCE.startEditRow(editRowSession,new AsyncCallback<Void>() {
public void onFailure(Throwable caught) { TDGWTServiceAsync.INSTANCE.startEditRow(editRowSession,
Log.debug("EditRow: " new AsyncCallback<Void>() {
+ caught.getLocalizedMessage());
if(caught instanceof TDGWTSessionExpiredException){
UtilsGXT3.alert("Attention",caught.getLocalizedMessage());
} else {
UtilsGXT3.alert("Error",
"Error in operation invocation!");
}
}
public void onSuccess(Void result) { public void onFailure(Throwable caught) {
editRowProgressDialog = new EditRowProgressDialog( Log.debug("EditRow: " + caught.getLocalizedMessage());
panel, eventBus); if (caught instanceof TDGWTSessionExpiredException) {
} eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
UtilsGXT3.alert("Error",
"Error in operation invocation!");
}
}
public void onSuccess(Void result) {
editRowProgressDialog = new EditRowProgressDialog(
panel, eventBus);
}
});
});
} }
} }

View File

@ -4,12 +4,15 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData; import org.gcube.portlets.user.td.gwtservice.shared.tr.TableData;
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.Validations; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.Validations;
import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabValidationsMetadata; import org.gcube.portlets.user.td.gwtservice.shared.tr.table.metadata.TabValidationsMetadata;
import org.gcube.portlets.user.td.tablewidget.client.properties.ValidationsProperties; import org.gcube.portlets.user.td.tablewidget.client.properties.ValidationsProperties;
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.client.event.SessionExpiredEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -54,16 +57,15 @@ public class ValidationsTablePanel extends FramedPanel {
protected ListLoader<ListLoadConfig, ListLoadResult<Validations>> loader; protected ListLoader<ListLoadConfig, ListLoadResult<Validations>> loader;
protected Grid<Validations> grid; protected Grid<Validations> grid;
private boolean drawed; private boolean drawed;
public ValidationsTablePanel(EventBus eventBus) { public ValidationsTablePanel(EventBus eventBus) {
super(); super();
this.eventBus = eventBus; this.eventBus = eventBus;
forceLayoutOnResize = true; forceLayoutOnResize = true;
retrieveCurrentTR(); retrieveCurrentTR();
} }
public ValidationsTablePanel(TRId trId, EventBus eventBus) { public ValidationsTablePanel(TRId trId, EventBus eventBus) {
super(); super();
this.trId = trId; this.trId = trId;
@ -77,7 +79,7 @@ public class ValidationsTablePanel extends FramedPanel {
init(); init();
create(); create();
} }
protected void init() { protected void init() {
setWidth(WIDTH); setWidth(WIDTH);
setHeight(HEIGHT); setHeight(HEIGHT);
@ -90,19 +92,18 @@ public class ValidationsTablePanel extends FramedPanel {
ColumnConfig<Validations, String> descriptionCol = new ColumnConfig<Validations, String>( ColumnConfig<Validations, String> descriptionCol = new ColumnConfig<Validations, String>(
props.description(), 168, "Description"); props.description(), 168, "Description");
descriptionCol.setCell(new AbstractCell<String>() { descriptionCol.setCell(new AbstractCell<String>() {
@Override @Override
public void render(Context context, String value, SafeHtmlBuilder sb) { public void render(Context context, String value, SafeHtmlBuilder sb) {
sb.appendHtmlConstant("<span title='"+value+"'>" sb.appendHtmlConstant("<span title='" + value + "'>" + value
+ value + "</span>"); + "</span>");
} }
}); });
ColumnConfig<Validations, Boolean> validCol = new ColumnConfig<Validations, Boolean>( ColumnConfig<Validations, Boolean> validCol = new ColumnConfig<Validations, Boolean>(
props.valid(), 28, "Valid"); props.valid(), 28, "Valid");
validCol.setCell(new AbstractCell<Boolean>() { validCol.setCell(new AbstractCell<Boolean>() {
@ -176,7 +177,6 @@ public class ValidationsTablePanel extends FramedPanel {
grid.getView().setAutoExpandColumn(descriptionCol); grid.getView().setAutoExpandColumn(descriptionCol);
grid.getView().setEmptyText("No validation"); grid.getView().setEmptyText("No validation");
add(grid, new MarginData(0)); add(grid, new MarginData(0));
onResize(); onResize();
@ -190,11 +190,16 @@ public class ValidationsTablePanel extends FramedPanel {
new AsyncCallback<TabValidationsMetadata>() { new AsyncCallback<TabValidationsMetadata>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Load validations metadata failure: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert( SessionExpiredType.EXPIREDONSERVER));
"Error retrieving validations metadata", } else {
"Error retrieving validations metadata"); Log.error("Load validations metadata failure: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert(
"Error retrieving validations metadata",
"Error retrieving validations metadata");
}
callback.onFailure(caught); callback.onFailure(caught);
} }
@ -218,28 +223,29 @@ public class ValidationsTablePanel extends FramedPanel {
} }
public void update() { public void update() {
retrieveCurrentTR(); retrieveCurrentTR();
loader.load(); loader.load();
} }
public void update(TRId trId) { public void update(TRId trId) {
this.trId=trId; this.trId = trId;
loader.load(); loader.load();
} }
protected void retrieveCurrentTR() { protected void retrieveCurrentTR() {
TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback<TRId>() { TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback<TRId>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error retrieving current TRId: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error", SessionExpiredType.EXPIREDONSERVER));
"Error retrieving current tabular resource id"); } else {
Log.error("Error retrieving current TRId: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrieving current tabular resource id");
}
} }
public void onSuccess(TRId result) { public void onSuccess(TRId result) {
@ -253,6 +259,5 @@ public class ValidationsTablePanel extends FramedPanel {
}); });
} }
} }

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync;
import org.gcube.portlets.user.td.gwtservice.shared.exception.TDGWTSessionExpiredException;
import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsTasksMetadata; import org.gcube.portlets.user.td.gwtservice.shared.task.ValidationsTasksMetadata;
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;
@ -11,6 +12,8 @@ import org.gcube.portlets.user.td.tablewidget.client.validation.tree.BaseDto;
import org.gcube.portlets.user.td.tablewidget.client.validation.tree.FolderDto; import org.gcube.portlets.user.td.tablewidget.client.validation.tree.FolderDto;
import org.gcube.portlets.user.td.tablewidget.client.validation.tree.TreeDataGenerator; import org.gcube.portlets.user.td.tablewidget.client.validation.tree.TreeDataGenerator;
import org.gcube.portlets.user.td.tablewidget.client.validation.tree.ValidationDto; import org.gcube.portlets.user.td.tablewidget.client.validation.tree.ValidationDto;
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.widgetcommonevent.shared.TRId; import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import com.sencha.gxt.widget.core.client.event.CollapseItemEvent.CollapseItemHandler; import com.sencha.gxt.widget.core.client.event.CollapseItemEvent.CollapseItemHandler;
import com.allen_sauer.gwt.log.client.Log; import com.allen_sauer.gwt.log.client.Log;
@ -108,8 +111,8 @@ public class ValidationsTasksPanel extends FramedPanel {
protected void create() { protected void create() {
con = new VerticalLayoutContainer(); con = new VerticalLayoutContainer();
con.setScrollMode(ScrollMode.AUTO); con.setScrollMode(ScrollMode.AUTO);
//con.setAdjustForScroll(true); // con.setAdjustForScroll(true);
store = new TreeStore<BaseDto>(new KeyProvider()); store = new TreeStore<BaseDto>(new KeyProvider());
FolderDto root = gen.getRoot(); FolderDto root = gen.getRoot();
@ -149,7 +152,7 @@ public class ValidationsTasksPanel extends FramedPanel {
* @Override public String getPath() { return "description"; } }); * @Override public String getPath() { return "description"; } });
* cc2.setHeader("Description"); * cc2.setHeader("Description");
*/ */
ColumnConfig<BaseDto, Boolean> cc3 = new ColumnConfig<BaseDto, Boolean>( ColumnConfig<BaseDto, Boolean> cc3 = new ColumnConfig<BaseDto, Boolean>(
new ValueProvider<BaseDto, Boolean>() { new ValueProvider<BaseDto, Boolean>() {
@ -213,8 +216,7 @@ public class ValidationsTasksPanel extends FramedPanel {
tree.setLoadMask(true); tree.setLoadMask(true);
tree.setColumnResize(true); tree.setColumnResize(true);
tree.getView().setAutoExpandColumn(cc1); tree.getView().setAutoExpandColumn(cc1);
IconProvider<BaseDto> iconProvider = new IconProvider<BaseDto>() { IconProvider<BaseDto> iconProvider = new IconProvider<BaseDto>() {
@Override @Override
@ -238,26 +240,25 @@ public class ValidationsTasksPanel extends FramedPanel {
} }
}; };
tree.setIconProvider(iconProvider); tree.setIconProvider(iconProvider);
tree.addExpandHandler(new ExpandItemHandler<BaseDto>() { tree.addExpandHandler(new ExpandItemHandler<BaseDto>() {
@Override @Override
public void onExpand(ExpandItemEvent<BaseDto> event) { public void onExpand(ExpandItemEvent<BaseDto> event) {
forceLayout(); forceLayout();
} }
}); });
tree.addCollapseHandler(new CollapseItemHandler<BaseDto>() { tree.addCollapseHandler(new CollapseItemHandler<BaseDto>() {
@Override @Override
public void onCollapse(CollapseItemEvent<BaseDto> event) { public void onCollapse(CollapseItemEvent<BaseDto> event) {
forceLayout(); forceLayout();
} }
}); });
ToolBar toolBar = new ToolBar(); ToolBar toolBar = new ToolBar();
TextButton btnExpandAll = new TextButton(); TextButton btnExpandAll = new TextButton();
@ -273,8 +274,7 @@ public class ValidationsTasksPanel extends FramedPanel {
} }
}); });
toolBar.add(btnExpandAll); toolBar.add(btnExpandAll);
TextButton btnCollapseAll = new TextButton(); TextButton btnCollapseAll = new TextButton();
// btnReload.setText("Expand All"); // btnReload.setText("Expand All");
btnCollapseAll.setIcon(ResourceBundle.INSTANCE.expandAll12()); btnCollapseAll.setIcon(ResourceBundle.INSTANCE.expandAll12());
@ -288,16 +288,12 @@ public class ValidationsTasksPanel extends FramedPanel {
} }
}); });
toolBar.add(btnCollapseAll); toolBar.add(btnCollapseAll);
con.add(toolBar, new VerticalLayoutData(1, -1)); con.add(toolBar, new VerticalLayoutData(1, -1));
con.add(tree, new VerticalLayoutData(1, -1)); con.add(tree, new VerticalLayoutData(1, -1));
add(con,new MarginData(0)); add(con, new MarginData(0));
} }
protected void retrieveValidations() { protected void retrieveValidations() {
@ -306,12 +302,16 @@ public class ValidationsTasksPanel extends FramedPanel {
new AsyncCallback<ValidationsTasksMetadata>() { new AsyncCallback<ValidationsTasksMetadata>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Load validations metadata failure: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert( SessionExpiredType.EXPIREDONSERVER));
"Error retrieving validations metadata", } else {
"Error retrieving validations metadata"); Log.error("Load validations metadata failure: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert(
"Error retrieving validations metadata",
"Error retrieving validations metadata");
}
} }
public void onSuccess(ValidationsTasksMetadata result) { public void onSuccess(ValidationsTasksMetadata result) {
@ -338,11 +338,15 @@ public class ValidationsTasksPanel extends FramedPanel {
TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback<TRId>() { TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback<TRId>() {
public void onFailure(Throwable caught) { public void onFailure(Throwable caught) {
Log.error("Error retrieving current TRId: " if (caught instanceof TDGWTSessionExpiredException) {
+ caught.getLocalizedMessage()); eventBus.fireEvent(new SessionExpiredEvent(
UtilsGXT3.alert("Error", SessionExpiredType.EXPIREDONSERVER));
"Error retrieving current tabular resource id"); } else {
Log.error("Error retrieving current TRId: "
+ caught.getLocalizedMessage());
UtilsGXT3.alert("Error",
"Error retrieving current tabular resource id");
}
} }
public void onSuccess(TRId result) { public void onSuccess(TRId result) {