Added SessionExpiredShow
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@95760 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
09a406ccaa
commit
c10d6654ee
|
@ -15,6 +15,7 @@ import org.gcube.portlets.user.td.csvimportwidget.client.CSVImportWizardTD;
|
|||
import org.gcube.portlets.user.td.expressionwidget.client.ColumnFilterDialog;
|
||||
import org.gcube.portlets.user.td.expressionwidget.client.MultiColumnFilterDialog;
|
||||
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.openwidget.client.TDOpen;
|
||||
import org.gcube.portlets.user.td.sdmxexportwidget.client.SDMXExportWizardTD;
|
||||
import org.gcube.portlets.user.td.sdmximportwidget.client.SDMXImportWizardTD;
|
||||
|
@ -29,6 +30,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequ
|
|||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.GridContextMenuItemEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.GridHeaderColumnMenuItemEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.RibbonEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.SessionExpiredEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.TasksMonitorEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.UIStateEvent;
|
||||
import org.gcube.portlets.user.td.widgetcommonevent.client.event.WidgetRequestEvent;
|
||||
|
@ -104,6 +106,12 @@ public class TabularDataController {
|
|||
// if you do not need to something when the session expire
|
||||
CheckSession.getInstance().startPolling();
|
||||
}
|
||||
|
||||
protected void sessionExpiredShow(){
|
||||
CheckSession.showLogoutDialog();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @return the eventBus
|
||||
|
@ -138,7 +146,11 @@ public class TabularDataController {
|
|||
@Override
|
||||
public void onFailure(Throwable caught) {
|
||||
Log.info("No valid user found: " + caught.getMessage());
|
||||
UtilsGXT3.alert("Error", "No user found");
|
||||
if(caught instanceof TDGWTSessionExpiredException){
|
||||
UtilsGXT3.alert("Error", caught.getLocalizedMessage());
|
||||
} else {
|
||||
UtilsGXT3.alert("Error", "No user found");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -153,6 +165,18 @@ public class TabularDataController {
|
|||
|
||||
// Bind Controller to events on bus
|
||||
protected void bindToEvents() {
|
||||
eventBus.addHandler(
|
||||
SessionExpiredEvent.TYPE,
|
||||
new SessionExpiredEvent.SessionExpiredEventHandler() {
|
||||
|
||||
@Override
|
||||
public void onSessionExpired(SessionExpiredEvent event) {
|
||||
Log.debug("Catch Event SessionExpiredEvent");
|
||||
doSessionExpiredCommand(event);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
eventBus.addHandler(
|
||||
GridHeaderColumnMenuItemEvent.TYPE,
|
||||
new GridHeaderColumnMenuItemEvent.GridHeaderColumnMenuItemEventHandler() {
|
||||
|
@ -295,12 +319,12 @@ public class TabularDataController {
|
|||
|
||||
// Close Tabular Resource
|
||||
protected void closeTabularResource() {
|
||||
switch(uiState){
|
||||
switch (uiState) {
|
||||
case START:
|
||||
break;
|
||||
case TABLECURATION:
|
||||
case TABLEUPDATE:
|
||||
case TR_OPEN:
|
||||
case TR_OPEN:
|
||||
case TR_READONLY:
|
||||
Log.debug("CloseTabularResource Open");
|
||||
tabularData.closeTable();
|
||||
|
@ -320,11 +344,9 @@ public class TabularDataController {
|
|||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
protected void deleteTabularResource() {
|
||||
|
@ -466,7 +488,7 @@ public class TabularDataController {
|
|||
case TABLEAGGREAGETE:
|
||||
break;
|
||||
case ROWADD:
|
||||
doRowsAdd();
|
||||
doRowAdd();
|
||||
break;
|
||||
case ROWDELETE:
|
||||
doRowsDelete();
|
||||
|
@ -925,12 +947,10 @@ public class TabularDataController {
|
|||
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
protected void doRowsAdd() {
|
||||
ArrayList<String> rows = tabularData.getGridPanel().getSelectedRowsId();
|
||||
onRowsAdd(rows);
|
||||
protected void doRowAdd() {
|
||||
onRowAdd();
|
||||
}
|
||||
|
||||
protected void doRowsDelete() {
|
||||
|
@ -938,6 +958,11 @@ public class TabularDataController {
|
|||
onRowsDelete(rows);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete Rows
|
||||
*
|
||||
* @param rows
|
||||
*/
|
||||
private void onRowsDelete(ArrayList<String> rows) {
|
||||
if (rows == null || rows.size() == 0) {
|
||||
UtilsGXT3.alert("No rows selected", "No rows selected");
|
||||
|
@ -947,6 +972,11 @@ public class TabularDataController {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace Row
|
||||
*
|
||||
* @param cellData
|
||||
*/
|
||||
private void onReplace(CellData cellData) {
|
||||
if (cellData == null) {
|
||||
UtilsGXT3.alert("No cell selected", "No cell selected");
|
||||
|
@ -957,18 +987,28 @@ public class TabularDataController {
|
|||
}
|
||||
}
|
||||
|
||||
private void onRowsEdit(RowRaw rowRaw) {
|
||||
/**
|
||||
* Edit Row
|
||||
*
|
||||
* @param rowRaw
|
||||
*/
|
||||
private void onRowEdit(RowRaw rowRaw) {
|
||||
if (rowRaw == null) {
|
||||
UtilsGXT3.alert("No rows selected", "No rows selected");
|
||||
} else {
|
||||
EditRowDialog editRowDialog = new EditRowDialog(trId, rowRaw, eventBus);
|
||||
editRowDialog.show();
|
||||
EditRowDialog editRowDialog = new EditRowDialog(trId, rowRaw,
|
||||
eventBus);
|
||||
editRowDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void onRowsAdd(ArrayList<String> rows) {
|
||||
//tabularData.addRow(rows);
|
||||
/**
|
||||
* Add Row
|
||||
*/
|
||||
private void onRowAdd() {
|
||||
EditRowDialog editRowDialog = new EditRowDialog(trId, eventBus);
|
||||
editRowDialog.show();
|
||||
|
||||
}
|
||||
|
||||
protected void doGridContextMenuCommand(GridContextMenuItemEvent event) {
|
||||
|
@ -976,15 +1016,15 @@ public class TabularDataController {
|
|||
"OperationId: " + event.getGridOperationId());
|
||||
GridOperationId gridOperationId = event.getGridOperationId();
|
||||
ArrayList<String> rows = event.getRows();
|
||||
RowRaw rowRaw=event.getRowRaw();
|
||||
RowRaw rowRaw = event.getRowRaw();
|
||||
CellData cellData = event.getCellData();
|
||||
|
||||
switch (gridOperationId) {
|
||||
case ROWADD:
|
||||
onRowsAdd(rows);
|
||||
onRowAdd();
|
||||
break;
|
||||
case ROWEDIT:
|
||||
onRowsEdit(rowRaw);
|
||||
onRowEdit(rowRaw);
|
||||
break;
|
||||
case ROWDELETE:
|
||||
onRowsDelete(rows);
|
||||
|
@ -996,7 +1036,15 @@ public class TabularDataController {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected void doSessionExpiredCommand(SessionExpiredEvent event){
|
||||
Log.debug("Session Expired Event: "+ event.getSessionExpiredType());
|
||||
sessionExpiredShow();
|
||||
|
||||
}
|
||||
|
||||
|
||||
protected void doGridHeaderColumnMenuCommand(
|
||||
GridHeaderColumnMenuItemEvent event) {
|
||||
Log.debug("GridHeaderColumnMenu Fire Event",
|
||||
|
|
|
@ -35,24 +35,25 @@ public class GridContextMenu {
|
|||
this.eventBus = eventBus;
|
||||
tableContextMenu = new Menu();
|
||||
|
||||
/*
|
||||
* MenuItem addRowItem = new MenuItem("Add Row");
|
||||
* addRowItem.setId(GridOperationId.ROWADD.toString());
|
||||
* addRowItem.setIcon(TabularDataResources.INSTANCE.rowInsert());
|
||||
* addRowItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
*
|
||||
* @Override public void onSelection(SelectionEvent<Item> event) {
|
||||
* Log.debug("gridPanel is: " + gridPanel); if (gridPanel != null) {
|
||||
* ArrayList<String> rows=gridPanel.getSelectedRowsId();
|
||||
* GridContextMenuItemEvent eventGridContextMenu = new
|
||||
* GridContextMenuItemEvent( GridOperationId.ROWADD, rows);
|
||||
* eventBus.fireEvent(eventGridContextMenu);
|
||||
*
|
||||
* }
|
||||
*
|
||||
* } }); tableContextMenu.add(addRowItem);
|
||||
*/
|
||||
|
||||
MenuItem addRowItem = new MenuItem("Add Row");
|
||||
addRowItem.setId(GridOperationId.ROWADD.toString());
|
||||
addRowItem.setIcon(TabularDataResources.INSTANCE.rowInsert());
|
||||
addRowItem.addSelectionHandler(new SelectionHandler<Item>() {
|
||||
|
||||
@Override
|
||||
public void onSelection(SelectionEvent<Item> event) {
|
||||
Log.debug("gridPanel is: " + gridPanel);
|
||||
if (gridPanel != null) {
|
||||
GridContextMenuItemEvent eventGridContextMenu = new GridContextMenuItemEvent(
|
||||
GridOperationId.ROWADD);
|
||||
eventBus.fireEvent(eventGridContextMenu);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
tableContextMenu.add(addRowItem);
|
||||
|
||||
MenuItem editRowItem = new MenuItem("Edit Row");
|
||||
editRowItem.setId(GridOperationId.ROWEDIT.toString());
|
||||
editRowItem.setIcon(TabularDataResources.INSTANCE.rowEdit());
|
||||
|
@ -62,18 +63,18 @@ public class GridContextMenu {
|
|||
public void onSelection(SelectionEvent<Item> event) {
|
||||
Log.debug("gridPanel is: " + gridPanel);
|
||||
if (gridPanel != null) {
|
||||
|
||||
|
||||
RowRaw row = gridPanel.getSelectedRowAsRaw();
|
||||
if(row!=null){
|
||||
if (row != null) {
|
||||
GridContextMenuItemEvent eventGridContextMenu = new GridContextMenuItemEvent(
|
||||
GridOperationId.ROWEDIT, row);
|
||||
GridOperationId.ROWEDIT, row);
|
||||
eventBus.fireEvent(eventGridContextMenu);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
tableContextMenu.add(editRowItem);
|
||||
|
||||
|
||||
MenuItem deleteRowItem = new MenuItem("Delete Row");
|
||||
deleteRowItem.setId(GridOperationId.ROWDELETE.toString());
|
||||
deleteRowItem.setIcon(TabularDataResources.INSTANCE.rowRemove());
|
||||
|
|
Loading…
Reference in New Issue