Minor updated

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/portlets/user/tabular-data-widgetx@86966 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Giancarlo Panichi 2013-12-16 11:59:26 +00:00 committed by Giancarlo Panichi
parent 98d8ae4fd5
commit e04e901683
4 changed files with 49 additions and 21 deletions

View File

@ -17,12 +17,16 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/tabular-data-widgetx-1.0.0-SNAPSHOT/WEB-INF/classes"/>
</classpath>

View File

@ -16,12 +16,12 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>

View File

@ -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

View File

@ -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<MenuItem> items;
protected List<MenuItem> headerColumnMenuItems;
protected EventBus externalBus;
protected com.google.web.bindery.event.shared.EventBus externalBus;
protected Grid<DataRow> 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<MenuItem> items, EventBus externalBus) {
this.items = items;
public void addGridHeaderContextMenuItems(final List<MenuItem> items,
com.google.web.bindery.event.shared.EventBus externalBus) {
this.headerColumnMenuItems = items;
this.externalBus=externalBus;
}
/**
*
*/
protected void setHeaderContextMenuHandler(){
HeaderContextMenuHandler headerContextMenuHandler=new HeaderContextMenuEvent.HeaderContextMenuHandler() {
grid.addHeaderContextMenuHandler(new 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<Item> handlerHeaderContextMenu = new SelectionHandler<Item>() {
SelectionHandler<Item> handlerHeaderContextMenu = new SelectionHandler<Item>() {
public void onSelection(SelectionEvent<Item> 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,
@ -383,13 +400,20 @@ 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");
}
}