Dataview: implementing master-datail view with combos. Cache problem ?

From: Andrea Borgogelli Avveduti (borgogell..otmail.com)
Date: Sun Dec 04 2005 - 05:34:06 EST

  • Next message: Mirko Viviani: "Cayenne and EJB3"

    Hello there,
     
    I'm  trying to create a master view details form with 4 comboboxes.

    The following code is from "hr-dataview" example and I have adapted it to my needs.
    If a combo item is selected, the second combo need to be updated to show only some dataobjects.
    (The same for the third and fourth combo)
     
           
     // update view
            // [DATAVIEW EXAMPLE] creating combobox model
            ObjEntityViewField nameField = model.getDepartmentView().getFieldForObjAttribute(
                    "name");
            DOComboBoxModel comboModel = new DOComboBoxModel();
            comboModel.setDataObjects(departments);
            comboModel.setViewField(nameField);
            // using lookup cache to translate between combobox labels and DataObjects.
            nameField.getOwner().getOwner().getLookupCache().cache(nameField, departments);
            view.getDepartmentsCombo().setModel(comboModel);
            rendererFactory.installRenderer(view.getDepartmentsCombo(), nameField);
            view.getConnectButton().setText(MainFrameModel.DISCONNECT_LABEL);
            view.setDepartmentsVisible(true);
            view.setEmployeesVisible(false);
     
     
    I think my problem is in the line:
     
    nameField.getOwner().getOwner().getLookupCache().cache(nameField, departments);
            view.getDepartmentsCombo().setModel(comboModel);
     
    Because if I use cache, I can't update every combo but only one pick list.
    The question is, what can I use instead of that method ? (No need to chache at all)

    Thank u in advance
     
    Andrea
     



    This archive was generated by hypermail 2.0.0 : Sun Dec 04 2005 - 05:34:10 EST