Package clips.contract.info.contractService

Source Code of clips.contract.info.contractService.TableCellRendererContractService

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

import clips.delegate.contract.ContractLocal;
import clips.delegate.contract.ServisePriceData;
import clips.delegate.directory.filtered.DirectoryServiceItem;
import cli_fmw.main.ClipsException;
import cli_fmw.utils.DefaultColors;
import cli_fmw.utils.sorted_table.renderer.LabelRenderer;
import clips.delegate.directory.simple.receptionType.DirectoryReceptionTypeItem;
import framework.utils.Pair;
import javax.swing.JTable;

/**
*
* @author ViP
*/
public class TableCellRendererContractService extends LabelRenderer {

    ContractLocal contract;                                 //Договор

    public TableCellRendererContractService(ContractLocal contract) throws ClipsException {
        this.contract = contract;
    }

    @Override
    public void modifyErrorTableCellRendererComponent(JTable table, Object value, int row, int col) throws ClipsException {
        render().setOpaque(true);
        render().setFont(table.getFont());
       
        TableModelServicePrice tmsp = null;
        if (table.getModel() instanceof TableModelServicePrice){
           
            tmsp = (TableModelServicePrice) table.getModel();

            ServisePriceData servisePriceData = null;
            Pair<DirectoryServiceItem, DirectoryReceptionTypeItem> pair = tmsp.getSerRecType(row);
            render().setIcon(null);
            // Метим невведенные цены зеленым
            if (col == TableModelServicePrice.COL_PRICE) {
                if (servisePriceData != null && servisePriceData.getPrice() < 0) {
                    render().setBackground(DefaultColors.FIELD_TO_INPUT);
                }
            }
            if (col == TableModelServicePrice.COL_MONEY) {
                if (servisePriceData != null && servisePriceData.getMoney() < 0) {
                    render().setBackground(DefaultColors.FIELD_TO_INPUT);
                }
            }
            servisePriceData = contract.getContractService(pair);
            if (servisePriceData == null) {
                render().setForeground(DefaultColors.TABLE_GREED);
            } else {
                render().setForeground(DefaultColors.TABLE_FOREGROUND);
            }
        }
    }
}
TOP

Related Classes of clips.contract.info.contractService.TableCellRendererContractService

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.