/** * Populates the turn restriction editor model with a turn restriction. {@code turnRestriction} is * an arbitrary relation. A tag type=restriction isn't required. If it is missing, it is added * here. {@code turnRestriction} must not be null and it must belong to a dataset. * * @param turnRestriction the turn restriction * @throws IllegalArgumentException thrown if turnRestriction is null * @throws IllegalArgumentException thrown if turnRestriction doesn't belong to a dataset */ public void populate(Relation turnRestriction) { CheckParameterUtil.ensureParameterNotNull(turnRestriction, "turnRestriction"); if (turnRestriction.getDataSet() != null && turnRestriction.getDataSet() != layer.data) { throw new IllegalArgumentException( // don't translate - it's a technical message MessageFormat.format( "turnRestriction {0} must not belong to a different dataset than the dataset of layer ''{1}''", turnRestriction.getId(), layer.getName())); } initFromTurnRestriction(turnRestriction); }
/** * populates the model with the relation members in relation my and their * * @param my my relation. Must not be null. * @param their their relation. Must not be null. * @throws IllegalArgumentException if my is null * @throws IllegalArgumentException if their is null */ public void populate(Relation my, Relation their) { this.myDataset = my.getDataSet(); CheckParameterUtil.ensureParameterNotNull(my, "my"); CheckParameterUtil.ensureParameterNotNull(their, "their"); getMergedEntries().clear(); getMyEntries().clear(); getTheirEntries().clear(); for (RelationMember n : my.getMembers()) { getMyEntries().add(n); } for (RelationMember n : their.getMembers()) { getTheirEntries().add(n); } if (myAndTheirEntriesEqual()) { for (RelationMember m : getMyEntries()) { getMergedEntries().add(cloneEntryForMergedList(m)); } setFrozen(true); } else { setFrozen(false); } fireModelDataChanged(); }