/*
* 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() + " (вруч.)");
}
}
}
}
}