diff -r e68342f9b906 xml.xam/apichanges.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml.xam/apichanges.xml Fri Apr 03 23:07:40 2009 +0400 @@ -0,0 +1,152 @@ + + + + + + + + + + + + + Extansible Abstract Model (XAM) + + + + + + + + + A new String constant MODEL_CHANGED_PROPERTY is added + + + + + +

+ The new constant {@link org.netbeans.modules.xml.xam.Model#MODEL_CHANGED_PROPERTY} + is intended to be used as a propertyName attribute of the + {@link java.beans.PropertyChangeEvent#getPropertyName PropertyChangeEvent}. +

+

+ The corresponding event means that the model has changed. + Only one event is sent per a model's transaction. +

+
+ + +
+ +
+ + + + + + + Change History for the Extansible Abstract Model (XAM) + + + + + + +

Introduction

+ +

This document lists changes made to the Extansible Abstract Model (XAM).

+
+ +

@FOOTER@

+ +
+ +
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 Fri Apr 03 23:01:17 2009 +0400 @@ -53,6 +53,19 @@ import javax.swing.event.UndoableEditLis */ public interface Model> extends Referenceable { public static final String STATE_PROPERTY = "state"; + + /** + * The constant is intended to be used as a propertyName attribute of the + * {@link java.beans.PropertyChangeEvent#getPropertyName PropertyChangeEvent}. + *

+ * The corresponding event means that the model has changed. + * Only one event is sent per a model's transaction. + *

+ * Such event is convenient to do a cumulative update of a model's UI client. + * + * @since 1.5.1 + */ + 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 Fri Apr 03 23:01:17 2009 +0400 @@ -312,7 +312,7 @@ 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() {