From e04e901683b9f255d1782d2b589a74ab0afc6182 Mon Sep 17 00:00:00 2001 From: Giancarlo Panichi Date: Mon, 16 Dec 2013 11:59:26 +0000 Subject: [PATCH] Minor updated git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@86966 82a268e6-3cf1-43bd-a215-b396298e98cf --- .classpath | 6 ++- .project | 4 +- .settings/org.eclipse.jdt.core.prefs | 6 +-- .../tdwx/client/TabularDataXGridPanel.java | 54 +++++++++++++------ 4 files changed, 49 insertions(+), 21 deletions(-) diff --git a/.classpath b/.classpath index 2a6a282..bd24964 100644 --- a/.classpath +++ b/.classpath @@ -17,12 +17,16 @@ - + + + + + diff --git a/.project b/.project index d853412..d3d42ff 100644 --- a/.project +++ b/.project @@ -16,12 +16,12 @@ - org.eclipse.m2e.core.maven2Builder + org.eclipse.wst.validation.validationbuilder - org.eclipse.wst.validation.validationbuilder + org.eclipse.m2e.core.maven2Builder diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index 6249222..107056a 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,12 @@ eclipse.preferences.version=1 org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.7 +org.eclipse.jdt.core.compiler.source=1.6 diff --git a/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java b/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java index d22426c..f3ee552 100644 --- a/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java +++ b/src/main/java/org/gcube/portlets/user/tdwx/client/TabularDataXGridPanel.java @@ -39,7 +39,8 @@ import com.google.gwt.core.client.Scheduler; import com.google.gwt.core.client.Scheduler.ScheduledCommand; 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.google.gwt.event.shared.EventBus; + import com.google.gwt.http.client.RequestBuilder; import com.sencha.gxt.core.client.Style.SelectionMode; import com.sencha.gxt.data.client.loader.HttpProxy; @@ -75,9 +76,9 @@ public class TabularDataXGridPanel extends ContentPanel { protected EventBus eventBus; - protected List items; + protected List headerColumnMenuItems; - protected EventBus externalBus; + protected com.google.web.bindery.event.shared.EventBus externalBus; protected Grid grid; @@ -342,24 +343,40 @@ public class TabularDataXGridPanel extends ContentPanel { grid.setContextMenu(contextMenu); } else grid.setContextMenu(null); + + if(headerColumnMenuItems!=null){ + setHeaderContextMenuHandler(); + } + } /** * + * Add Items to menu of columns + * + * @param items + * @param externalBus */ - - public void addGridHeaderContextMenuItems(final List items, EventBus externalBus) { - this.items = items; + public void addGridHeaderContextMenuItems(final List items, + com.google.web.bindery.event.shared.EventBus externalBus) { + this.headerColumnMenuItems = items; this.externalBus=externalBus; - - grid.addHeaderContextMenuHandler(new HeaderContextMenuHandler() { - + } + + /** + * + */ + protected void setHeaderContextMenuHandler(){ + + HeaderContextMenuHandler headerContextMenuHandler=new HeaderContextMenuEvent.HeaderContextMenuHandler() { + + public void onHeaderContextMenu(HeaderContextMenuEvent event) { + Log.debug("Header Menu"); final Menu menu = event.getMenu(); - Log.debug("Header Menu add"); final int colIndex = event.getColumnIndex(); - final SelectionHandler handlerHeaderContextMenu = new SelectionHandler() { + SelectionHandler handlerHeaderContextMenu = new SelectionHandler() { public void onSelection(SelectionEvent event) { Log.debug("Selected: " @@ -368,7 +385,7 @@ public class TabularDataXGridPanel extends ContentPanel { Log.debug("Event instanceof MenuItem"); MenuItem menuItem = (MenuItem) event .getSelectedItem(); - if (items.contains(menuItem)) { + if (headerColumnMenuItems.contains(menuItem)) { Log.debug("Event Fire on EventBus"); eventBus.fireEvent(new GridHeaderColumnMenuItemEvent( GridHeaderColumnMenuItemType.SELECTED, @@ -379,17 +396,24 @@ public class TabularDataXGridPanel extends ContentPanel { } } }; - + menu.addSelectionHandler(handlerHeaderContextMenu); Log.debug("Adding Items to menu"); - for (MenuItem m : items) { + for (MenuItem m : headerColumnMenuItems) { menu.add(m); } menu.show(); } - }); + }; + Log.debug("Created Handler"); + grid.addHeaderContextMenuHandler(headerContextMenuHandler); + Log.debug("Header Column Menu Added"); + } + + + }