private void lookupViewComboAction(ActionEvent e) { ObjEntityView fieldLookupView = objEntityViewField.getLookup().getLookupObjEntityView(); ObjEntityView selectedLookupView = (ObjEntityView) lookupViewCombo.getSelectedItem(); if (selectedLookupView != fieldLookupView) { objEntityViewField.getLookup().setLookupObjEntityView(selectedLookupView); dataViewTreeModel.fieldChanged(objEntityViewField); dataMapTreeModel.fieldChanged(objEntityViewField); fieldsTableModel.fireTableCellUpdated( objEntityViewField.getObjEntityView().getIndexOfObjEntityViewField(objEntityViewField), 4); } if (selectedLookupView != null) { ObjEntityViewField nullField = null; java.util.List lookupFields = new ArrayList(); lookupFields.add(nullField); lookupFields.addAll(selectedLookupView.getObjEntityViewFields()); DefaultComboBoxModel lookupFieldsDefaultModel = new DefaultComboBoxModel(lookupFields.toArray()); lookupFieldCombo.setModel(lookupFieldsDefaultModel); ObjEntityViewField fieldLookupField = objEntityViewField.getLookup().getLookupField(); if (fieldLookupField != null) { boolean flagSetSelectedItem = false; for (Iterator itr = lookupFields.iterator(); itr.hasNext(); ) { ObjEntityViewField field = (ObjEntityViewField) itr.next(); if ((field != null) && (fieldLookupField.getName().equals(field.getName()))) { lookupFieldCombo.setSelectedItem(fieldLookupField); flagSetSelectedItem = true; break; } } if (!flagSetSelectedItem) { lookupFieldCombo.setSelectedIndex(0); } } else { lookupFieldCombo.setSelectedIndex(0); } } else { ObjEntityViewField nullField = null; ObjEntityViewField[] fields = new ObjEntityViewField[] {nullField}; DefaultComboBoxModel fieldsModel = new DefaultComboBoxModel(fields); lookupFieldCombo.setModel(fieldsModel); lookupFieldCombo.setSelectedIndex(0); } }
private void lookupFieldComboAction(ActionEvent e) { ObjEntityViewField fieldLookupField = objEntityViewField.getLookup().getLookupField(); ObjEntityViewField selectedLookupField = (ObjEntityViewField) lookupFieldCombo.getSelectedItem(); if (selectedLookupField != fieldLookupField) { objEntityViewField.getLookup().setLookupField(selectedLookupField); dataViewTreeModel.fieldChanged(objEntityViewField); dataMapTreeModel.fieldChanged(objEntityViewField); fieldsTableModel.fireTableCellUpdated( objEntityViewField.getObjEntityView().getIndexOfObjEntityViewField(objEntityViewField), 4); } }