Example #1
0
  /** builds the UI */
  protected final void build() {
    tabbedPane = new JTabbedPane();

    propertiesMerger = new PropertiesMerger();
    propertiesMerger.setName("panel.propertiesmerger");
    propertiesMerger.getModel().addPropertyChangeListener(this);
    tabbedPane.add(tr("Properties"), propertiesMerger);

    tagMerger = new TagMerger();
    tagMerger.setName("panel.tagmerger");
    tagMerger.getModel().addPropertyChangeListener(this);
    tabbedPane.add(tr("Tags"), tagMerger);

    nodeListMerger = new NodeListMerger();
    nodeListMerger.setName("panel.nodelistmerger");
    nodeListMerger.getModel().addPropertyChangeListener(this);
    tabbedPane.add(tr("Nodes"), nodeListMerger);

    relationMemberMerger = new RelationMemberMerger();
    relationMemberMerger.setName("panel.relationmembermerger");
    relationMemberMerger.getModel().addPropertyChangeListener(this);
    tabbedPane.add(tr("Members"), relationMemberMerger);

    setLayout(new BorderLayout());
    add(tabbedPane, BorderLayout.CENTER);

    conflictResolvers.add(propertiesMerger);
    conflictResolvers.add(tagMerger);
    conflictResolvers.add(nodeListMerger);
    conflictResolvers.add(relationMemberMerger);
  }
Example #2
0
 /** Updates the state of the property {@link #RESOLVED_COMPLETELY_PROP} */
 protected void updateResolvedCompletely() {
   boolean oldValueResolvedCompletely = resolvedCompletely;
   if (my instanceof Node) {
     // resolve the version conflict if this is a node and all tag
     // conflicts have been resolved
     //
     this.resolvedCompletely =
         tagMerger.getModel().isResolvedCompletely()
             && propertiesMerger.getModel().isResolvedCompletely();
   } else if (my instanceof Way) {
     // resolve the version conflict if this is a way, all tag
     // conflicts have been resolved, and conflicts in the node list
     // have been resolved
     //
     this.resolvedCompletely =
         tagMerger.getModel().isResolvedCompletely()
             && propertiesMerger.getModel().isResolvedCompletely()
             && nodeListMerger.getModel().isFrozen();
   } else if (my instanceof Relation) {
     // resolve the version conflict if this is a relation, all tag
     // conflicts and all conflicts in the member list
     // have been resolved
     //
     this.resolvedCompletely =
         tagMerger.getModel().isResolvedCompletely()
             && propertiesMerger.getModel().isResolvedCompletely()
             && relationMemberMerger.getModel().isFrozen();
   }
   if (this.resolvedCompletely != oldValueResolvedCompletely) {
     firePropertyChange(
         RESOLVED_COMPLETELY_PROP, oldValueResolvedCompletely, this.resolvedCompletely);
   }
 }
Example #3
0
  /**
   * populates the conflict resolver with the conflicts between my and their
   *
   * @param conflict the conflict data set
   */
  public void populate(Conflict<? extends OsmPrimitive> conflict) {
    setMy(conflict.getMy());
    setTheir(conflict.getTheir());
    this.conflict = conflict;
    propertiesMerger.populate(conflict);

    tabbedPane.setEnabledAt(0, true);
    tagMerger.populate(conflict);
    tabbedPane.setEnabledAt(1, true);

    if (my instanceof Node) {
      tabbedPane.setEnabledAt(2, false);
      tabbedPane.setEnabledAt(3, false);
    } else if (my instanceof Way) {
      nodeListMerger.populate(conflict);
      tabbedPane.setEnabledAt(2, true);
      tabbedPane.setEnabledAt(3, false);
      tabbedPane.setTitleAt(3, tr("Members"));
      tabbedPane.setIconAt(3, null);
    } else if (my instanceof Relation) {
      relationMemberMerger.populate(conflict);
      tabbedPane.setEnabledAt(2, false);
      tabbedPane.setTitleAt(2, tr("Nodes"));
      tabbedPane.setIconAt(2, null);
      tabbedPane.setEnabledAt(3, true);
    }
    updateResolvedCompletely();
    selectFirstTabWithConflicts();
  }
Example #4
0
  /**
   * Builds the resolution command(s) for the resolved conflicts in this ConflictResolver
   *
   * @return the resolution command
   */
  public Command buildResolveCommand() {
    List<Command> commands = new ArrayList<>();

    if (tagMerger.getModel().getNumResolvedConflicts() > 0) {
      commands.add(tagMerger.getModel().buildResolveCommand(conflict));
    }
    commands.addAll(propertiesMerger.getModel().buildResolveCommand(conflict));
    if (my instanceof Way && nodeListMerger.getModel().isFrozen()) {
      NodeListMergeModel model = (NodeListMergeModel) nodeListMerger.getModel();
      commands.add(model.buildResolveCommand(conflict));
    } else if (my instanceof Relation && relationMemberMerger.getModel().isFrozen()) {
      RelationMemberListMergeModel model =
          (RelationMemberListMergeModel) relationMemberMerger.getModel();
      commands.add(model.buildResolveCommand((Relation) my, (Relation) their));
    }
    if (isResolvedCompletely()) {
      commands.add(new VersionConflictResolveCommand(conflict));
      commands.add(new ModifiedConflictResolveCommand(conflict));
    }
    return new SequenceCommand(tr("Conflict Resolution"), commands);
  }