Example #1
0
  /**
   * Die Methode initialisiert Text Areas
   *
   * @return gui.CTex_TextArea
   */
  private TextArea getTextArea(
      boolean isRequired,
      final String typeName,
      Undomanager manager,
      final JButton addObject,
      final JButton addCondition) {

    final TextArea TextArea;
    ContainerAttribute e = null;
    Vector<ContainerAttribute> attV = new Vector<ContainerAttribute>();
    if (obj != null) {
      // wenn ein aus Objekt
      if (entryTypeKeyVar == typeName) {
        attV.add(
            new ContainerAttribute(-1, -1, obj.getKey(), false, new Vector<ContainerAttribute>()));
        TextArea = new TextArea(theDb, entryTypeKeyVar, attV, this);

      } else {
        Vector<ContainerAttribute> v = obj.getAttributes();
        Iterator<ContainerAttribute> i = v.iterator();
        // load Attribute
        attV.clear();
        while (i.hasNext()) {
          e = i.next();
          if (theDb.convTypeIdToTypeName(e.getObjectTypeId()).equals(typeName)) {
            attV.add(e);
          }
        }
        // if has Value or not
        if (attV.size() != 0) {
          TextArea =
              new TextArea(
                  theDb, theDb.convTypeIdToTypeName(attV.get(0).getObjectTypeId()), attV, this);
        } else {
          attV.add(
              new ContainerAttribute(
                  -1,
                  theDb.convTypeNameToTypeId(typeName),
                  "",
                  false,
                  new Vector<ContainerAttribute>()));
          TextArea = new TextArea(theDb, typeName, attV, this);
        }
      }
    } else {
      TextArea = new TextArea(theDb, typeName, attV, this);
    }

    // action of addObject "Objecte werden Gelb markiert und Links Weis"
    addObject.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent obj) {
            TextArea.setObject();
          }
        });

    // action of addCondition "Condition werden Grun markiert"
    addCondition.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent con) {
            TextArea.addCondition();
          }
        });

    if (!isRequired) {
      OptField.add(TextArea);
      addTextFieldOpt(OptField.get(OptField.size() - 1), manager);
      this.OptAreaId++;
    } else {
      ReqField.add(TextArea);
      addTextFieldReq(ReqField.get(ReqField.size() - 1), manager);
      this.ReqAreaId++;
    }

    // Save TextAreas for AutoGeneration Key
    if (typeName.equals("author")) {
      this.autor = TextArea;
    } else if (typeName.equals("year")) {
      this.year = TextArea;
    }

    return TextArea;
  }