Heterogeneous Data

Because the data lists contain heterogeneous data...

Manufacturer
+ Manufacturer(String, String, String)
+ getRedLineText() : String

Description
+ Description(String, String, String, String)
+ getRedLineText() : String

Header
+ Header(String[])
+ getFields() : String[]
Part
+ isPosted() : boolean
+ getLineNumber() : int
+ hasC2C() : boolean
+ getPerCarQty() : String
+ getPartNumber() : String
+ getDescription() : String
... more

...a multi cell renderer selects the appropriate renderer for each object.

MultiCellRenderer
- renderers : Map
+ add(Class, ListCellRenderer)
+ getListCellRendererComponent
      (JList, Object, int, boolean, boolean) : Component

HeaderRenderer
+ createLeftRenderer(int[]) : HeaderRenderer
+ createRightRenderer() : HeaderRenderer
+ getListCellRendererComponent
      (JList, Object, int, boolean, boolean) : Component
+ setValue(Object)

PartsRenderer
+ PartsRenderer(int[])
# getRowHeight(Object) : int
+ getListCellRendererComponent
      (JList, Object, int, boolean, boolean) : Component

class MultiCellRenderer implements ListCellRenderer {

    private Map renderers = new HashMap();

    public void add(Class valueClass, ListCellRenderer renderer) {
        renderers.put(valueClass, renderer);
    }

    public Component getListCellRendererComponent(JList list...
        ListCellRenderer renderer = null;

        Iterator i = renderers.keySet().iterator();

        while (i.hasNext()) {
            Class key = (Class) i.next();
            if (key.isInstance(value)) {
                renderer = (ListCellRenderer) renderers.get(key);
                break;
            }
        }

        return renderer.getListCellRendererComponent
                 (list, value, index, isSelected, hasFocus);
    }

}