package com.acme.vcutil.supplier;

import com.acme.model.domain.sc.entity.Section;
import com.acme.structure.util.ConversionUtil;
import com.acme.structure.util.datalist.CriteriaListSupplier;

public class TableForSectionSupplier extends CriteriaListSupplier
{
    public TableForSectionSupplier(boolean blankItemApplied, Object criteria)
    {
        super(blankItemApplied, criteria);
    }

    public TableForSectionSupplier(Object criteria)
    {
        super(criteria);
    }

    @Override
    public void loadList(Object criteria)
    {
        try
        {
            clearList();
            if(criteria==null)
                return;
            Section section = (Section)criteria;
            list.addAll(section.getTables());
            itemList.addAll(ConversionUtil.getConvertedToSelectItemList(list, isBlankItemApplied()));
        }
        catch (Exception exc)
        {
            System.out.println(exc.toString());
        }
    }

    public String getListName()
    {
        return "tablesforsection";
    }

    protected boolean isEmptyCriteriaAccepted()
    {
        return true;
    }
}

