Package clips.service.newSerRen

Source Code of clips.service.newSerRen.TableCellRendererNewSerRen

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package clips.service.newSerRen;

import clips.delegate.directory.filtered.DirectoryServiceItem;
import cli_fmw.utils.DefaultColors;
import cli_fmw.utils.sorted_table.renderer.LabelRenderer;
import java.util.ArrayList;
import java.util.HashMap;
import javax.swing.JTable;

/**
*
* @author vip
*/
public class TableCellRendererNewSerRen extends LabelRenderer {

    private HashMap<Integer, Integer> forceDiscountMap;

    public TableCellRendererNewSerRen(HashMap<Integer, Integer> forceDiscountMap) {
        this.forceDiscountMap = forceDiscountMap;
    }
   
    @Override
    public void modifyErrorTableCellRendererComponent(JTable table, Object value, int row, int column) {
        TableModelServiceList tmsl = null;
        if (table.getModel() instanceof TableModelServiceList) {
            tmsl = (TableModelServiceList) table.getModel();
                   
            if (column == TableModelServiceList.COL_DISCOUNT) {
                DirectoryServiceItem service = tmsl.getService(row);
                Integer forceDiscount = forceDiscountMap.get(service.getID());
                if (forceDiscount != null) {
                    render().setBackground(DefaultColors.FIELD_TO_INPUT);
                    render().setText(value.toString() + " (вруч.)");
                }
            }
        }
    }
}
TOP

Related Classes of clips.service.newSerRen.TableCellRendererNewSerRen

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.