diff --git a/.settings/org.eclipse.wst.common.component b/.settings/org.eclipse.wst.common.component index da7f835..53deb97 100644 --- a/.settings/org.eclipse.wst.common.component +++ b/.settings/org.eclipse.wst.common.component @@ -10,6 +10,9 @@ uses + + uses + uses 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 343e109..d1c1f79 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 @@ -9,6 +9,7 @@ import org.gcube.portlets.user.td.gwtservice.client.rpc.TDGWTServiceAsync; 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; +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.UIStateEvent; import org.gcube.portlets.user.td.widgetcommonevent.client.type.RibbonType; @@ -81,8 +82,6 @@ public class TabularDataController { this.toolBoxPanel = toolBoxPanel; } - - public BorderLayoutData getEastData() { return eastData; } @@ -92,6 +91,29 @@ public class TabularDataController { } protected void bindToEvents() { + eventBus.addHandler( + GridHeaderColumnMenuItemEvent.TYPE, + new GridHeaderColumnMenuItemEvent.GridHeaderColumnMenuItemEventHandler() { + + public void onGridHeaderColumnMenuItemEvent( + GridHeaderColumnMenuItemEvent event) { + Log.debug("Catch Event HeaderColumnMenuItemEvent"); + final AlertMessageBox d = new AlertMessageBox( + "HeaderMenu Fire Event", "OperationId: " + + event.getOperationId() + + " Column: \n" + + event.getColumnSelected()); + d.addHideHandler(new HideEvent.HideHandler() { + + public void onHide(HideEvent event) { + d.hide(); + } + }); + d.show(); + + } + }); + eventBus.addHandler(RibbonEvent.TYPE, new RibbonEvent.RibbonEventHandler() { @@ -121,7 +143,7 @@ public class TabularDataController { protected void resumeUIState() { if (uiState == UIStateType.TR_OPEN) { - UIStateEvent uiStateEvent=new UIStateEvent(UIStateType.TR_OPEN); + UIStateEvent uiStateEvent = new UIStateEvent(UIStateType.TR_OPEN); uiStateEvent.setTrId(trId); eventBus.fireEvent(uiStateEvent); } else { @@ -130,36 +152,33 @@ public class TabularDataController { } protected void openTable(TRId tabularResourceId) { - Log.debug("openTabe: "+tabularResourceId); + Log.debug("openTabe: " + tabularResourceId); trId = tabularResourceId; 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 uiStateEvent = new UIStateEvent(UIStateType.TR_OPEN); uiStateEvent.setTrId(tabularResourceId); eventBus.fireEvent(uiStateEvent); } - + /* - protected void updateUIProperties(){ - if (uiToolBox == UIToolBox.OPENED) { - trProperties.update(); - } - } - */ - + * protected void updateUIProperties(){ if (uiToolBox == UIToolBox.OPENED) { + * trProperties.update(); } } + */ + protected void closeTabularResource() { if (uiState == UIStateType.TR_OPEN) { tabularData.closeTable(); uiState = UIStateType.TR_CLOSE; eventBus.fireEvent(new UIStateEvent(UIStateType.TR_CLOSE)); - + } } protected void deleteTabularResource() { - Log.debug("Remove TR:"+trId); + Log.debug("Remove TR:" + trId); TDGWTServiceAsync.INSTANCE.removeTabularResource(trId, new AsyncCallback() { @Override @@ -223,27 +242,18 @@ public class TabularDataController { } /* - protected void openToolBox() { - if (uiState == UIStateType.TR_OPEN) { - if (uiToolBox == UIToolBox.OPENED) { - toolBoxPanel.collapse(); - toolBoxPanel.disable(); - - uiToolBox = UIToolBox.CLOSED; - eventBus.fireEvent(new UIStateEvent(UIStateType.TOOLBOX_CLOSE)); - toolBox.remove(trProperties); - Info.display("Properties", "Closed"); - } else { - eventBus.fireEvent(new UIStateEvent(UIStateType.TOOLBOX_OPEN)); - toolBoxPanel.enable(); - toolBoxPanel.expand(); - uiToolBox = UIToolBox.OPENED; - - } - } else { - Info.display("Properties", "No table open"); - } - };*/ + * protected void openToolBox() { if (uiState == UIStateType.TR_OPEN) { if + * (uiToolBox == UIToolBox.OPENED) { toolBoxPanel.collapse(); + * toolBoxPanel.disable(); + * + * uiToolBox = UIToolBox.CLOSED; eventBus.fireEvent(new + * UIStateEvent(UIStateType.TOOLBOX_CLOSE)); toolBox.remove(trProperties); + * Info.display("Properties", "Closed"); } else { eventBus.fireEvent(new + * UIStateEvent(UIStateType.TOOLBOX_OPEN)); toolBoxPanel.enable(); + * toolBoxPanel.expand(); uiToolBox = UIToolBox.OPENED; + * + * } } else { Info.display("Properties", "No table open"); } }; + */ protected void openSDMXImportWizard() { GWT.runAsync(new RunAsyncCallback() { @@ -362,7 +372,6 @@ public class TabularDataController { } }); - } /** 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 7202bb1..05e20c8 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,7 +1,9 @@ package org.gcube.portlets.user.td.client; +import java.util.ArrayList; import java.util.List; +import org.gcube.portlets.user.td.client.grid.ColumnHeaderMenu; 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; @@ -14,6 +16,7 @@ import org.gcube.portlets.user.tdwx.client.event.FailureEventHandler; import org.gcube.portlets.user.tdwx.client.model.grid.DataRowColumnConfig; import org.gcube.portlets.user.tdwx.shared.model.DataRow; + import com.allen_sauer.gwt.log.client.Log; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.GWT; @@ -136,6 +139,12 @@ public class TabularDataPortlet implements EntryPoint { final TabularDataXGridPanel gridPanel = tabularData.getGridPanel(); gridPanel.setHeaderVisible(false); + ColumnHeaderMenu columnHeaderMenu=new ColumnHeaderMenu(); + + + gridPanel.addGridHeaderContextMenuItems(columnHeaderMenu.getMenu(),eventBus); + + MarginData gridData = new MarginData(); mainPanelLayout.setCenterWidget(gridPanel, gridData); @@ -270,5 +279,8 @@ public class TabularDataPortlet implements EntryPoint { * * } */ + + + }