/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rjconsultores.ventaboletos.web.utilerias.render;

import com.rjconsultores.ventaboletos.entidad.TarifaMinima;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;

/**
 *
 * @author rodrigo
 */
public class RenderTarifaMinima implements ListitemRenderer {

    public void render(Listitem lstm, Object o) throws Exception {
        TarifaMinima tm = (TarifaMinima) o;

        Listcell lc;


        lc = new Listcell(tm.getTarifaminimaId().toString());
        lc.setParent(lstm);

        if (tm.getImportetarifa() != null) {
            lc = new Listcell(tm.getImportetarifa().setScale(2).toString());
        } else {
            lc = new Listcell("");
        }
        lc.setParent(lstm);

        if (tm.getMarca() != null) {
            lc = new Listcell(tm.getMarca().getDescmarca());
        } else {
            lc = new Listcell("");
        }
        lc.setParent(lstm);
        
        if (tm.getOrgaoConcedente() != null) {
            lc = new Listcell(tm.getOrgaoConcedente().getDescOrgao());
        } else {
            lc = new Listcell("");
        }
        lc.setParent(lstm);

        if (tm.getOrigem() != null) {
            lc = new Listcell(tm.getOrigem().getDescparada());
        } else {
            lc = new Listcell("");
        }
        lc.setParent(lstm);

        if (tm.getDestino() != null) {
            lc = new Listcell(tm.getDestino().getDescparada());
        } else {
            lc = new Listcell("");
        }
        lc.setParent(lstm);

        if (tm.getClaseServicio() != null) {
            lc = new Listcell(tm.getClaseServicio().getDescclase());
        } else {
            lc = new Listcell("");
        }
        lc.setParent(lstm);

        if (tm.getPlaza() != null) {
            lc = new Listcell(tm.getPlaza().getNombplaza());
        } else {
            lc = new Listcell("");
        }
        lc.setParent(lstm);

        if (tm.getMoneda() != null) {
            lc = new Listcell(tm.getMoneda().getDescmoneda());
        } else {
            lc = new Listcell("");
        }
        lc.setParent(lstm);

        lstm.setAttribute("data", tm);
    }
}
