/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package clips.contract;
import cli_fmw.main.ClipsException;
import cli_fmw.utils.sorted_table.renderer.LabelRenderer;
import clips.delegate.contract.ContractLocal;
import framework.utils.Converter;
import java.awt.Color;
import java.util.Date;
import javax.swing.JTable;
import javax.swing.table.TableModel;
/**
*
* @author finder
*/
public class TableCellRendererContractSearch extends LabelRenderer {
@Override
protected void modifyErrorTableCellRendererComponent(JTable table, Object value, int row, int col) throws ClipsException {
TableModel model = table.getModel();
if (!(model instanceof TableModelContractList)){
return;
}
ContractLocal contract = ((TableModelContractList)model).getRowValue(row);
if (contract.isOpen()){
render().setForeground(table.getForeground());
}
else{
render().setForeground(Color.GRAY);
}
}
@Override
protected void setValue(Object value) {
if (value instanceof Date) {
super.setValue(Converter.dateToString((Date) value));
}
else {
super.setValue(value);
}
}
}