private void objRelationshipComboAction(ActionEvent e) { ObjRelationship selectedObjRelationship = (ObjRelationship) objRelationshipCombo.getSelectedItem(); ObjRelationship fieldObjRelationship = objEntityViewField.getObjRelationship(); if (selectedObjRelationship != fieldObjRelationship) { objEntityViewField.setObjRelationship(selectedObjRelationship); } if (selectedObjRelationship != null) { ObjEntity targetObjEntity = selectedObjRelationship.getTargetObjEntity(); ObjEntityView nullView = null; java.util.List lookupViews = new ArrayList(); lookupViews.add(nullView); lookupViews.addAll(targetObjEntity.getObjEntityViews()); DefaultComboBoxModel lookupViewModel = new DefaultComboBoxModel(lookupViews.toArray()); lookupViewCombo.setModel(lookupViewModel); ObjEntityView fieldLookupView = objEntityViewField.getLookup().getLookupObjEntityView(); if (fieldLookupView != null) { boolean flagSetSelectedItem = false; for (Iterator itr = lookupViews.iterator(); itr.hasNext(); ) { ObjEntityView view = (ObjEntityView) itr.next(); if (fieldLookupView == view) { lookupViewCombo.setSelectedItem(fieldLookupView); flagSetSelectedItem = true; break; } } if (!flagSetSelectedItem) { lookupViewCombo.setSelectedIndex(0); } } else { lookupViewCombo.setSelectedIndex(0); } } else { ObjEntityView nullView = null; ObjEntityView[] views = new ObjEntityView[] {nullView}; DefaultComboBoxModel viewsModel = new DefaultComboBoxModel(views); lookupViewCombo.setModel(viewsModel); lookupViewCombo.setSelectedIndex(0); } }