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

import java.util.ArrayList;
import java.util.List;

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

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

/**
 * Defines the menu for column on the grid
 * 
 * @author "Giancarlo Panichi" 
 * <a href="mailto:g.panichi@isti.cnr.it">g.panichi@isti.cnr.it</a> 
 *
 */
public class GridHeaderColumnMenu {

	protected final ArrayList<MenuItem> menuItems;

	public GridHeaderColumnMenu() {
		menuItems = new ArrayList<MenuItem>();
		
		
		MenuItem changeLabelItem = new MenuItem("Change Label");
		changeLabelItem.setId(GridHeaderOperationId.ChangeLabel
				.toString());
		changeLabelItem.setIcon(TabularDataResources.INSTANCE.columnLabel());
		menuItems.add(changeLabelItem);
		
		MenuItem removeColumnItem = new MenuItem("Remove");
		removeColumnItem.setId(GridHeaderOperationId.RemoveColumn.toString());
		removeColumnItem.setIcon(TabularDataResources.INSTANCE.columnDelete());	
		menuItems.add(removeColumnItem);

		
		MenuItem changeToTypeItem = new MenuItem("Change Type");
		changeToTypeItem.setId(GridHeaderOperationId.ChangeToType.toString());
		changeToTypeItem.setIcon(TabularDataResources.INSTANCE.columnType());	
		menuItems.add(changeToTypeItem);

		MenuItem filterItem = new MenuItem("Filter");
		filterItem.setId(GridHeaderOperationId.Filter.toString());
		filterItem.setIcon(TabularDataResources.INSTANCE.columnFilter());	
		menuItems.add(filterItem);
		
		MenuItem modifyValueOnConditionItem = new MenuItem("Modify Value On Condition");
		modifyValueOnConditionItem.setId(GridHeaderOperationId.ModifyColumnValueOnCondition.toString());
		modifyValueOnConditionItem.setIcon(TabularDataResources.INSTANCE.columnValues());	
		menuItems.add(modifyValueOnConditionItem);
		
		MenuItem newAnnotationColumnItem = new MenuItem("New Annotation");
		newAnnotationColumnItem.setId(GridHeaderOperationId.NewAnnotationColumn.toString());
		newAnnotationColumnItem.setIcon(TabularDataResources.INSTANCE.columnAdd());	
		menuItems.add(newAnnotationColumnItem);
		
		MenuItem columnDuplicateValidationItem = new MenuItem("Duplicate Validation");
		columnDuplicateValidationItem.setId(GridHeaderOperationId.ColumnDuplicateValidation.toString());
		columnDuplicateValidationItem.setIcon(TabularDataResources.INSTANCE.validateAdd());	
		menuItems.add(columnDuplicateValidationItem);
		

		
	}

	/**
	 * 
	 * @return the list of menu items to be added
	 */
	public List<MenuItem> getMenu() {
		return menuItems;
	}
}
