/**
  * Visits each model in the order it was registered. This method also holds prevents any changes
  * to the dirty state until after the visitor has finished. This is mainly to prevent the dirty
  * model from recomputing needlessly if the visitor is updating the dirty state of each model.
  *
  * @param visitor the visitor.
  */
 public void withEachModel(final PropertyModelVisitor visitor) {
   // we only update the dirty model after we've finished updating all
   // the models, otherwise we'll get a lot of recomputing for nothing.
   dirtyModel.recomputeAfterRunning(
       new Runnable() {
         public void run() {
           // performance could be improved here if the dirty model went deaf for a bit.
           for (BeanPropertyModelBase model : allModels.values()) {
             visitor.visit(model);
           }
         }
       });
 }
 private void doAddCommonBits(String key, BeanPropertyModelBase valueModel) {
   allModels.put(key, valueModel);
   dirtyModel.addSourceModel(valueModel.dirty());
 }