package tmcsim.client.cadclientgui.screens;

import javax.swing.table.DefaultTableCellRenderer;

/**
 * This is a quick hack to meet a specific customer request.
 * The customer desires that incident number 100 be displayed as "Media".
 * This TableCellRenderer is used for Integer fields in the table
 * (of which there is currently only one: the incident number).
 * When displaying any Integers in the table this class will be used.
 * It simply filters for the special case of the number 100
 * and changes it to the string "Media".
 * @author jdalbey
 * @version 2019.3.2
 */
class IncidentNumberRenderer extends DefaultTableCellRenderer {
    public IncidentNumberRenderer() { super(); }

    public void setValue(Object value) 
    {
        super.setValue(value);
        // Change 100 to "Media"
        if (value != null && value.equals(new Integer(100)))
        { 
            setText("Media");
        }
    }
}    