Results 1 to 3 of 3

Thread: commit() not propogating to child form models

  1. #1
    Join Date
    Aug 2005
    Location
    Austin, TX
    Posts
    425

    Default 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. #2
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    335

    Default

    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

  3. #3
    Join Date
    Aug 2004
    Location
    Melbourne, Australia
    Posts
    335

    Default

    Have commited a fix for this.

    Ollie

Similar Threads

  1. Replies: 3
    Last Post: Jun 8th, 2010, 03:27 AM
  2. Replies: 9
    Last Post: May 4th, 2006, 09:53 AM
  3. Hibernate Long Session Per Flow?
    By akw in forum Web Flow
    Replies: 21
    Last Post: Dec 12th, 2005, 08:06 PM
  4. readonly form and commit...
    By benoitx in forum Swing
    Replies: 2
    Last Post: Sep 8th, 2005, 05:34 PM
  5. form models
    By besbello in forum Swing
    Replies: 2
    Last Post: Aug 18th, 2004, 04:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •