public class GridContextMenu { private final Menu mainMenu = new Menu(); private final MenuItem leftItem = new MenuItem(ColumnMappingConstants.RIGHT_MENUITEM_TITLE); private final MenuItem rightItem = new MenuItem(ColumnMappingConstants.LEFT_MENUITEM_TITLE); private final MenuItem delItem = new MenuItem(ColumnMappingConstants.DELTE_MENUITEM_TITLE); private MatchOutputGrid matchGrid; private MatchConfigurationGridLayout matchConfigurationGridLayout; public GridContextMenu(MatchOutputGrid aMatchGrid, MatchConfigurationGridLayout aMatchConfigurationGridLayout) { this.matchGrid = aMatchGrid; setContextMenuHandlers(); } public void enableContextMenu(boolean leftFlag, boolean rightFlag, boolean deleteFlag) { leftItem.setEnabled(leftFlag); rightItem.setEnabled(rightFlag); delItem.setEnabled(deleteFlag); } public final void setContextMenuHandlers() { mainMenu.setVisibility(Visibility.VISIBLE); mainMenu.setAlign(Alignment.CENTER); leftItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() { public void onClick(MenuItemClickEvent event) { mainMenu.hide(); matchGrid.popUpMappedColumns(matchGrid.getSelectedRecord(), AppConstants.STR_RIGHT); } }); rightItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() { public void onClick(MenuItemClickEvent event) { mainMenu.hide(); matchGrid.popUpMappedColumns(matchGrid.getSelectedRecord(), AppConstants.STR_LEFT); } }); delItem.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() { public void onClick(MenuItemClickEvent event) { mainMenu.hide(); ListGridRecord lstRecord = matchGrid.getSelectedRecord(); matchGrid.removeData(lstRecord); matchGrid.fetchData(); } }); mainMenu.setItems(rightItem, leftItem, delItem); matchGrid.setContextMenu(mainMenu); } }