Esempio n. 1
0
  void update(FormContainer formContainer, List<FormElement> allchildren) {
    // update id
    if (updateId) {
      updateFormContainerId(formContainer);
    }

    if (updateLabel) {
      updateLabel(
          formContainer, ((TitledNamedClassModelElement) formContainer.getRef()).getLabel());
    }

    for (FormElement formElement : allchildren) {
      ModelElement ref = formElement.getRef();
      if (ref instanceof NamedModelElement) {
        NamedModelElement nme = (NamedModelElement) ref;
        String name = nme.getName();

        if (updateId && !name.equals(formElement.getId())) {
          updateId(formElement, name);
        }

        if (updateLabel && ref instanceof TitledNamedClassModelElement) {
          updateLabel(formContainer, ((TitledNamedClassModelElement) ref).getLabel());
        }
      }

      // check Field subType
      if (ref instanceof Attribute) {
        Attribute att = (Attribute) ref;

        updateAttributeFields(formContainer, formElement, att);
      } else if (ref instanceof Association) {

        Association ass = (Association) ref;
        if (formElement instanceof ModelChoiceField) {
          ModelChoiceField mcf = (ModelChoiceField) formElement;
          ClassReference cref = (ClassReference) formContainer;
          AbstractClass srcClazz = cref.getReal_class();
          updateModelChoiceField(srcClazz, ass, mcf);
        }
      }
    }
  }