package com.rjconsultores.ventaboletos.web.utilerias.menu;

import java.util.HashMap;
import java.util.Map;

import org.zkoss.zk.ui.Desktop;

import com.rjconsultores.ventaboletos.web.utilerias.menu.labellocator.MenuLabelLocator;
import com.rjconsultores.ventaboletos.web.utilerias.menu.labellocator.ZKMenuLabelLocator;

public class DefaultItemMenuSistema implements ItemMenuSistema {
	protected String claveTraduccionMenu;
	protected MenuLabelLocator menuLabelLocator;
	protected Desktop desktop;
	protected Boolean isReadOnly;

	public DefaultItemMenuSistema(String claveTraduccionMenu) {
		this.menuLabelLocator = ZKMenuLabelLocator.getInstance();
		this.claveTraduccionMenu = claveTraduccionMenu;

	}

	public DefaultItemMenuSistema(String claveTradiccionMenu, MenuLabelLocator menuLabelLocator) {
		this.menuLabelLocator = menuLabelLocator;
		this.claveTraduccionMenu = claveTradiccionMenu;

	}

	@Override
	public String getDescItemMenu() {
		if (claveTraduccionMenu != null) {
			String valor = menuLabelLocator.getLabel(claveTraduccionMenu);
			return (valor == null) ? "--" : valor;
		}
		return "--";
	}

	@Override
	public void ejecutar() {
	}

	@Override
	public String getClaveMenu() {
		return "";
	}

	@Override
	public void setDesktop(Desktop desktop) {
		this.desktop = desktop;

	}

	@Override
	public Desktop getDesktop() {
		return desktop;
	}
	@Override
	public Boolean getIsReadOnly() {
		return isReadOnly;
	}

	@Override
	public void setIsReadOnly(Boolean isReadOnly) {
		this.isReadOnly = isReadOnly;
	}

	@Override
	public Map getArgs() {
		HashMap<String, Boolean> map = new HashMap<String, Boolean>();
		map.put("isReadOnly", getIsReadOnly());
		return map;
	}
	
}
