Create Multi Tab Management

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-portlet@100724 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2014-10-15 16:45:45 +00:00
parent 0049bd8821
commit d58c03ff1c
8 changed files with 278 additions and 302 deletions

View File

@ -241,6 +241,14 @@
<artifactId>tabular-data-wizard-widget</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<!-- tabular-data-mainbox-widget -->
<dependency>
<groupId>org.gcube.portlets.user</groupId>
<artifactId>tabular-data-mainbox-widget</artifactId>
<version>[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)</version>
</dependency>
<!-- TD Expression -->
<dependency>

View File

@ -20,7 +20,9 @@ import org.gcube.portlets.user.td.expressionwidget.client.ReplaceColumnByExpress
import org.gcube.portlets.user.td.extractcodelistwidget.client.ExtractCodelistWizardTD;
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.user.UserInfo;
import org.gcube.portlets.user.td.jsonexportwidget.client.JSONExportWidgetTD;
import org.gcube.portlets.user.td.mainboxwidget.client.MainBoxPanel;
import org.gcube.portlets.user.td.mapwidget.client.MapWidgetTD;
import org.gcube.portlets.user.td.openwidget.client.TDOpen;
import org.gcube.portlets.user.td.sdmxexportwidget.client.SDMXExportWizardTD;
@ -35,6 +37,8 @@ import org.gcube.portlets.user.td.taskswidget.client.TdTaskController;
import org.gcube.portlets.user.td.unionwizardwidget.client.UnionWizardTD;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.BackgroundRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.ChangeTableRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.DataViewActiveEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.DataViewRequestEvent;
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;
@ -43,6 +47,7 @@ import org.gcube.portlets.user.td.widgetcommonevent.client.event.TasksMonitorEve
import org.gcube.portlets.user.td.widgetcommonevent.client.event.UIStateEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.WidgetRequestEvent;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.BackgroundRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.DataViewRequestType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.RibbonType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.SessionExpiredType;
import org.gcube.portlets.user.td.widgetcommonevent.client.type.TaskType;
@ -53,11 +58,11 @@ import org.gcube.portlets.user.td.widgetcommonevent.shared.GridHeaderOperationId
import org.gcube.portlets.user.td.widgetcommonevent.shared.GridOperationId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.RequestProperties;
import org.gcube.portlets.user.td.widgetcommonevent.shared.TRId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.dataview.DataView;
import org.gcube.portlets.user.td.widgetcommonevent.shared.dataview.TabularResourceDataView;
import org.gcube.portlets.user.td.widgetcommonevent.shared.grid.model.RowRaw;
import org.gcube.portlets.user.td.wizardwidget.client.WizardListener;
import org.gcube.portlets.user.tdtemplate.client.TdTemplateController;
import org.gcube.portlets.user.tdwx.client.TabularDataX;
import org.gcube.portlets.user.tdwx.shared.model.TableId;
import org.gcube.portlets.widgets.sessionchecker.client.CheckSession;
import com.allen_sauer.gwt.log.client.Log;
@ -87,7 +92,8 @@ public class TabularDataController {
// implements HasCloseHandlers<Long>, HasOpenHandlers<Long> {
protected SimpleEventBus eventBus;
protected TabularDataX tabularData;
// protected TabularDataX tabularData;
private MainBoxPanel mainBoxPanel;
protected UIStateType uiState = UIStateType.START;
private boolean taskManagerInit = false;
@ -99,19 +105,19 @@ public class TabularDataController {
/**
* Current user
*/
protected String userName;
protected UserInfo userInfo;
/**
* Tabular Resource Id
*/
protected TRId trId;
/**
* Grid TableId
*/
protected TableId tableOpening;
//protected TableId tableOpening;
private TRId openTRIdAfterServerUpdate;
public TabularDataController() {
eventBus = new SimpleEventBus();
@ -136,9 +142,10 @@ public class TabularDataController {
return eventBus;
}
public void setTabularData(TabularDataX tabularData) {
this.tabularData = tabularData;
}
/*
* public void setTabularData(TabularDataX tabularData) { this.tabularData =
* tabularData; }
*/
public ContentPanel getToolBoxPanel() {
return toolBoxPanel;
@ -156,10 +163,13 @@ public class TabularDataController {
this.westData = westData;
}
protected void callHello() {
TDGWTServiceAsync.INSTANCE.hello(new AsyncCallback<String>() {
public void setMainBoxPanel(MainBoxPanel mainBoxPanel) {
this.mainBoxPanel = mainBoxPanel;
}
protected void callHello() {
TDGWTServiceAsync.INSTANCE.hello(new AsyncCallback<UserInfo>() {
@Override
public void onFailure(Throwable caught) {
@ -173,9 +183,9 @@ public class TabularDataController {
}
@Override
public void onSuccess(String result) {
userName=result;
Log.info("Hello: " + result);
public void onSuccess(UserInfo result) {
userInfo = result;
Log.info("Hello: " + result.getUsername());
}
@ -209,6 +219,17 @@ public class TabularDataController {
}
});
eventBus.addHandler(DataViewActiveEvent.TYPE,
new DataViewActiveEvent.DataViewActiveEventHandler() {
@Override
public void onDataViewActive(DataViewActiveEvent event) {
Log.debug("Catch Event DataViewActiveEvent");
doDataViewActiveCommand(event);
}
});
eventBus.addHandler(
GridHeaderColumnMenuItemEvent.TYPE,
new GridHeaderColumnMenuItemEvent.GridHeaderColumnMenuItemEventHandler() {
@ -294,32 +315,32 @@ public class TabularDataController {
//
public void restoreUISession() {
TDGWTServiceAsync.INSTANCE
.getCurrentTRId(new AsyncCallback<TRId>() {
TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback<TRId>() {
public void onFailure(Throwable caught) {
}
public void onSuccess(TRId trId) {
if(trId!=null){
if(trId.getId()!=null && !trId.getId().isEmpty()){
if (trId != null) {
if (trId.getId() != null && !trId.getId().isEmpty()) {
openTable(trId);
}
}
}
});
}
//
//TODO
protected void putInBackgroundUIState() {
try {
closeTabularResource();
openBackgroundMonitor();
openTabularResource(true);
requestCloseCurrent();
//closeAllTabularResource();
//openBackgroundMonitor();
//openTabularResource(true);
} catch (Exception e) {
Log.debug("Put In Background :" + e.getLocalizedMessage());
@ -375,9 +396,9 @@ public class TabularDataController {
protected void openTable(TRId tabularResourceId) {
Log.debug("openTable: " + tabularResourceId);
trId = tabularResourceId;
tableOpening = new TableId(Constants.TDX_DATASOURCE_FACTORY_ID,
trId.getTableId());
tabularData.openTable(tableOpening);
//tableOpening = new TableId(Constants.TDX_DATASOURCE_FACTORY_ID,
// trId.getTableId());
// tabularData.openTable(tableOpening);
uiState = UIStateType.TR_OPEN;
UIStateEvent uiStateEvent = new UIStateEvent(UIStateType.TR_OPEN);
uiStateEvent.setTrId(tabularResourceId);
@ -388,9 +409,9 @@ public class TabularDataController {
protected void updateTable(TRId tabularResourceId) {
Log.debug("updateTable: " + tabularResourceId);
trId = tabularResourceId;
tableOpening = new TableId(Constants.TDX_DATASOURCE_FACTORY_ID,
trId.getTableId());
tabularData.openTable(tableOpening);
//tableOpening = new TableId(Constants.TDX_DATASOURCE_FACTORY_ID,
// trId.getTableId());
// tabularData.openTable(tableOpening);
uiState = UIStateType.TABLEUPDATE;
UIStateEvent uiStateEvent = new UIStateEvent(UIStateType.TABLEUPDATE);
uiStateEvent.setTrId(tabularResourceId);
@ -401,9 +422,9 @@ public class TabularDataController {
protected void updateTableForCuration(TRId tabularResourceId) {
Log.debug("updateTableForCuration: " + tabularResourceId);
trId = tabularResourceId;
tableOpening = new TableId(Constants.TDX_DATASOURCE_FACTORY_ID,
trId.getTableId());
tabularData.openTable(tableOpening);
//tableOpening = new TableId(Constants.TDX_DATASOURCE_FACTORY_ID,
// trId.getTableId());
// tabularData.openTable(tableOpening);
uiState = UIStateType.TABLECURATION;
UIStateEvent uiStateEvent = new UIStateEvent(UIStateType.TABLECURATION);
uiStateEvent.setTrId(tabularResourceId);
@ -411,7 +432,7 @@ public class TabularDataController {
}
// Close Tabular Resource
protected void closeTabularResource() {
protected void closeAllTabularResource() {
switch (uiState) {
case START:
break;
@ -421,11 +442,11 @@ public class TabularDataController {
case TR_READONLY:
case WIZARD_OPEN:
Log.debug("CloseTabularResource");
tabularData.closeTable();
// tabularData.closeTable();
UIStateEvent uiStateEvent = new UIStateEvent(UIStateType.TR_CLOSE);
uiStateEvent.setTrId(trId);
trId = null;
tableOpening = null;
//tableOpening = null;
uiState = UIStateType.TR_CLOSE;
Log.debug("fireEvent TR_CLOSE");
try {
@ -433,7 +454,7 @@ public class TabularDataController {
} catch (Exception e) {
Log.debug("Bus Error: " + e.getMessage());
}
closeTabularResourceOnServer();
closeAllTabularResourceOnServer();
break;
case TR_CLOSE:
break;
@ -444,23 +465,173 @@ public class TabularDataController {
}
protected void closeTabularResourceOnServer() {
protected void closeAllTabularResourceOnServer() {
TDGWTServiceAsync.INSTANCE
.closeTabularResource(new AsyncCallback<Void>() {
.closeAllTabularResources(new AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
UtilsGXT3.alert("Error closing tabular resource",
UtilsGXT3.alert("Error closing all tabular resources",
caught.getLocalizedMessage());
}
public void onSuccess(Void result) {
}
});
}
// TODO
protected void doActiveAfterClose(DataViewActiveEvent event) {
Log.debug("doActiveAfterClose: " + event);
DataView dataView = event.getDataView();
if (dataView instanceof TabularResourceDataView) {
TabularResourceDataView tabularResourceDataView = (TabularResourceDataView) dataView;
Log.debug("New TabularResourceDataView:" + tabularResourceDataView);
openTRIdAfterServerUpdate = tabularResourceDataView.getTrId();
DataView olderDataView = event.getOldDataView();
if (olderDataView instanceof TabularResourceDataView) {
TabularResourceDataView olderTabularResourceDataView = (TabularResourceDataView) olderDataView;
Log.debug("New TabularResourceDataView:"
+ olderTabularResourceDataView);
TDGWTServiceAsync.INSTANCE.closeTabularResourceAndOpen(
openTRIdAfterServerUpdate,
olderTabularResourceDataView.getTrId(),
new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error in Close and Open TR "
+ caught.getLocalizedMessage());
caught.printStackTrace();
UtilsGXT3
.alert("Error",
"Error in close TR: "
+ caught.getLocalizedMessage());
}
}
@Override
public void onSuccess(Void result) {
doOpenTRIdAfterServerUpdate();
}
}
);
} else {
}
} else {
}
}
protected void doOpenTRIdAfterServerUpdate() {
openTable(openTRIdAfterServerUpdate);
}
protected void doNewActive(DataViewActiveEvent event) {
Log.debug("doNewActive: " + event);
DataView dataView = event.getDataView();
if (dataView instanceof TabularResourceDataView) {
TabularResourceDataView tabularResourceDataView = (TabularResourceDataView) dataView;
Log.debug("TabularResourceDataView:" + tabularResourceDataView);
openTRIdAfterServerUpdate = tabularResourceDataView.getTrId();
TDGWTServiceAsync.INSTANCE.setActiveTabularResource(
openTRIdAfterServerUpdate, new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error in set Active TR "
+ caught.getLocalizedMessage());
caught.printStackTrace();
UtilsGXT3.alert(
"Error",
"Error in set Active TR: "
+ caught.getLocalizedMessage());
}
}
@Override
public void onSuccess(Void result) {
doOpenTRIdAfterServerUpdate();
}
}
);
}
}
protected void doDataViewClose(DataViewActiveEvent event) {
Log.debug("doDataViewClose: " + event);
DataView oldDataView = event.getOldDataView();
if (oldDataView instanceof TabularResourceDataView) {
closeAllTabularResource();
/*TabularResourceDataView tabularResourceDataView = (TabularResourceDataView) oldDataView;
Log.debug("TabularResourceDataView:" + tabularResourceDataView);
TDGWTServiceAsync.INSTANCE.closeTabularResource(
tabularResourceDataView.getTrId(), new AsyncCallback<Void>() {
@Override
public void onFailure(Throwable caught) {
if (caught instanceof TDGWTSessionExpiredException) {
eventBus.fireEvent(new SessionExpiredEvent(
SessionExpiredType.EXPIREDONSERVER));
} else {
Log.error("Error in set Active TR "
+ caught.getLocalizedMessage());
caught.printStackTrace();
UtilsGXT3.alert(
"Error",
"Error in set Active TR: "
+ caught.getLocalizedMessage());
}
}
@Override
public void onSuccess(Void result) {
Log.debug("Close Taular Resource");
}
}
);*/
} else {
}
}
protected void requestCloseCurrent(){
DataViewRequestEvent dataViewRequestEvent=new DataViewRequestEvent();
dataViewRequestEvent.setDataViewRequestType(DataViewRequestType.CLOSE);
dataViewRequestEvent.setDataView(new TabularResourceDataView(trId));
eventBus.fireEvent(dataViewRequestEvent);
}
//TODO
protected void deleteTabularResource() {
final ConfirmMessageBox mb = new ConfirmMessageBox("Confirm",
@ -479,7 +650,7 @@ public class TabularDataController {
}
public void onSuccess(Void result) {
closeTabularResource();
requestCloseCurrent();
}
});
@ -512,7 +683,7 @@ public class TabularDataController {
cloneTabularResource();
break;
case CLOSE:
closeTabularResource();
closeAllTabularResource();
break;
case DELETE:
deleteTabularResource();
@ -1012,8 +1183,6 @@ public class TabularDataController {
});
}
protected void openTableUnionWizard() {
GWT.runAsync(new RunAsyncCallback() {
@ -1060,8 +1229,8 @@ public class TabularDataController {
public void onSuccess() {
openWizard();
MapWidgetTD mapWizard = new MapWidgetTD(trId, userName, "Map Creation",
eventBus);
MapWidgetTD mapWizard = new MapWidgetTD(trId, userInfo,
"Map Creation", eventBus);
mapWizard.addListener(new WizardListener() {
public void failed(String title, String message,
@ -1085,7 +1254,6 @@ public class TabularDataController {
}
});
}
public void onFailure(Throwable reason) {
@ -1094,10 +1262,7 @@ public class TabularDataController {
});
}
/**
* @param switchState
*
@ -1530,7 +1695,10 @@ public class TabularDataController {
}
protected void doRowsDelete() {
ArrayList<String> rows = tabularData.getGridPanel().getSelectedRowsId();
// ArrayList<String> rows =
// tabularData.getGridPanel().getSelectedRowsId();
ArrayList<String> rows = mainBoxPanel.getSelectedRowsId();
onRowsDelete(rows);
}
@ -1619,13 +1787,33 @@ public class TabularDataController {
}
protected void doDataViewActiveCommand(DataViewActiveEvent event) {
Log.debug("DataViewActive Event: " + event);
switch (event.getDataViewActiveType()) {
case ACTIVEAFTERCLOSE:
doActiveAfterClose(event);
break;
case NEWACTIVE:
doNewActive(event);
break;
case CLOSE:
doDataViewClose(event);
default:
break;
}
}
protected void doGridHeaderColumnMenuCommand(
GridHeaderColumnMenuItemEvent event) {
Log.debug("GridHeaderColumnMenu Fire Event",
"OperationId: " + event.getOperationId() + " Column: \n"
+ event.getColumnSelected());
String opId = event.getOperationId();
String columnName = tabularData.getColumnId(event.getColumnSelected());
// String columnName =
// tabularData.getColumnName(event.getColumnSelected());
String columnName = mainBoxPanel.getColumnName(event
.getColumnSelected());
Log.debug("GridColumnName: " + columnName);
if (opId.compareTo(GridHeaderOperationId.COLUMNLABEL.toString()) == 0) {

View File

@ -1,15 +1,10 @@
package org.gcube.portlets.user.td.client;
import org.gcube.portlets.user.td.client.grid.GridContextMenu;
import org.gcube.portlets.user.td.client.grid.GridHeaderColumnMenu;
import org.gcube.portlets.user.td.client.ribbon.TabularDataRibbon;
import org.gcube.portlets.user.td.client.rpc.TabularDataService;
import org.gcube.portlets.user.td.client.rpc.TabularDataServiceAsync;
import org.gcube.portlets.user.td.mainboxwidget.client.MainBoxPanel;
import org.gcube.portlets.user.td.toolboxwidget.client.ToolBoxPanel;
import org.gcube.portlets.user.tdwx.client.TabularDataX;
import org.gcube.portlets.user.tdwx.client.TabularDataXGridPanel;
import org.gcube.portlets.user.tdwx.client.event.FailureEvent;
import org.gcube.portlets.user.tdwx.client.event.FailureEventHandler;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.core.client.EntryPoint;
@ -18,14 +13,12 @@ import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.core.client.Style.SelectionMode;
import com.sencha.gxt.core.client.util.Margins;
import com.sencha.gxt.widget.core.client.TabPanel;
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer;
import com.sencha.gxt.widget.core.client.container.BorderLayoutContainer.BorderLayoutData;
import com.sencha.gxt.widget.core.client.container.MarginData;
import com.sencha.gxt.widget.core.client.container.Viewport;
import com.sencha.gxt.widget.core.client.info.Info;
/**
*
@ -58,7 +51,7 @@ public class TabularDataPortlet implements EntryPoint {
private static BorderLayoutContainer mainPanelLayout;
// Private TabularData
private static TabularDataX tabularData;
//private static TabularDataX tabularData;
private static ToolBoxPanel toolBoxPanel;
private static BorderLayoutData westData;
@ -88,7 +81,7 @@ public class TabularDataPortlet implements EntryPoint {
TabularDataController controller = new TabularDataController();
EventBus eventBus = controller.getEventBus();
tabularData = new TabularDataX(Constants.TDX_DATASOURCE_FACTORY_ID);
/*tabularData = new TabularDataX(Constants.TDX_DATASOURCE_FACTORY_ID);
tabularData.addFailureHandler(new FailureEventHandler() {
public void onFailure(FailureEvent event) {
@ -98,7 +91,7 @@ public class TabularDataPortlet implements EntryPoint {
}
});
controller.setTabularData(tabularData);
controller.setTabularData(tabularData);*/
// Layout
mainPanelLayout = new BorderLayoutContainer();
@ -117,7 +110,11 @@ public class TabularDataPortlet implements EntryPoint {
mainPanelLayout.setNorthWidget(toolBarPanel, toolBarData);
// Grid Panel
final TabularDataXGridPanel gridPanel = tabularData.getGridPanel();
final MainBoxPanel mainBoxPanel = new MainBoxPanel("MainBoxPanel",
eventBus);
controller.setMainBoxPanel(mainBoxPanel);
/*final TabularDataXGridPanel gridPanel = tabularData.getGridPanel();
gridPanel.setHeaderVisible(false);
GridHeaderColumnMenu columnHeaderMenu = new GridHeaderColumnMenu();
@ -128,11 +125,12 @@ public class TabularDataPortlet implements EntryPoint {
eventBus);
gridPanel.setGridContextMenu(gridContextMenu.getMenu());
gridPanel.setSelectionModel(SelectionMode.MULTI);
gridPanel.setSelectionModel(SelectionMode.MULTI);*/
MarginData gridData = new MarginData();
mainPanelLayout.setCenterWidget(gridPanel, gridData);
//mainPanelLayout.setCenterWidget(gridPanel, gridData);
mainPanelLayout.setCenterWidget(mainBoxPanel, gridData);
// ToolBox Panel
toolBoxPanel = new ToolBoxPanel("ToolBoxPanel", eventBus);

View File

@ -1,129 +0,0 @@
package org.gcube.portlets.user.td.client.grid;
import java.util.ArrayList;
import org.gcube.portlets.user.td.client.resource.TabularDataResources;
import org.gcube.portlets.user.td.widgetcommonevent.client.event.GridContextMenuItemEvent;
import org.gcube.portlets.user.td.widgetcommonevent.shared.CellData;
import org.gcube.portlets.user.td.widgetcommonevent.shared.GridOperationId;
import org.gcube.portlets.user.td.widgetcommonevent.shared.grid.model.RowRaw;
import org.gcube.portlets.user.tdwx.client.TabularDataXGridPanel;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.event.logical.shared.SelectionEvent;
import com.google.gwt.event.logical.shared.SelectionHandler;
import com.google.web.bindery.event.shared.EventBus;
import com.sencha.gxt.widget.core.client.menu.Item;
import com.sencha.gxt.widget.core.client.menu.Menu;
import com.sencha.gxt.widget.core.client.menu.MenuItem;
/**
*
* @author "Giancarlo Panichi" <a
* href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
* Defines the context menu of grid
*/
public class GridContextMenu {
protected Menu tableContextMenu;
protected final TabularDataXGridPanel gridPanel;
protected EventBus eventBus;
public GridContextMenu(final TabularDataXGridPanel gridPanel,
final EventBus eventBus) {
this.gridPanel = gridPanel;
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) {
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());
editRowItem.addSelectionHandler(new SelectionHandler<Item>() {
@Override
public void onSelection(SelectionEvent<Item> event) {
Log.debug("gridPanel is: " + gridPanel);
if (gridPanel != null) {
RowRaw row = gridPanel.getSelectedRowAsRaw();
if (row != null) {
GridContextMenuItemEvent eventGridContextMenu = new GridContextMenuItemEvent(
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());
deleteRowItem.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.ROWDELETE, rows);
eventBus.fireEvent(eventGridContextMenu);
}
}
});
tableContextMenu.add(deleteRowItem);
MenuItem replaceRowsItem = new MenuItem("Replace Value");
replaceRowsItem.setId(GridOperationId.REPLACE.toString());
replaceRowsItem.setIcon(TabularDataResources.INSTANCE.columnReplace());
replaceRowsItem.addSelectionHandler(new SelectionHandler<Item>() {
@Override
public void onSelection(SelectionEvent<Item> event) {
Log.debug("gridPanel is: " + gridPanel);
if (gridPanel != null) {
CellData cellData = gridPanel.getSelectedCell();
if (cellData != null) {
GridContextMenuItemEvent eventGridContextMenu = new GridContextMenuItemEvent(
GridOperationId.REPLACE, cellData);
eventBus.fireEvent(eventGridContextMenu);
} else {
}
}
}
});
tableContextMenu.add(replaceRowsItem);
}
/**
*
* @return context menu for grid
*/
public Menu getMenu() {
return tableContextMenu;
}
}

View File

@ -1,99 +0,0 @@
package org.gcube.portlets.user.td.client.grid;
import java.util.ArrayList;
import java.util.List;
import org.gcube.portlets.user.td.client.resource.TabularDataResources;
import org.gcube.portlets.user.td.widgetcommonevent.shared.GridHeaderOperationId;
import com.sencha.gxt.widget.core.client.menu.MenuItem;
/**
* Defines the menu for column on the grid
*
* @author "Giancarlo Panichi"
* <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a>
*
*/
public class GridHeaderColumnMenu {
protected final ArrayList<MenuItem> menuItems;
public GridHeaderColumnMenu() {
menuItems = new ArrayList<MenuItem>();
MenuItem changeLabelItem = new MenuItem("Labels");
changeLabelItem.setId(GridHeaderOperationId.COLUMNLABEL
.toString());
changeLabelItem.setIcon(TabularDataResources.INSTANCE.columnLabel());
menuItems.add(changeLabelItem);
MenuItem addColumnItem = new MenuItem("Add Column");
addColumnItem.setId(GridHeaderOperationId.COLUMNADD.toString());
addColumnItem.setIcon(TabularDataResources.INSTANCE.columnAdd());
menuItems.add(addColumnItem);
MenuItem deleteColumnItem = new MenuItem("Delete Column");
deleteColumnItem.setId(GridHeaderOperationId.COLUMNDELETE.toString());
deleteColumnItem.setIcon(TabularDataResources.INSTANCE.columnDelete());
menuItems.add(deleteColumnItem);
MenuItem splitColumnItem = new MenuItem("Split Column");
splitColumnItem.setId(GridHeaderOperationId.COLUMNSPLIT.toString());
splitColumnItem.setIcon(TabularDataResources.INSTANCE.columnSplit());
menuItems.add(splitColumnItem);
MenuItem mergeColumnItem = new MenuItem("Merge Column");
mergeColumnItem.setId(GridHeaderOperationId.COLUMNMERGE.toString());
mergeColumnItem.setIcon(TabularDataResources.INSTANCE.columnMerge());
menuItems.add(mergeColumnItem);
MenuItem changeToTypeItem = new MenuItem("Change Type");
changeToTypeItem.setId(GridHeaderOperationId.COLUMNTYPE.toString());
changeToTypeItem.setIcon(TabularDataResources.INSTANCE.columnType());
menuItems.add(changeToTypeItem);
MenuItem filterItem = new MenuItem("Filter");
filterItem.setId(GridHeaderOperationId.COLUMNFILTER.toString());
filterItem.setIcon(TabularDataResources.INSTANCE.columnFilter());
menuItems.add(filterItem);
MenuItem replaceValueBatchItem = new MenuItem("Replace Batch");
replaceValueBatchItem.setId(GridHeaderOperationId.COLUMNBATCHREPLACE.toString());
replaceValueBatchItem.setIcon(TabularDataResources.INSTANCE.columnReplaceBatch());
menuItems.add(replaceValueBatchItem);
MenuItem replaceValueOnConditionItem = new MenuItem("Replace By Expression");
replaceValueOnConditionItem.setId(GridHeaderOperationId.COLUMNREPLACEBYEXPRESSION.toString());
replaceValueOnConditionItem.setIcon(TabularDataResources.INSTANCE.columnReplaceByExpression());
menuItems.add(replaceValueOnConditionItem);
/*MenuItem newAnnotationColumnItem = new MenuItem("Annotation");
newAnnotationColumnItem.setId(GridHeaderOperationId.ANNOTATIONADD.toString());
newAnnotationColumnItem.setIcon(TabularDataResources.INSTANCE.annotationAdd());
menuItems.add(newAnnotationColumnItem);*/
/*MenuItem columnDuplicateValidationItem = new MenuItem("Duplicate Detection");
columnDuplicateValidationItem.setId(GridHeaderOperationId.DUPLICATEDETECTION.toString());
columnDuplicateValidationItem.setIcon(TabularDataResources.INSTANCE.tableDuplicateRows());
menuItems.add(columnDuplicateValidationItem);*/
}
/**
*
* @return the list of menu items to be added
*/
public List<MenuItem> getMenu() {
return menuItems;
}
}

View File

@ -20,6 +20,8 @@
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
<inherits name='org.gcube.portlets.user.td.mainboxwidget.MainBox' />
<inherits
name='org.gcube.portlets.user.td.expressionwidget.ExpressionWidget' />
<inherits name='org.gcube.portlets.user.td.tablewidget.TableWidget' />

View File

@ -18,6 +18,7 @@
<inherits name='org.gcube.portlets.user.td.monitorwidget.MonitorWidgetTD' />
<inherits name='org.gcube.portlets.user.td.wizardwidget.Wizard' />
<inherits name='org.gcube.portlets.user.td.mainboxwidget.MainBox' />
<inherits
name='org.gcube.portlets.user.td.expressionwidget.ExpressionWidget' />
<inherits name='org.gcube.portlets.user.td.tablewidget.TableWidget' />
@ -63,7 +64,7 @@
<set-property name="log_DivLogger" value="ENABLED" /> <set-property
name="log_ConsoleLogger" value="ENABLED" /> <set-property name="log_FirebugLogger"
value="ENABLED" /> <set-property name="log_GWTLogger" value="ENABLED" />
<set-property name="log_SystemLogger" value="ENABLED" /> -->
<set-property name="log_SystemLogger" value="ENABLED" /> -->
<set-property name="log_DivLogger" value="DISABLED" />

View File

@ -16,9 +16,16 @@
<!-- Base Service -->
<servlet>
<servlet-name>tdservlet</servlet-name>
<servlet-class>org.gcube.portlets.user.td.server.TabularDataServiceImpl</servlet-class>
<servlet-class>org.gcube.portlets.user.td.mainboxwidget.server.TabularDataServiceImpl</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- Base Service
<servlet>
<servlet-name>tdservlet</servlet-name>
<servlet-class>org.gcube.portlets.user.td.server.TabularDataServiceImpl</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>-->
<!-- TDWidget -->
<servlet>