Announcement Announcement Module
Collapse
No announcement yet.
commit() not propogating to child form models Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • commit() not propogating to child form models

    I think I've found the problem that's been plaguing me since the last big checkin - or I've gone insane from too many hours of debugging :lol:

    I could certainly be missing something subtle, but it appears that child form models are not being commited when the parent form model is commited.

    The code in AbstractFormModel for addChild and setParent look like this:

    Code:
        public void addChild(HierarchicalFormModel child) {
            Assert.required(child, "child");
            Assert.isTrue(child.getParent() == null, "Child form model '" + child + "' already has a parent");
            child.setParent(this);
            child.addPropertyChangeListener(DIRTY_PROPERTY, dirtyChangeHandler);
        }
    
        public void setParent(HierarchicalFormModel parent) {
            Assert.required(parent, "parent");
            this.parent = parent;
            this.parent.addPropertyChangeListener(ENABLED_PROPERTY, parentEnabledChangeHandler);
        }
    Things are setup so dirty-ness propogates up and enabled-ness propogates down, but nothing in that code wires to two together for commits. Shouldn't there be some connection between the children and the parent so that the commit on the parent is propogated down to all the children in the hierarchy?

    Would the right solution be to fix the problem where the child form models are not being added to the child collection and then use that collection in the commit method to call commit() on each child form model?

    Actually it would be a little more complex than that since you'd need to give all the nested form models and chance to veto the commit, but is this even on the right track?

    Thanks.
    Larry.

  • #2
    Would the right solution be to fix the problem where the child form models are not being added to the child collection and then use that collection in the commit method to call commit() on each child form model?

    Actually it would be a little more complex than that since you'd need to give all the nested form models and chance to veto the commit, but is this even on the right track?
    You're right on. I guess this is one of the bits of missing functionality I warned about when I made the commit. I'll look into fixing this ASAP.

    Ollie

    Comment


    • #3
      Have commited a fix for this.

      Ollie

      Comment

      Working...
      X