public Element getLookupElement() {
    Element e = new Element("lookup");
    if (saveErrors.size() != 0) {
      saveErrors.clear();
    }
    ObjEntityView view = objEntityViewField.getObjEntityView();
    DataView dataView = view.getDataView();
    String fieldPath =
        "<b>"
            + dataView.getName()
            + "."
            + view.getName()
            + "."
            + objEntityViewField.getName()
            + "</b><br>";
    if (lookupObjEntityView != null) {
      e.setAttribute(new Attribute("obj-entity-view-name", lookupObjEntityView.getName()));
    } else {
      e.setAttribute(new Attribute("obj-entity-view-name", ""));
      saveErrors.add(fieldPath + "lookup hasn't attribute \"obj-entity-view-name\"<br><br>");
    }
    if (lookupField != null) {
      e.setAttribute(new Attribute("field-name", lookupField.getName()));
    } else {
      e.setAttribute(new Attribute("field-name", ""));
      saveErrors.add(fieldPath + "lookup hasn't attribute \"field-name\"<br><br>");
    }
    e.addContent("");

    return e;
  }
  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);
    }
  }
  public String toString() {
    String resultString = "";
    if (lookupObjEntityView != null) {
      resultString += lookupObjEntityView.getName();
    }

    if (lookupField != null) {
      resultString += "." + lookupField.getName();
    } else {
      resultString += "";
    }
    return resultString;
  }