Lookup Manager

The Lookup Manager supervises the specialized Managers, and keeps the Lookup list...

LookupManager
+ LookupManager(MainScreen)
+ performAction(BaseAction, ActionEvent)
+ addLookup(Lookup)
+ getAllLinesDialog(AllLine[]) : AllLinesDialog
+ getQuestionDialog(Question[]) : QuestionDialog
+ getVehicleDialog(VehicleManager) : VehicleDialog
+ handleTabChange(int)
+ saveAndExit()
PartsLookupManager
+ PartsLookupManager(LookupManager)
+ performAction(BaseAction, ActionEvent)
+ doNewLookup()
+ doOldLookup(PartsLookup)
LaborLookupManager
+ LaborLookupManager(LookupManager)
+ performAction(BaseAction, ActionEvent)
+ doNewLookup()
+ doOldLookup(LaborLookup)
InterLookupManager
+ InterLookupManager(LookupManager)
+ performAction(BaseAction, ActionEvent)
+ doNewLookup()
+ doOldLookup(InterLookup)

Lookup Manager...

public class LookupManager implements ActionHandler {

    private List               lookupList;
    private int                lookupIndex = -1;

...handles a few actions...

    public void performAction(BaseAction action, ActionEvent event) {
        switch (action.getID()) {
        case LOOKUP_NEW:       doLookupDialog(true);   break;
        case LOOKUP_CHANGE:    doLookupDialog(false);  break;
        case LOOKUP_BACK:      doLookupBack();         break;
        case LOOKUP_FORWARD:   doLookupFore();         break;
        case LOOKUP_PREVIOUS:  doLookupPrev();         break;
        case LOOKUP_EXIT:      saveAndExit();          break;

        default: mainScreen.performAction(action, event); break;
        }
    }

...keeps a list of previous lookups...

    public void addLookup(Lookup lookup) {
        lookupList.add(0, lookup.makeCopy());
    }

    private void doLookupBack() {
        doLookupByIndex(lookupIndex + 1);
    }

    private void doLookupFore() {
        doLookupByIndex(lookupIndex - 1);
    }

    private void doLookupByIndex(int newIndex) {

        lookupIndex = newIndex;

        Lookup lookup = (Lookup) lookupList.get(lookupIndex);

        switch (lookup.getType()) {
        case Lookup.PARTS_TYPE :
            mainScreen.handleTabChange(TabPaneManager.PART_EXPERT_INDEX);
            partsLookupManager.doOldLookup((PartsLookup) lookup.makeCopy());
            break;
        case Lookup.LABOR_TYPE :
            // and so on...
    }

...manages the lookup dialogs...

    private void doLookupPrev() {

        PreviousDialog dialog = new PreviousDialog(mainScreen, lookupList);

        dialog.setVisible(true);

        if (!dialog.canceled()) {
            return;
        }

        doLookupByIndex(dialog.getSelectedLookupIndex());
    }

...and persists the lookup list...

    private void saveLookupList() {

        try {
            FileOutputStream   fos = new FileOutputStream(lookupListFile);
            ObjectOutputStream oos = new ObjectOutputStream(fos);

            oos.writeObject(lookupList);
            oos.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    private List loadLookupList() {

        if (lookupListFile.exists()) {
            try {
                FileInputStream   fis = new FileInputStream(lookupListFile);
                ObjectInputStream ois = new ObjectInputStream(fis);

                return (List) ois.readObject();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        return new LinkedList();
    }
}