Loading Model Data

The Lookup Manager gets the data from the Server and puts it in the List Model...

PartsServer
+ PartsServer()
+ getParts(boolean, Vehicle, Group) : Object[]
+ getParts(Vehicle, Group, Coverage[]) : Object[]
+ getParts(Vehicle, Group, Manufacturer[]) : Object[]
... more

PartsLookupManager
- partsServer : PartsServer - dataListModel : DataListModel
+ PartsLookupManager()
+ performAction(ActionEvent)
+ doNewLookup()
+ doOldLookup(PartsLookup)
- lookupData((PartsLookup)

DataListModel
+ setData(Object[], String)
+ getElementAt(int) : Object
+ getSize() : int
+ contains(Object) : boolean
+ getDescription() : String
+ getRedLine(int) : Object
+ iterator() : Iterator

public class PartsLookupManager implements ActionHandler {

    private void lookupData(PartsLookup lookup) {

        Object[] data = new Object[0];

        if (lookup.isValid()) {
            boolean primary = lookup.isPrimary();
            Vehicle vehicle = lookup.getVehicle();
            Group   group   = lookup.getGroup();
            
            data = PartsServer.getParts(primary, vehicle, group);
        }

        dataListNodel.setData(data, lookup.toString());
    }
}

... which notifies the List that the data has changed.

public class DataListModel extends AbstractListModel {

    public void setData(Object[] data) {

        int oldLen = elements.size();
        elements = new LinkedList(Arrays.asList(data));
        int newLen = elements.size();

        fireContentsChanged(this, 0, Math.max(oldLen, newLen) - 1);
    }