diff -r e68342f9b906 xml.xam/src/org/netbeans/modules/xml/xam/Model.java --- a/xml.xam/src/org/netbeans/modules/xml/xam/Model.java Thu Mar 26 14:00:55 2009 +0300 +++ b/xml.xam/src/org/netbeans/modules/xml/xam/Model.java Mon Mar 30 23:41:35 2009 +0400 @@ -53,6 +53,16 @@ import javax.swing.event.UndoableEditLis */ public interface Model> extends Referenceable { public static final String STATE_PROPERTY = "state"; + + /** + * The constants is intended to be used as a + * {@link java.beans.PropertyChangeEvent PropertyChangeEvent} + * property name. The corresponding event means that the model is changed. + * Only one event is sent per a model's transaction. + * + * @since NetBeans 6.7 + */ + public static final String MODEL_CHANGED_PROPERTY = "model_changed"; /** * Add coarse-grained change listener for events on model components. diff -r e68342f9b906 xml.xam/src/org/netbeans/modules/xml/xam/AbstractModel.java --- a/xml.xam/src/org/netbeans/modules/xml/xam/AbstractModel.java Thu Mar 26 14:00:55 2009 +0300 +++ b/xml.xam/src/org/netbeans/modules/xml/xam/AbstractModel.java Mon Mar 30 23:41:35 2009 +0400 @@ -329,6 +329,12 @@ public abstract class AbstractModel children = r.getChildren(TestComponent.A.class); + TestComponent.A atc = children.get(2); + // + TestComponent.B b1 = new TestComponent.B(model, 1); + model.addChildComponent(atc, b1, -1); + // + TestComponent.B b2 = new TestComponent.B(model, 2); + model.addChildComponent(atc, b2, -1); + // + TestComponent.B b3 = new TestComponent.B(model, 3); + model.addChildComponent(atc, b3, -1); + // + } finally { + model.endTransaction(); + } + plistener.assertEvent(Model.MODEL_CHANGED_PROPERTY, null, null); + // + // Total amount of events should be equal to number of atomic changes + 1 + assertEquals(eventCounter.total, 4); + // + // Only one MODEL_CHANGED event should come per a transaciton + assertEquals(eventCounter.modelChanged, 1); + } + private class FlushListener implements PropertyChangeListener { long flushTime = 0; public FlushListener() {