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);
    }
  }
  private void calcTypeComboAction(ActionEvent e) {
    String comboCalcType = (String) calcTypeCombo.getSelectedItem();
    ObjEntity objEntity = objEntityViewField.getObjEntityView().getObjEntity();

    if (comboCalcType.equals("No Calculation")) {
      objEntityViewField.setCalcType("nocalc");

      objRelationshipCombo.setEnabled(false);
      lookupViewCombo.setEnabled(false);
      lookupFieldCombo.setEnabled(false);

      ObjAttribute nullAttribute = null;
      java.util.List attributes = new ArrayList();
      attributes.add(nullAttribute);
      if (objEntity != null) {
        attributes.addAll(objEntity.getObjAttributes());
      }

      DefaultComboBoxModel attributesDefaultModel = new DefaultComboBoxModel(attributes.toArray());
      objAttributeCombo.setModel(attributesDefaultModel);
      objAttributeCombo.setEnabled(true);
      if (objEntity != null) {
        if (objEntityViewField.getObjAttribute() != null) {
          objAttributeCombo.setSelectedItem(objEntityViewField.getObjAttribute());
        } else {
          objAttributeCombo.setSelectedIndex(0);
        }
      } else {
        objAttributeCombo.setSelectedIndex(0);
      }
    }
    if (comboCalcType.equals("Lookup")) {
      objEntityViewField.setCalcType("lookup");

      objAttributeCombo.setEnabled(false);
      objRelationshipCombo.setEnabled(true);
      lookupViewCombo.setEnabled(true);
      lookupFieldCombo.setEnabled(true);

      ObjRelationship nullRelationship = null;
      java.util.List relationships = new ArrayList();
      relationships.add(nullRelationship);
      if (objEntity != null) {
        relationships.addAll(objEntity.getDataMap().getObjRelationshipsBySourceToOne(objEntity));
      }

      DefaultComboBoxModel relationshipsDefaultModel =
          new DefaultComboBoxModel(relationships.toArray());
      objRelationshipCombo.setModel(relationshipsDefaultModel);

      ObjRelationship fieldRelationship = objEntityViewField.getObjRelationship();
      if (fieldRelationship != null) {
        boolean flagSetSelectedItem = false;
        for (Iterator itr = relationships.iterator(); itr.hasNext(); ) {
          ObjRelationship relationship = (ObjRelationship) itr.next();
          if ((relationship != null)
              && (fieldRelationship.getName().equals(relationship.getName()))) {
            objRelationshipCombo.setSelectedItem(fieldRelationship);
            flagSetSelectedItem = true;
            break;
          }
        }
        if (!flagSetSelectedItem) {
          objRelationshipCombo.setSelectedIndex(0);
        }
      } else {
        objRelationshipCombo.setSelectedIndex(0);
      }
    }
  }