package info.bukova.isspst.ui.renderers;

import info.bukova.isspst.data.Requirement;
import info.bukova.isspst.data.RequirementState;

import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;

@SuppressWarnings("serial")
public class RequirementsItemRenderer extends GenericListitemRenderer<Requirement>
{
	@Override
	protected void changeProperties(Listbox lb, Listitem li, int index, String varnm)
	{
		Requirement requirement = this.getObjectOfStates();
		RequirementState state = requirement.getState();

		if (state != null)
		{
			if (state == RequirementState.PARTIALLY)
			{
				li.setSclass("req-select-partially");
			}
			else if (state == RequirementState.APPROVED)
			{
				Boolean isProject = requirement.getProject();

				if ((isProject != null) && (isProject.booleanValue() == true))
				{
					li.setSclass("req-select-approved-project");
				}
				else
				{
					li.setSclass("req-select-approved");
				}
			}
		}
	}
}
