package org.gcube.portlets.user.td.client.grid;

import org.gcube.portlets.user.td.client.resource.TabularDataResources;
import org.gcube.portlets.user.td.widgetcommonevent.shared.GridOperationId;

import com.sencha.gxt.widget.core.client.menu.Menu;
import com.sencha.gxt.widget.core.client.menu.MenuItem;

/**
 * 
 * @author "Giancarlo Panichi" 
 * <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> 
 *
 *	Defines the context menu of grid
 */
public class GridContextMenu {
		protected Menu tableContextMenu;
		
		public GridContextMenu(){
			tableContextMenu=new Menu();
			
			MenuItem editRowItem = new MenuItem("Edit Row");
			editRowItem.setId(GridOperationId.EditRow.toString());
			editRowItem.setIcon(TabularDataResources.INSTANCE.rowEdit());
			tableContextMenu.add(editRowItem);			
			
			MenuItem addRowItem = new MenuItem("Add Row");
			addRowItem.setId(GridOperationId.EditRow.toString());
			addRowItem.setIcon(TabularDataResources.INSTANCE.rowInsert());
			tableContextMenu.add(addRowItem);			
			
			MenuItem removeRowItem = new MenuItem("Remove Row");
			removeRowItem.setId(GridOperationId.EditRow.toString());
			removeRowItem.setIcon(TabularDataResources.INSTANCE.rowRemove());
			tableContextMenu.add(removeRowItem);			
			
		}
		
		/**
		 * 
		 * @return context menu for grid
		 */
		public Menu getMenu(){
			return tableContextMenu;
		}
}
