diff --git a/pom.xml b/pom.xml
index ec5c8c2..ba5f09c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -241,6 +241,14 @@
tabular-data-wizard-widget
[1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)
+
+
+
+ org.gcube.portlets.user
+ tabular-data-mainbox-widget
+ [1.0.0-SNAPSHOT,2.0.0-SNAPSHOT)
+
+
diff --git a/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java b/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java
index 02e0fd7..2d6179e 100644
--- a/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java
+++ b/src/main/java/org/gcube/portlets/user/td/client/TabularDataController.java
@@ -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, HasOpenHandlers {
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() {
+ public void setMainBoxPanel(MainBoxPanel mainBoxPanel) {
+ this.mainBoxPanel = mainBoxPanel;
-
+ }
+
+ protected void callHello() {
+ TDGWTServiceAsync.INSTANCE.hello(new AsyncCallback() {
@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() {
+ TDGWTServiceAsync.INSTANCE.getCurrentTRId(new AsyncCallback() {
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() {
+ .closeAllTabularResources(new AsyncCallback() {
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() {
+
+ @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() {
+
+ @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() {
+
+ @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 rows = tabularData.getGridPanel().getSelectedRowsId();
+ // ArrayList rows =
+ // tabularData.getGridPanel().getSelectedRowsId();
+ ArrayList 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) {
diff --git a/src/main/java/org/gcube/portlets/user/td/client/TabularDataPortlet.java b/src/main/java/org/gcube/portlets/user/td/client/TabularDataPortlet.java
index 82183cd..733a04f 100644
--- a/src/main/java/org/gcube/portlets/user/td/client/TabularDataPortlet.java
+++ b/src/main/java/org/gcube/portlets/user/td/client/TabularDataPortlet.java
@@ -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);
diff --git a/src/main/java/org/gcube/portlets/user/td/client/grid/GridContextMenu.java b/src/main/java/org/gcube/portlets/user/td/client/grid/GridContextMenu.java
deleted file mode 100644
index f6ccf41..0000000
--- a/src/main/java/org/gcube/portlets/user/td/client/grid/GridContextMenu.java
+++ /dev/null
@@ -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" g.panichi@isti.cnr.it
- *
- * 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- () {
-
- @Override
- public void onSelection(SelectionEvent
- 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
- () {
-
- @Override
- public void onSelection(SelectionEvent
- 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
- () {
-
- @Override
- public void onSelection(SelectionEvent
- event) {
- Log.debug("gridPanel is: " + gridPanel);
- if (gridPanel != null) {
- ArrayList 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
- () {
-
- @Override
- public void onSelection(SelectionEvent
- 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;
- }
-}
diff --git a/src/main/java/org/gcube/portlets/user/td/client/grid/GridHeaderColumnMenu.java b/src/main/java/org/gcube/portlets/user/td/client/grid/GridHeaderColumnMenu.java
deleted file mode 100644
index c0786c5..0000000
--- a/src/main/java/org/gcube/portlets/user/td/client/grid/GridHeaderColumnMenu.java
+++ /dev/null
@@ -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"
- * g.panichi@isti.cnr.it
- *
- */
-public class GridHeaderColumnMenu {
-
- protected final ArrayList