Package de.chris_soft.fyllgen.data

Examples of de.chris_soft.fyllgen.data.Relationship


   */
  private boolean mergeParentChildRelation(RelationshipParentChild mergeRelationship) {
    // Zu dieser Verbindung die Original-Verbindung ermitteln.
    Person p1 = Family.instance.getPersonFromXREFID(mergeRelationship.partner1.getXREFID());
    Person p2 = Family.instance.getPersonFromXREFID(mergeRelationship.partner2.getXREFID());
    Relationship originalRelationship = p1.getRelationship(p2);

    // Falls es bisher keine Beziehung gab, dann fragen, ob man sie �bernehmen
    // soll.
    if (originalRelationship == null) {
      String question = "Soll die Eltern-Kind-Beziehung zwischen\r\n\r\n" + p1 + "\r\nund\r\n" + p2 + "\r\n\r\n";
      question += "mit dem Status \"" + mergeRelationship.getTypeText() + "\" �bernommen werden?";
      int answer = SwtUtilities.askYesNoCancel(GUI.instance.shell, question);
      if (answer == SWT.YES) {
        RelationshipParentChild rpc = p1.addChild(p2);
        rpc.setValue(Relationship.TYPE, mergeRelationship.getType());
        Family.instance.setCurrentPerson(p2, 2);
        Statics.mergeFamily.removeRelationship(mergeRelationship);
      }
      else if (answer == SWT.NO) {
        Statics.mergeFamily.removeRelationship(mergeRelationship);
      }
      return answer != SWT.CANCEL;
    }

    // Falls beide identisch sind, brauchen wir hier keinen Dialog mehr.
    if (compareRelationships(mergeRelationship, originalRelationship)) {
      // SwtUtilities.sayInfo(Consts.getGui().shell,
      // "Identische Beziehung zwischen "
      // + p1 + " und " + p2 + " wird gel�scht.");
      Statics.mergeFamily.removeRelationship(mergeRelationship);
      return true;
    }

    // Fragen, ob der Typ ge�ndert werden soll.
    String question = "Die Eltern-Kind-Beziehung zwischen\r\n\r\n" + originalRelationship.partner1 + "\r\nund\r\n";
    question += originalRelationship.partner2 + "\r\n\r\nhat zur Zeit den Status\r\n\r\n"
        + originalRelationship.getTypeText() + ".";
    question += "\r\n\r\n Soll dieser Status den neuen Daten gem�� auf\r\n\r\n" + mergeRelationship.getTypeText()
        + "\r\n\r\nge�ndert werden?";
    int answer = SwtUtilities.askYesNoCancel(GUI.instance.shell, question);
    if (answer == SWT.YES) {
      originalRelationship.setValue(Relationship.TYPE, mergeRelationship.getType());
    }
    if (answer != SWT.CANCEL) {
      Statics.mergeFamily.removeRelationship(mergeRelationship);
    }
    return answer != SWT.CANCEL;
View Full Code Here

TOP

Related Classes of de.chris_soft.fyllgen.data.Relationship

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.