diff options
author | bvosburgh | 2007-11-07 05:15:34 +0000 |
---|---|---|
committer | bvosburgh | 2007-11-07 05:15:34 +0000 |
commit | ad871d9537424d01464398b07979905d8bc01887 (patch) | |
tree | 8d5d4e048d6fbdc55ccf02d0e31a35bb75279c4d /jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests | |
parent | d04fb34d8100ed8a25b27269475c80dec6817e16 (diff) | |
download | webtools.dali-ad871d9537424d01464398b07979905d8bc01887.tar.gz webtools.dali-ad871d9537424d01464398b07979905d8bc01887.tar.xz webtools.dali-ad871d9537424d01464398b07979905d8bc01887.zip |
[201159] model rework: CollectionValueModel
Diffstat (limited to 'jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests')
19 files changed, 337 insertions, 335 deletions
diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionAspectAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionAspectAdapterTests.java index dcb690add3..829c588511 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionAspectAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionAspectAdapterTests.java @@ -20,6 +20,7 @@ import org.eclipse.jpt.utility.internal.model.AbstractModel; import org.eclipse.jpt.utility.internal.model.event.CollectionChangeEvent; import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener; import org.eclipse.jpt.utility.internal.model.value.CollectionAspectAdapter; +import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel; import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel; import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel; import org.eclipse.jpt.utility.internal.model.value.ValueModel; @@ -55,7 +56,7 @@ public class CollectionAspectAdapterTests extends TestCase { this.subjectHolder1 = new SimplePropertyValueModel(this.subject1); this.aa1 = this.buildAspectAdapter(this.subjectHolder1); this.listener1 = this.buildValueChangeListener1(); - this.aa1.addCollectionChangeListener(ValueModel.VALUE, this.listener1); + this.aa1.addCollectionChangeListener(CollectionValueModel.VALUES, this.listener1); this.event1 = null; this.event1Type = null; @@ -106,7 +107,7 @@ public class CollectionAspectAdapterTests extends TestCase { } } @Override - public void addItem(Object item) { + public void add(Object item) { if (this.collectionName == TestSubject.NAMES_COLLECTION) { ((TestSubject) this.subject).addName((String) item); } else if (this.collectionName == TestSubject.DESCRIPTIONS_COLLECTION) { @@ -116,7 +117,7 @@ public class CollectionAspectAdapterTests extends TestCase { } } @Override - public void removeItem(Object item) { + public void remove(Object item) { if (this.collectionName == TestSubject.NAMES_COLLECTION) { ((TestSubject) this.subject).removeName((String) item); } else if (this.collectionName == TestSubject.DESCRIPTIONS_COLLECTION) { @@ -157,16 +158,16 @@ public class CollectionAspectAdapterTests extends TestCase { } public void testSubjectHolder() { - assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.value())); + assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.values())); assertNull(this.event1); this.subjectHolder1.setValue(this.subject2); assertNotNull(this.event1); assertEquals(this.event1Type, CHANGE); assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ValueModel.VALUE, this.event1.collectionName()); + assertEquals(CollectionValueModel.VALUES, this.event1.collectionName()); assertFalse(this.event1.items().hasNext()); - assertEquals(this.subject2Names(), CollectionTools.bag((Iterator) this.aa1.value())); + assertEquals(this.subject2Names(), CollectionTools.bag((Iterator) this.aa1.values())); this.event1 = null; this.event1Type = null; @@ -174,9 +175,9 @@ public class CollectionAspectAdapterTests extends TestCase { assertNotNull(this.event1); assertEquals(this.event1Type, CHANGE); assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ValueModel.VALUE, this.event1.collectionName()); + assertEquals(CollectionValueModel.VALUES, this.event1.collectionName()); assertFalse(this.event1.items().hasNext()); - assertFalse(((Iterator) this.aa1.value()).hasNext()); + assertFalse(((Iterator) this.aa1.values()).hasNext()); this.event1 = null; this.event1Type = null; @@ -184,103 +185,103 @@ public class CollectionAspectAdapterTests extends TestCase { assertNotNull(this.event1); assertEquals(this.event1Type, CHANGE); assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ValueModel.VALUE, this.event1.collectionName()); + assertEquals(CollectionValueModel.VALUES, this.event1.collectionName()); assertFalse(this.event1.items().hasNext()); - assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.value())); + assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.values())); } public void testAddItem() { - assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.value())); + assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.values())); assertNull(this.event1); this.subject1.addName("jam"); assertNotNull(this.event1); assertEquals(this.event1Type, ADD); assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ValueModel.VALUE, this.event1.collectionName()); + assertEquals(CollectionValueModel.VALUES, this.event1.collectionName()); assertEquals("jam", this.event1.items().next()); Collection namesPlus = this.subject1Names(); namesPlus.add("jam"); - assertEquals(namesPlus, CollectionTools.bag((Iterator) this.aa1.value())); + assertEquals(namesPlus, CollectionTools.bag((Iterator) this.aa1.values())); this.event1 = null; this.event1Type = null; - this.aa1.addItems(Collections.singleton("jaz")); + this.aa1.addAll(Collections.singleton("jaz")); assertNotNull(this.event1); assertEquals(this.event1Type, ADD); assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ValueModel.VALUE, this.event1.collectionName()); + assertEquals(CollectionValueModel.VALUES, this.event1.collectionName()); assertEquals("jaz", this.event1.items().next()); namesPlus.add("jaz"); - assertEquals(namesPlus, CollectionTools.bag((Iterator) this.aa1.value())); + assertEquals(namesPlus, CollectionTools.bag((Iterator) this.aa1.values())); } public void testRemoveItem() { - assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.value())); + assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.values())); assertNull(this.event1); this.subject1.removeName("foo"); assertNotNull(this.event1); assertEquals(this.event1Type, REMOVE); assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ValueModel.VALUE, this.event1.collectionName()); + assertEquals(CollectionValueModel.VALUES, this.event1.collectionName()); assertEquals("foo", this.event1.items().next()); Collection namesMinus = this.subject1Names(); namesMinus.remove("foo"); - assertEquals(namesMinus, CollectionTools.bag((Iterator) this.aa1.value())); + assertEquals(namesMinus, CollectionTools.bag((Iterator) this.aa1.values())); this.event1 = null; this.event1Type = null; - this.aa1.removeItems(Collections.singleton("bar")); + this.aa1.removeAll(Collections.singleton("bar")); assertNotNull(this.event1); assertEquals(this.event1Type, REMOVE); assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ValueModel.VALUE, this.event1.collectionName()); + assertEquals(CollectionValueModel.VALUES, this.event1.collectionName()); assertEquals("bar", this.event1.items().next()); namesMinus.remove("bar"); - assertEquals(namesMinus, CollectionTools.bag((Iterator) this.aa1.value())); + assertEquals(namesMinus, CollectionTools.bag((Iterator) this.aa1.values())); } public void testCollectionChange() { - assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.value())); + assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.values())); assertNull(this.event1); this.subject1.addTwoNames("jam", "jaz"); assertNotNull(this.event1); assertEquals(this.event1Type, CHANGE); assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ValueModel.VALUE, this.event1.collectionName()); + assertEquals(CollectionValueModel.VALUES, this.event1.collectionName()); assertFalse(this.event1.items().hasNext()); Collection namesPlus2 = this.subject1Names(); namesPlus2.add("jam"); namesPlus2.add("jaz"); - assertEquals(namesPlus2, CollectionTools.bag((Iterator) this.aa1.value())); + assertEquals(namesPlus2, CollectionTools.bag((Iterator) this.aa1.values())); } public void testValue() { assertEquals(this.subject1Names(), CollectionTools.bag(this.subject1.names())); - assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.value())); + assertEquals(this.subject1Names(), CollectionTools.bag((Iterator) this.aa1.values())); } public void testSize() { assertEquals(this.subject1Names().size(), CollectionTools.size(this.subject1.names())); - assertEquals(this.subject1Names().size(), CollectionTools.size((Iterator) this.aa1.value())); + assertEquals(this.subject1Names().size(), CollectionTools.size((Iterator) this.aa1.values())); } public void testHasListeners() { - assertTrue(this.aa1.hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(this.aa1.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); assertTrue(this.subject1.hasAnyCollectionChangeListeners(TestSubject.NAMES_COLLECTION)); - this.aa1.removeCollectionChangeListener(ValueModel.VALUE, this.listener1); + this.aa1.removeCollectionChangeListener(CollectionValueModel.VALUES, this.listener1); assertFalse(this.subject1.hasAnyCollectionChangeListeners(TestSubject.NAMES_COLLECTION)); - assertFalse(this.aa1.hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertFalse(this.aa1.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); CollectionChangeListener listener2 = this.buildValueChangeListener1(); this.aa1.addCollectionChangeListener(listener2); - assertTrue(this.aa1.hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(this.aa1.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); assertTrue(this.subject1.hasAnyCollectionChangeListeners(TestSubject.NAMES_COLLECTION)); this.aa1.removeCollectionChangeListener(listener2); assertFalse(this.subject1.hasAnyCollectionChangeListeners(TestSubject.NAMES_COLLECTION)); - assertFalse(this.aa1.hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertFalse(this.aa1.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); } // ********** inner class ********** diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionListValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionListValueModelAdapterTests.java index 5e65abe163..a9f97c9266 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionListValueModelAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionListValueModelAdapterTests.java @@ -58,9 +58,9 @@ public class CollectionListValueModelAdapterTests extends TestCase { this.adapter.addListChangeListener(ValueModel.VALUE, new TestListChangeListener() { public void itemsAdded(ListChangeEvent e) {/* OK */} }); - this.wrappedCollectionHolder.addItem("foo"); - this.wrappedCollectionHolder.addItem("bar"); - this.wrappedCollectionHolder.addItem("baz"); + this.wrappedCollectionHolder.add("foo"); + this.wrappedCollectionHolder.add("bar"); + this.wrappedCollectionHolder.add("baz"); Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); assertEquals(3, adapterCollection.size()); assertEquals(this.wrappedCollection, adapterCollection); @@ -71,9 +71,9 @@ public class CollectionListValueModelAdapterTests extends TestCase { public void itemsAdded(ListChangeEvent e) {/* OK */} }; this.adapter.addListChangeListener(ValueModel.VALUE, listener); - this.wrappedCollectionHolder.addItem("foo"); - this.wrappedCollectionHolder.addItem("bar"); - this.wrappedCollectionHolder.addItem("baz"); + this.wrappedCollectionHolder.add("foo"); + this.wrappedCollectionHolder.add("bar"); + this.wrappedCollectionHolder.add("baz"); Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); assertEquals(3, adapterCollection.size()); assertEquals(this.wrappedCollection, adapterCollection); @@ -92,13 +92,13 @@ public class CollectionListValueModelAdapterTests extends TestCase { public void testAddItem() { List synchList = new SynchronizedList(this.adapter); Bag synchCollection = new SynchronizedBag(this.wrappedCollectionHolder); - this.wrappedCollectionHolder.addItem("foo"); + this.wrappedCollectionHolder.add("foo"); assertTrue(this.wrappedCollection.contains("foo")); - this.wrappedCollectionHolder.addItem("bar"); - this.wrappedCollectionHolder.addItem("baz"); - this.wrappedCollectionHolder.addItem("joo"); - this.wrappedCollectionHolder.addItem("jar"); - this.wrappedCollectionHolder.addItem("jaz"); + this.wrappedCollectionHolder.add("bar"); + this.wrappedCollectionHolder.add("baz"); + this.wrappedCollectionHolder.add("joo"); + this.wrappedCollectionHolder.add("jar"); + this.wrappedCollectionHolder.add("jaz"); assertEquals(6, this.wrappedCollection.size()); Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); @@ -110,15 +110,15 @@ public class CollectionListValueModelAdapterTests extends TestCase { public void testRemoveItem() { List synchList = new SynchronizedList(this.adapter); Bag synchCollection = new SynchronizedBag(this.wrappedCollectionHolder); - this.wrappedCollectionHolder.addItem("foo"); - this.wrappedCollectionHolder.addItem("bar"); - this.wrappedCollectionHolder.addItem("baz"); - this.wrappedCollectionHolder.addItem("joo"); - this.wrappedCollectionHolder.addItem("jar"); - this.wrappedCollectionHolder.addItem("jaz"); - this.wrappedCollectionHolder.removeItem("jaz"); + this.wrappedCollectionHolder.add("foo"); + this.wrappedCollectionHolder.add("bar"); + this.wrappedCollectionHolder.add("baz"); + this.wrappedCollectionHolder.add("joo"); + this.wrappedCollectionHolder.add("jar"); + this.wrappedCollectionHolder.add("jaz"); + this.wrappedCollectionHolder.remove("jaz"); assertFalse(this.wrappedCollection.contains("jaz")); - this.wrappedCollectionHolder.removeItem("foo"); + this.wrappedCollectionHolder.remove("foo"); assertFalse(this.wrappedCollection.contains("foo")); assertEquals(4, this.wrappedCollection.size()); @@ -133,15 +133,15 @@ public class CollectionListValueModelAdapterTests extends TestCase { public void itemsAdded(ListChangeEvent e) {/* OK */} public void itemsRemoved(ListChangeEvent e) {/* OK */} }); - this.wrappedCollectionHolder.addItem("foo"); - this.wrappedCollectionHolder.addItem("bar"); - this.wrappedCollectionHolder.addItem("baz"); - this.wrappedCollectionHolder.addItem("joo"); - this.wrappedCollectionHolder.addItem("jar"); - this.wrappedCollectionHolder.addItem("jaz"); - this.wrappedCollectionHolder.removeItem("jaz"); + this.wrappedCollectionHolder.add("foo"); + this.wrappedCollectionHolder.add("bar"); + this.wrappedCollectionHolder.add("baz"); + this.wrappedCollectionHolder.add("joo"); + this.wrappedCollectionHolder.add("jar"); + this.wrappedCollectionHolder.add("jaz"); + this.wrappedCollectionHolder.remove("jaz"); assertFalse(this.wrappedCollection.contains("jaz")); - this.wrappedCollectionHolder.removeItem("foo"); + this.wrappedCollectionHolder.remove("foo"); assertFalse(this.wrappedCollection.contains("foo")); assertEquals(4, this.wrappedCollection.size()); @@ -166,9 +166,9 @@ public class CollectionListValueModelAdapterTests extends TestCase { public void itemsAdded(ListChangeEvent e) {/* OK */} public void itemsRemoved(ListChangeEvent e) {/* OK */} }); - this.wrappedCollectionHolder.addItem("foo"); - this.wrappedCollectionHolder.addItem("bar"); - this.wrappedCollectionHolder.addItem("baz"); + this.wrappedCollectionHolder.add("foo"); + this.wrappedCollectionHolder.add("bar"); + this.wrappedCollectionHolder.add("baz"); JList jList = new JList(new ListModelAdapter(this.adapter)); ((SimpleCollectionValueModel) this.wrappedCollectionHolder).setValue(new HashBag()); assertEquals(0, jList.getModel().getSize()); diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java index 6fcad061f9..4bb6c6b0e3 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java @@ -53,7 +53,7 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase { } private Collection wrappedCollection() { - return CollectionTools.collection((Iterator) this.wrappedCollectionHolder.value()); + return CollectionTools.collection((Iterator) this.wrappedCollectionHolder.values()); } public void testGetValue() { @@ -63,21 +63,21 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase { assertFalse(this.booleanValue()); assertFalse(this.wrappedCollection().contains("666")); - this.wrappedCollectionHolder.addItem("111"); + this.wrappedCollectionHolder.add("111"); assertFalse(this.booleanValue()); - this.wrappedCollectionHolder.addItem("222"); + this.wrappedCollectionHolder.add("222"); assertFalse(this.booleanValue()); - this.wrappedCollectionHolder.addItem("666"); + this.wrappedCollectionHolder.add("666"); assertTrue(this.booleanValue()); assertTrue(this.wrappedCollection().contains("666")); - this.wrappedCollectionHolder.removeItem("666"); + this.wrappedCollectionHolder.remove("666"); assertFalse(this.booleanValue()); assertFalse(this.wrappedCollection().contains("666")); - this.wrappedCollectionHolder.addItem("666"); + this.wrappedCollectionHolder.add("666"); assertTrue(this.booleanValue()); assertTrue(this.wrappedCollection().contains("666")); @@ -110,19 +110,19 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase { }); assertNull(this.event); - this.wrappedCollectionHolder.addItem("111"); + this.wrappedCollectionHolder.add("111"); assertNull(this.event); - this.wrappedCollectionHolder.addItem("222"); + this.wrappedCollectionHolder.add("222"); assertNull(this.event); - this.wrappedCollectionHolder.addItem("666"); + this.wrappedCollectionHolder.add("666"); this.verifyEvent(false, true); - this.wrappedCollectionHolder.removeItem("666"); + this.wrappedCollectionHolder.remove("666"); this.verifyEvent(true, false); - this.wrappedCollectionHolder.addItem("666"); + this.wrappedCollectionHolder.add("666"); this.verifyEvent(false, true); ((SimpleCollectionValueModel) this.wrappedCollectionHolder).clear(); @@ -141,7 +141,7 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase { public void propertyChanged(PropertyChangeEvent e) {/* OK */} }; this.adapter.addPropertyChangeListener(ValueModel.VALUE, listener); - this.wrappedCollectionHolder.addItem("666"); + this.wrappedCollectionHolder.add("666"); assertTrue(this.booleanValue()); assertTrue(this.wrappedCollection().contains("666")); @@ -156,26 +156,26 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase { public void testHasListeners() { assertFalse(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(ValueModel.VALUE)); - assertFalse(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertFalse(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); PropertyChangeListener listener = new PropertyChangeListener() { public void propertyChanged(PropertyChangeEvent e) {/* OK */} }; this.adapter.addPropertyChangeListener(ValueModel.VALUE, listener); assertTrue(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(ValueModel.VALUE)); - assertTrue(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); this.adapter.removePropertyChangeListener(ValueModel.VALUE, listener); assertFalse(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(ValueModel.VALUE)); - assertFalse(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertFalse(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); this.adapter.addPropertyChangeListener(listener); assertTrue(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(ValueModel.VALUE)); - assertTrue(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); this.adapter.removePropertyChangeListener(listener); assertFalse(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(ValueModel.VALUE)); - assertFalse(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertFalse(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); } @@ -207,18 +207,18 @@ public class CollectionPropertyValueModelAdapterTests extends TestCase { if (this.booleanValue()) { if ( ! this.booleanValueOf(value)) { // the value is changing from true to false - this.collectionHolder.removeItem(this.item); + this.collectionHolder.remove(this.item); } } else { if (this.booleanValueOf(value)) { // the value is changing from false to true - this.collectionHolder.addItem(this.item); + this.collectionHolder.add(this.item); } } } @Override protected Object buildValue() { - return Boolean.valueOf(CollectionTools.contains((Iterator) this.collectionHolder.value(), this.item)); + return Boolean.valueOf(CollectionTools.contains((Iterator) this.collectionHolder.values(), this.item)); } // ********** internal methods ********** diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CompositeCollectionValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CompositeCollectionValueModelTests.java index ab41811819..b85787b708 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CompositeCollectionValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/CompositeCollectionValueModelTests.java @@ -59,7 +59,7 @@ public class CompositeCollectionValueModelTests extends TestCase { } private void verifySynch(CollectionValueModel compositeCVM) { - assertEquals(0, CollectionTools.size((Iterator) compositeCVM.value())); + assertEquals(0, CollectionTools.size((Iterator) compositeCVM.values())); Bag familiesSynch = new SynchronizedBag(this.buildFamiliesAspectAdapter(this.neighborhoodHolder)); Bag membersSynch = new SynchronizedBag(compositeCVM); this.populateNeighborhood(this.neighborhood); @@ -70,35 +70,35 @@ public class CompositeCollectionValueModelTests extends TestCase { assertEquals(12, CollectionTools.size(this.neighborhood.allMembers())); assertEquals(12, membersSynch.size()); assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.value())); + assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.values())); jetsons.removeMember(jetsons.memberNamed("Astro")); assertEquals(3, familiesSynch.size()); assertEquals(11, CollectionTools.size(this.neighborhood.allMembers())); assertEquals(11, membersSynch.size()); assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.value())); + assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.values())); jetsons.removeMember(jetsons.memberNamed("Judy")); assertEquals(3, familiesSynch.size()); assertEquals(10, CollectionTools.size(this.neighborhood.allMembers())); assertEquals(10, membersSynch.size()); assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.value())); + assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.values())); jetsons.addMember("Fido"); assertEquals(3, familiesSynch.size()); assertEquals(11, CollectionTools.size(this.neighborhood.allMembers())); assertEquals(11, membersSynch.size()); assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.value())); + assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.values())); this.neighborhood.removeFamily(jetsons); assertEquals(2, familiesSynch.size()); assertEquals(7, CollectionTools.size(this.neighborhood.allMembers())); assertEquals(7, membersSynch.size()); assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.value())); + assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.values())); Family bears = this.neighborhood.addFamily("Bear"); bears.addMember("Yogi"); @@ -106,14 +106,14 @@ public class CompositeCollectionValueModelTests extends TestCase { assertEquals(8, CollectionTools.size(this.neighborhood.allMembers())); assertEquals(8, membersSynch.size()); assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.value())); + assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.values())); bears.addMember("Boo-Boo"); assertEquals(3, familiesSynch.size()); assertEquals(9, CollectionTools.size(this.neighborhood.allMembers())); assertEquals(9, membersSynch.size()); assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.value())); + assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.values())); Neighborhood n2 = new Neighborhood("Hanna-Barbera 2"); this.neighborhoodHolder.setValue(n2); @@ -122,7 +122,7 @@ public class CompositeCollectionValueModelTests extends TestCase { assertEquals(12, CollectionTools.size(n2.allMembers())); assertEquals(12, membersSynch.size()); assertEquals(CollectionTools.bag(n2.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.value())); + assertEquals(membersSynch, CollectionTools.bag((Iterator) compositeCVM.values())); } public void testNoTransformer() { @@ -163,15 +163,15 @@ public class CompositeCollectionValueModelTests extends TestCase { this.populateNeighborhood(this.neighborhood); Family jetsons = this.neighborhood.familyNamed("Jetson"); - assertTrue(compositeCVM.hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(compositeCVM.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); assertTrue(jetsons.hasAnyCollectionChangeListeners(Family.MEMBERS_COLLECTION)); - compositeCVM.removeCollectionChangeListener(ValueModel.VALUE, synchBag); - assertFalse(compositeCVM.hasAnyCollectionChangeListeners(ValueModel.VALUE)); + compositeCVM.removeCollectionChangeListener(CollectionValueModel.VALUES, synchBag); + assertFalse(compositeCVM.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); assertFalse(jetsons.hasAnyCollectionChangeListeners(Family.MEMBERS_COLLECTION)); - compositeCVM.addCollectionChangeListener(ValueModel.VALUE, synchBag); - assertTrue(compositeCVM.hasAnyCollectionChangeListeners(ValueModel.VALUE)); + compositeCVM.addCollectionChangeListener(CollectionValueModel.VALUES, synchBag); + assertTrue(compositeCVM.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); assertTrue(jetsons.hasAnyCollectionChangeListeners(Family.MEMBERS_COLLECTION)); } diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringCollectionValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringCollectionValueModelTests.java index fa95e08cfc..4efd1690b8 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringCollectionValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/FilteringCollectionValueModelTests.java @@ -72,34 +72,34 @@ public class FilteringCollectionValueModelTests extends TestCase { public void testValue() { // add a listener to "activate" the wrapper - this.filteredCollectionHolder.addCollectionChangeListener(ValueModel.VALUE, this.buildFilteredListener()); + this.filteredCollectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildFilteredListener()); - assertEquals("foo", ((Iterator) this.collectionHolder.value()).next()); - assertFalse(((Iterator) this.filteredCollectionHolder.value()).hasNext()); + assertEquals("foo", ((Iterator) this.collectionHolder.values()).next()); + assertFalse(((Iterator) this.filteredCollectionHolder.values()).hasNext()); - this.collectionHolder.addItem("bar"); - Iterator collectionHolderValue = (Iterator) this.collectionHolder.value(); + this.collectionHolder.add("bar"); + Iterator collectionHolderValue = (Iterator) this.collectionHolder.values(); assertEquals("foo", collectionHolderValue.next()); assertEquals("bar", collectionHolderValue.next()); - assertTrue(((Iterator) this.filteredCollectionHolder.value()).hasNext()); - assertEquals("bar", ((Iterator) this.filteredCollectionHolder.value()).next()); + assertTrue(((Iterator) this.filteredCollectionHolder.values()).hasNext()); + assertEquals("bar", ((Iterator) this.filteredCollectionHolder.values()).next()); - this.collectionHolder.removeItem("bar"); - assertEquals("foo", ((Iterator) this.collectionHolder.value()).next()); - assertFalse(((Iterator) this.filteredCollectionHolder.value()).hasNext()); + this.collectionHolder.remove("bar"); + assertEquals("foo", ((Iterator) this.collectionHolder.values()).next()); + assertFalse(((Iterator) this.filteredCollectionHolder.values()).hasNext()); - this.collectionHolder.removeItem("foo"); - assertFalse(((Iterator) this.collectionHolder.value()).hasNext()); - assertFalse(((Iterator) this.filteredCollectionHolder.value()).hasNext()); + this.collectionHolder.remove("foo"); + assertFalse(((Iterator) this.collectionHolder.values()).hasNext()); + assertFalse(((Iterator) this.filteredCollectionHolder.values()).hasNext()); - this.collectionHolder.addItem("foo"); - assertEquals("foo", ((Iterator) this.collectionHolder.value()).next()); - assertFalse(((Iterator) this.filteredCollectionHolder.value()).hasNext()); + this.collectionHolder.add("foo"); + assertEquals("foo", ((Iterator) this.collectionHolder.values()).next()); + assertFalse(((Iterator) this.filteredCollectionHolder.values()).hasNext()); } public void testSetValue() { // add a listener to "activate" the wrapper - this.filteredCollectionHolder.addCollectionChangeListener(ValueModel.VALUE, this.buildFilteredListener()); + this.filteredCollectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildFilteredListener()); Collection newCollection = new Vector(); newCollection.add("fox"); @@ -107,26 +107,26 @@ public class FilteringCollectionValueModelTests extends TestCase { ((SimpleCollectionValueModel) this.collectionHolder).setValue(newCollection); - Iterator collectionValues = (Iterator) this.collectionHolder.value(); + Iterator collectionValues = (Iterator) this.collectionHolder.values(); assertEquals("fox", collectionValues.next()); assertEquals("baz", collectionValues.next()); - Iterator filteredCollectionValues = (Iterator) this.filteredCollectionHolder.value(); + Iterator filteredCollectionValues = (Iterator) this.filteredCollectionHolder.values(); assertEquals("baz", filteredCollectionValues.next()); assertFalse(filteredCollectionValues.hasNext()); } public void testLazyListening() { - assertTrue(((AbstractModel) this.collectionHolder).hasNoCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(((AbstractModel) this.collectionHolder).hasNoCollectionChangeListeners(CollectionValueModel.VALUES)); CollectionChangeListener listener = this.buildFilteredListener(); this.filteredCollectionHolder.addCollectionChangeListener(listener); - assertTrue(((AbstractModel) this.collectionHolder).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(((AbstractModel) this.collectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); this.filteredCollectionHolder.removeCollectionChangeListener(listener); - assertTrue(((AbstractModel) this.collectionHolder).hasNoCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(((AbstractModel) this.collectionHolder).hasNoCollectionChangeListeners(CollectionValueModel.VALUES)); - this.filteredCollectionHolder.addCollectionChangeListener(ValueModel.VALUE, listener); - assertTrue(((AbstractModel) this.collectionHolder).hasAnyCollectionChangeListeners(ValueModel.VALUE)); - this.filteredCollectionHolder.removeCollectionChangeListener(ValueModel.VALUE, listener); - assertTrue(((AbstractModel) this.collectionHolder).hasNoCollectionChangeListeners(ValueModel.VALUE)); + this.filteredCollectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, listener); + assertTrue(((AbstractModel) this.collectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); + this.filteredCollectionHolder.removeCollectionChangeListener(CollectionValueModel.VALUES, listener); + assertTrue(((AbstractModel) this.collectionHolder).hasNoCollectionChangeListeners(CollectionValueModel.VALUES)); } public void testCollectionChange1() { @@ -136,8 +136,8 @@ public class FilteringCollectionValueModelTests extends TestCase { } public void testCollectionChange2() { - this.collectionHolder.addCollectionChangeListener(ValueModel.VALUE, this.buildListener()); - this.filteredCollectionHolder.addCollectionChangeListener(ValueModel.VALUE, this.buildFilteredListener()); + this.collectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildListener()); + this.filteredCollectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildFilteredListener()); this.verifyCollectionChanges(); } @@ -154,14 +154,14 @@ public class FilteringCollectionValueModelTests extends TestCase { private void verifyCollectionChanges() { clearEvents(); - this.collectionHolder.addItem("bar"); + this.collectionHolder.add("bar"); Collection tempCollection = new Vector(); tempCollection.add("bar"); this.verifyEvent(this.addEvent, this.collectionHolder, tempCollection); this.verifyEvent(this.filteredAddEvent, this.filteredCollectionHolder, tempCollection); clearEvents(); - this.collectionHolder.removeItem("foo"); + this.collectionHolder.remove("foo"); tempCollection.remove("bar"); tempCollection.add("foo"); this.verifyEvent(this.removeEvent, this.collectionHolder, tempCollection); @@ -169,7 +169,7 @@ public class FilteringCollectionValueModelTests extends TestCase { clearEvents(); - this.collectionHolder.removeItem("bar"); + this.collectionHolder.remove("bar"); tempCollection.add("bar"); tempCollection.remove("foo"); this.verifyEvent(this.removeEvent, this.collectionHolder, tempCollection); @@ -177,7 +177,7 @@ public class FilteringCollectionValueModelTests extends TestCase { clearEvents(); - this.collectionHolder.addItem("foo"); + this.collectionHolder.add("foo"); tempCollection.remove("bar"); tempCollection.add("foo"); this.verifyEvent(this.addEvent, this.collectionHolder, tempCollection); @@ -235,7 +235,7 @@ public class FilteringCollectionValueModelTests extends TestCase { private void verifyEvent(CollectionChangeEvent event, Object source, Object items) { assertEquals(source, event.getSource()); - assertEquals(ValueModel.VALUE, event.collectionName()); + assertEquals(CollectionValueModel.VALUES, event.collectionName()); assertEquals(items, CollectionTools.vector(event.items())); } @@ -244,19 +244,19 @@ public class FilteringCollectionValueModelTests extends TestCase { this.collectionHolder = new SimpleCollectionValueModel(this.buildCollection2()); this.filteredCollectionHolder = new FilteringCollectionValueModel(this.collectionHolder, this.buildFilter2()); // add a listener to "activate" the wrapper - this.filteredCollectionHolder.addCollectionChangeListener(ValueModel.VALUE, this.buildFilteredListener()); + this.filteredCollectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildFilteredListener()); assertEquals(0, this.filteredCollectionHolder.size()); - this.collectionHolder.addItem(new TestItem("bar")); + this.collectionHolder.add(new TestItem("bar")); assertEquals(1, this.filteredCollectionHolder.size()); TestItem baz = new TestItem("baz"); - this.collectionHolder.addItem(baz); + this.collectionHolder.add(baz); assertEquals(2, this.filteredCollectionHolder.size()); // before removing it, change the item so that it is filtered baz.name = "jaz"; - this.collectionHolder.removeItem(baz); + this.collectionHolder.remove(baz); // this would fail because the item was not removed from // the filtered collection cache... but we've fixed it now assertEquals(1, this.filteredCollectionHolder.size()); diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemCollectionListValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemCollectionListValueModelAdapterTests.java index aabb467971..afa7995e34 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemCollectionListValueModelAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemCollectionListValueModelAdapterTests.java @@ -74,15 +74,15 @@ public class ItemCollectionListValueModelAdapterTests extends TestCase { assertEquals(6, synchList.size()); this.compare(listValueModel, synchList); - collectionHolder.addItem(this.tom); - collectionHolder.addItem(this.dick); - collectionHolder.addItem(this.harry); + collectionHolder.add(this.tom); + collectionHolder.add(this.dick); + collectionHolder.add(this.harry); assertEquals(9, synchList.size()); this.compare(listValueModel, synchList); - collectionHolder.removeItem(this.foo); - collectionHolder.removeItem(this.jar); - collectionHolder.removeItem(this.harry); + collectionHolder.remove(this.foo); + collectionHolder.remove(this.jar); + collectionHolder.remove(this.harry); assertEquals(6, synchList.size()); this.compare(listValueModel, synchList); } diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemListListValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemListListValueModelAdapterTests.java index 01889c3c50..c0e2434e9a 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemListListValueModelAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemListListValueModelAdapterTests.java @@ -74,15 +74,15 @@ public class ItemListListValueModelAdapterTests extends TestCase { assertEquals(6, synchList.size()); this.compare(listValueModel, synchList); - collectionHolder.addItem(this.tom); - collectionHolder.addItem(this.dick); - collectionHolder.addItem(this.harry); + collectionHolder.add(this.tom); + collectionHolder.add(this.dick); + collectionHolder.add(this.harry); assertEquals(9, synchList.size()); this.compare(listValueModel, synchList); - collectionHolder.removeItem(this.foo); - collectionHolder.removeItem(this.jar); - collectionHolder.removeItem(this.harry); + collectionHolder.remove(this.foo); + collectionHolder.remove(this.jar); + collectionHolder.remove(this.harry); assertEquals(6, synchList.size()); this.compare(listValueModel, synchList); } diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemPropertyListValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemPropertyListValueModelAdapterTests.java index 98372de3ba..d9f2218da0 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemPropertyListValueModelAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemPropertyListValueModelAdapterTests.java @@ -77,15 +77,15 @@ public class ItemPropertyListValueModelAdapterTests extends TestCase { assertEquals(6, synchList.size()); this.compare(listValueModel, synchList); - collectionHolder.addItem(this.tom); - collectionHolder.addItem(this.dick); - collectionHolder.addItem(this.harry); + collectionHolder.add(this.tom); + collectionHolder.add(this.dick); + collectionHolder.add(this.harry); assertEquals(9, synchList.size()); this.compare(listValueModel, synchList); - collectionHolder.removeItem(this.foo); - collectionHolder.removeItem(this.jar); - collectionHolder.removeItem(this.harry); + collectionHolder.remove(this.foo); + collectionHolder.remove(this.jar); + collectionHolder.remove(this.harry); assertEquals(6, synchList.size()); this.compare(listValueModel, synchList); @@ -158,15 +158,15 @@ public class ItemPropertyListValueModelAdapterTests extends TestCase { assertEquals(6, synchList.size()); this.compareSort(listValueModel, synchList, comparator); - collectionHolder.addItem(this.tom); - collectionHolder.addItem(this.dick); - collectionHolder.addItem(this.harry); + collectionHolder.add(this.tom); + collectionHolder.add(this.dick); + collectionHolder.add(this.harry); assertEquals(9, synchList.size()); this.compareSort(listValueModel, synchList, comparator); - collectionHolder.removeItem(this.foo); - collectionHolder.removeItem(this.jar); - collectionHolder.removeItem(this.harry); + collectionHolder.remove(this.foo); + collectionHolder.remove(this.jar); + collectionHolder.remove(this.harry); assertEquals(6, synchList.size()); this.compareSort(listValueModel, synchList, comparator); diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemStateListValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemStateListValueModelAdapterTests.java index ac34e7f164..1550ce7639 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemStateListValueModelAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ItemStateListValueModelAdapterTests.java @@ -75,15 +75,15 @@ public class ItemStateListValueModelAdapterTests extends TestCase { assertEquals(6, synchList.size()); this.compare(listValueModel, synchList); - collectionHolder.addItem(this.tom); - collectionHolder.addItem(this.dick); - collectionHolder.addItem(this.harry); + collectionHolder.add(this.tom); + collectionHolder.add(this.dick); + collectionHolder.add(this.harry); assertEquals(9, synchList.size()); this.compare(listValueModel, synchList); - collectionHolder.removeItem(this.foo); - collectionHolder.removeItem(this.jar); - collectionHolder.removeItem(this.harry); + collectionHolder.remove(this.foo); + collectionHolder.remove(this.jar); + collectionHolder.remove(this.harry); assertEquals(6, synchList.size()); this.compare(listValueModel, synchList); } @@ -147,15 +147,15 @@ public class ItemStateListValueModelAdapterTests extends TestCase { assertEquals(6, synchList.size()); this.compareSort(listValueModel, synchList, comparator); - collectionHolder.addItem(this.tom); - collectionHolder.addItem(this.dick); - collectionHolder.addItem(this.harry); + collectionHolder.add(this.tom); + collectionHolder.add(this.dick); + collectionHolder.add(this.harry); assertEquals(9, synchList.size()); this.compareSort(listValueModel, synchList, comparator); - collectionHolder.removeItem(this.foo); - collectionHolder.removeItem(this.jar); - collectionHolder.removeItem(this.harry); + collectionHolder.remove(this.foo); + collectionHolder.remove(this.jar); + collectionHolder.remove(this.harry); assertEquals(6, synchList.size()); this.compareSort(listValueModel, synchList, comparator); } diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCollectionValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCollectionValueModelAdapterTests.java index 216df162a4..05a86d8f7d 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCollectionValueModelAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ListCollectionValueModelAdapterTests.java @@ -60,7 +60,7 @@ public class ListCollectionValueModelAdapterTests extends TestCase { } public void testValue() { - this.adapter.addCollectionChangeListener(ValueModel.VALUE, new TestListener() { + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { public void itemsAdded(CollectionChangeEvent e) { // override failure } @@ -68,7 +68,7 @@ public class ListCollectionValueModelAdapterTests extends TestCase { this.wrappedListHolder.addItem(0, "foo"); this.wrappedListHolder.addItem(1, "bar"); this.wrappedListHolder.addItem(2, "baz"); - Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); + Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.values()); assertEquals(3, adapterCollection.size()); assertEquals(this.wrappedCollection(), adapterCollection); } @@ -77,21 +77,21 @@ public class ListCollectionValueModelAdapterTests extends TestCase { CollectionChangeListener listener = new TestListener() { public void itemsAdded(CollectionChangeEvent e) {/* OK */} }; - this.adapter.addCollectionChangeListener(ValueModel.VALUE, listener); + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, listener); this.wrappedListHolder.addItem(0, "foo"); this.wrappedListHolder.addItem(1, "bar"); this.wrappedListHolder.addItem(2, "baz"); - Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); + Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.values()); assertEquals(3, adapterCollection.size()); assertEquals(this.wrappedCollection(), adapterCollection); - this.adapter.removeCollectionChangeListener(ValueModel.VALUE, listener); - adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); + this.adapter.removeCollectionChangeListener(CollectionValueModel.VALUES, listener); + adapterCollection = CollectionTools.collection((Iterator) this.adapter.values()); assertEquals(0, adapterCollection.size()); assertEquals(new HashBag(), adapterCollection); - this.adapter.addCollectionChangeListener(ValueModel.VALUE, listener); - adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, listener); + adapterCollection = CollectionTools.collection((Iterator) this.adapter.values()); assertEquals(3, adapterCollection.size()); assertEquals(this.wrappedCollection(), adapterCollection); } @@ -108,7 +108,7 @@ public class ListCollectionValueModelAdapterTests extends TestCase { this.wrappedListHolder.addItem(5, "jaz"); assertEquals(6, this.wrappedList.size()); - Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); + Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.values()); assertEquals(this.wrappedCollection(), adapterCollection); assertEquals(this.wrappedCollection(), CollectionTools.collection(synchList.iterator())); assertEquals(this.wrappedCollection(), synchCollection); @@ -129,14 +129,14 @@ public class ListCollectionValueModelAdapterTests extends TestCase { assertFalse(this.wrappedList.contains("foo")); assertEquals(4, this.wrappedList.size()); - Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); + Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.values()); assertEquals(this.wrappedCollection(), adapterCollection); assertEquals(this.wrappedCollection(), CollectionTools.collection(synchList.iterator())); assertEquals(this.wrappedCollection(), synchCollection); } public void testListSynch() { - this.adapter.addCollectionChangeListener(ValueModel.VALUE, new TestListener() { + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { public void itemsAdded(CollectionChangeEvent e) { // override failure } @@ -156,12 +156,12 @@ public class ListCollectionValueModelAdapterTests extends TestCase { assertFalse(this.wrappedList.contains("foo")); assertEquals(4, this.wrappedList.size()); - Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); + Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.values()); assertEquals(this.wrappedCollection(), adapterCollection); } public void testReplaceItem() { - this.adapter.addCollectionChangeListener(ValueModel.VALUE, new TestListener() { + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { public void itemsAdded(CollectionChangeEvent e) { // override failure } @@ -172,12 +172,12 @@ public class ListCollectionValueModelAdapterTests extends TestCase { this.wrappedListHolder.addItem(0, "foo"); this.wrappedListHolder.addItem(1, "bar"); this.wrappedListHolder.addItem(2, "baz"); - Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); + Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.values()); assertEquals(3, adapterCollection.size()); - this.adapter.addCollectionChangeListener(ValueModel.VALUE, new TestListener() { + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { public void itemsRemoved(CollectionChangeEvent e) { assertEquals("foo", e.items().next()); - assertFalse(CollectionTools.contains((Iterator) ListCollectionValueModelAdapterTests.this.adapter.value(), "joo")); + assertFalse(CollectionTools.contains((Iterator) ListCollectionValueModelAdapterTests.this.adapter.values(), "joo")); assertEquals(2, ListCollectionValueModelAdapterTests.this.adapter.size()); } public void itemsAdded(CollectionChangeEvent e) { @@ -186,25 +186,25 @@ public class ListCollectionValueModelAdapterTests extends TestCase { } }); this.wrappedListHolder.replaceItem(0, "joo"); - adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); + adapterCollection = CollectionTools.collection((Iterator) this.adapter.values()); assertEquals(3, adapterCollection.size()); assertEquals(this.wrappedCollection(), adapterCollection); } public void testHasListeners() { - assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); SynchronizedBag synchCollection = new SynchronizedBag(this.adapter); - assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(ValueModel.VALUE)); - this.adapter.removeCollectionChangeListener(ValueModel.VALUE, synchCollection); - assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); + this.adapter.removeCollectionChangeListener(CollectionValueModel.VALUES, synchCollection); + assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); this.adapter.addCollectionChangeListener(synchCollection); - assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); this.adapter.removeCollectionChangeListener(synchCollection); - assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); } public void testListChangedToEmpty() { - this.adapter.addCollectionChangeListener(ValueModel.VALUE, new TestListener() { + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { public void itemsAdded(CollectionChangeEvent e) {/* OK */} public void itemsRemoved(CollectionChangeEvent e) {/* OK */} }); @@ -217,7 +217,7 @@ public class ListCollectionValueModelAdapterTests extends TestCase { } public void testCollectionChangedFromEmpty() { - this.adapter.addCollectionChangeListener(ValueModel.VALUE, new TestListener() { + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { public void itemsAdded(CollectionChangeEvent e) {/* OK */} public void itemsRemoved(CollectionChangeEvent e) {/* OK */} }); @@ -231,7 +231,7 @@ public class ListCollectionValueModelAdapterTests extends TestCase { } public void testCollectionChangedFromEmptyToEmpty() { - this.adapter.addCollectionChangeListener(ValueModel.VALUE, new TestListener() { + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { public void itemsAdded(CollectionChangeEvent e) {/* OK */} public void itemsRemoved(CollectionChangeEvent e) {/* OK */} }); diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullCollectionValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullCollectionValueModelTests.java index 7c25f159cb..6b026eed79 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullCollectionValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/NullCollectionValueModelTests.java @@ -41,7 +41,7 @@ public class NullCollectionValueModelTests extends TestCase { public void testAddItem() { boolean exCaught = false; try { - this.collectionHolder.addItem("foo"); + this.collectionHolder.add("foo"); } catch (UnsupportedOperationException ex) { exCaught = true; } @@ -55,7 +55,7 @@ public class NullCollectionValueModelTests extends TestCase { items.add("bar"); items.add("baz"); try { - this.collectionHolder.addItems(items); + this.collectionHolder.addAll(items); } catch (UnsupportedOperationException ex) { exCaught = true; } @@ -65,7 +65,7 @@ public class NullCollectionValueModelTests extends TestCase { public void testRemoveItem() { boolean exCaught = false; try { - this.collectionHolder.removeItem("foo"); + this.collectionHolder.remove("foo"); } catch (UnsupportedOperationException ex) { exCaught = true; } @@ -79,7 +79,7 @@ public class NullCollectionValueModelTests extends TestCase { items.add("bar"); items.add("baz"); try { - this.collectionHolder.removeItems(items); + this.collectionHolder.removeAll(items); } catch (UnsupportedOperationException ex) { exCaught = true; } @@ -91,7 +91,7 @@ public class NullCollectionValueModelTests extends TestCase { } public void testValue() { - assertFalse(((Iterator) this.collectionHolder.value()).hasNext()); + assertFalse(((Iterator) this.collectionHolder.values()).hasNext()); } } diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyCollectionValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyCollectionValueModelAdapterTests.java index 3eab855988..d662f6a583 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyCollectionValueModelAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/PropertyCollectionValueModelAdapterTests.java @@ -56,11 +56,11 @@ public class PropertyCollectionValueModelAdapterTests extends TestCase { } public void testValue() { - this.adapter.addCollectionChangeListener(ValueModel.VALUE, new TestListener() { + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { public void itemsAdded(CollectionChangeEvent e) {/* OK */} }); this.wrappedValueHolder.setValue("foo"); - Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); + Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.values()); assertEquals(1, adapterCollection.size()); assertEquals(this.wrappedCollection(), adapterCollection); assertEquals("foo", adapterCollection.iterator().next()); @@ -70,39 +70,39 @@ public class PropertyCollectionValueModelAdapterTests extends TestCase { CollectionChangeListener listener = new TestListener() { public void itemsAdded(CollectionChangeEvent e) {/* OK */} }; - this.adapter.addCollectionChangeListener(ValueModel.VALUE, listener); + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, listener); this.wrappedValueHolder.setValue("foo"); - Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); + Collection adapterCollection = CollectionTools.collection((Iterator) this.adapter.values()); assertEquals(1, adapterCollection.size()); assertEquals(this.wrappedCollection(), adapterCollection); assertEquals("foo", adapterCollection.iterator().next()); - this.adapter.removeCollectionChangeListener(ValueModel.VALUE, listener); - adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); + this.adapter.removeCollectionChangeListener(CollectionValueModel.VALUES, listener); + adapterCollection = CollectionTools.collection((Iterator) this.adapter.values()); assertEquals(0, adapterCollection.size()); assertEquals(new HashBag(), adapterCollection); - this.adapter.addCollectionChangeListener(ValueModel.VALUE, listener); - adapterCollection = CollectionTools.collection((Iterator) this.adapter.value()); + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, listener); + adapterCollection = CollectionTools.collection((Iterator) this.adapter.values()); assertEquals(1, adapterCollection.size()); assertEquals(this.wrappedCollection(), adapterCollection); assertEquals("foo", adapterCollection.iterator().next()); } public void testHasListeners() { - assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); SynchronizedBag synchCollection = new SynchronizedBag(this.adapter); - assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(ValueModel.VALUE)); - this.adapter.removeCollectionChangeListener(ValueModel.VALUE, synchCollection); - assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); + this.adapter.removeCollectionChangeListener(CollectionValueModel.VALUES, synchCollection); + assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); this.adapter.addCollectionChangeListener(synchCollection); - assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); this.adapter.removeCollectionChangeListener(synchCollection); - assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); } public void testListChangedToEmpty() { - this.adapter.addCollectionChangeListener(ValueModel.VALUE, new TestListener() { + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { public void itemsAdded(CollectionChangeEvent e) {/* OK */} public void itemsRemoved(CollectionChangeEvent e) {/* OK */} }); @@ -113,7 +113,7 @@ public class PropertyCollectionValueModelAdapterTests extends TestCase { } public void testCollectionChangedFromEmpty() { - this.adapter.addCollectionChangeListener(ValueModel.VALUE, new TestListener() { + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { public void itemsAdded(CollectionChangeEvent e) {/* OK */} }); JList jList = new JList(new ListModelAdapter(this.adapter)); @@ -123,7 +123,7 @@ public class PropertyCollectionValueModelAdapterTests extends TestCase { } public void testCollectionChangedFromEmptyToEmpty() { - this.adapter.addCollectionChangeListener(ValueModel.VALUE, new TestListener()); + this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener()); JList jList = new JList(new ListModelAdapter(this.adapter)); this.wrappedValueHolder.setValue(null); diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ReadOnlyCollectionValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ReadOnlyCollectionValueModelTests.java index 929b7d2e18..0cb8e11f2a 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ReadOnlyCollectionValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/ReadOnlyCollectionValueModelTests.java @@ -37,7 +37,7 @@ public class ReadOnlyCollectionValueModelTests extends TestCase { private CollectionValueModel buildCollectionHolder() { return new AbstractReadOnlyCollectionValueModel() { - public Object value() { + public Iterator values() { return ReadOnlyCollectionValueModelTests.collection(); } }; @@ -68,7 +68,7 @@ public class ReadOnlyCollectionValueModelTests extends TestCase { } public void testValue() { - assertEquals(buildCollection(), CollectionTools.bag((Iterator) this.collectionHolder.value())); + assertEquals(buildCollection(), CollectionTools.bag((Iterator) this.collectionHolder.values())); } public void testSize() { diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleCollectionValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleCollectionValueModelTests.java index 26446aae96..bc1f7a5e21 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleCollectionValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SimpleCollectionValueModelTests.java @@ -92,33 +92,33 @@ public class SimpleCollectionValueModelTests extends TestCase { } public void testValue() { - assertEquals(this.buildBag(), CollectionTools.bag((Iterator) this.bagHolder.value())); - assertEquals(this.buildSet(), CollectionTools.set((Iterator) this.setHolder.value())); + assertEquals(this.buildBag(), CollectionTools.bag((Iterator) this.bagHolder.values())); + assertEquals(this.buildSet(), CollectionTools.set((Iterator) this.setHolder.values())); } public void testSize() { - assertEquals(this.buildBag().size(), CollectionTools.size((Iterator) this.bagHolder.value())); - assertEquals(this.buildSet().size(), CollectionTools.size((Iterator) this.setHolder.value())); + assertEquals(this.buildBag().size(), CollectionTools.size((Iterator) this.bagHolder.values())); + assertEquals(this.buildSet().size(), CollectionTools.size((Iterator) this.setHolder.values())); } private boolean bagHolderContains(Object item) { - return CollectionTools.contains((Iterator) this.bagHolder.value(), item); + return CollectionTools.contains((Iterator) this.bagHolder.values(), item); } private boolean setHolderContains(Object item) { - return CollectionTools.contains((Iterator) this.setHolder.value(), item); + return CollectionTools.contains((Iterator) this.setHolder.values(), item); } private boolean bagHolderContainsAll(Collection<String> items) { - return CollectionTools.containsAll((Iterator) this.bagHolder.value(), items); + return CollectionTools.containsAll((Iterator) this.bagHolder.values(), items); } private boolean setHolderContainsAll(Collection<String> items) { - return CollectionTools.containsAll((Iterator) this.setHolder.value(), items); + return CollectionTools.containsAll((Iterator) this.setHolder.values(), items); } private boolean bagHolderContainsAny(Collection<String> items) { - Bag bag = CollectionTools.bag((Iterator) this.bagHolder.value()); + Bag bag = CollectionTools.bag((Iterator) this.bagHolder.values()); for (String string : items) { if (bag.contains(string)) { return true; @@ -128,7 +128,7 @@ public class SimpleCollectionValueModelTests extends TestCase { } private boolean setHolderContainsAny(Collection<String> items) { - Set set = CollectionTools.set((Iterator) this.setHolder.value()); + Set set = CollectionTools.set((Iterator) this.setHolder.values()); for (String string : items) { if (set.contains(string)) { return true; @@ -139,59 +139,59 @@ public class SimpleCollectionValueModelTests extends TestCase { public void testAddItem() { assertFalse(this.bagHolderContains("joo")); - this.bagHolder.addItem("joo"); + this.bagHolder.add("joo"); assertTrue(this.bagHolderContains("joo")); assertFalse(this.bagHolderContains(null)); - this.bagHolder.addItem(null); + this.bagHolder.add(null); assertTrue(this.bagHolderContains(null)); assertFalse(this.setHolderContains("joo")); - this.setHolder.addItem("joo"); + this.setHolder.add("joo"); assertTrue(this.setHolderContains("joo")); assertFalse(this.setHolderContains(null)); - this.setHolder.addItem(null); + this.setHolder.add(null); assertTrue(this.setHolderContains(null)); } public void testAddItems() { assertFalse(this.bagHolderContainsAny(this.buildAddItems())); - this.bagHolder.addItems(this.buildAddItems()); + this.bagHolder.addAll(this.buildAddItems()); assertTrue(this.bagHolderContainsAll(this.buildAddItems())); assertFalse(this.setHolderContainsAny(this.buildAddItems())); - this.setHolder.addItems(this.buildAddItems()); + this.setHolder.addAll(this.buildAddItems()); assertTrue(this.setHolderContainsAll(this.buildAddItems())); } public void testRemoveItem() { assertTrue(this.bagHolderContains("bar")); - this.bagHolder.removeItem("bar"); + this.bagHolder.remove("bar"); assertFalse(this.bagHolderContains("bar")); - this.bagHolder.addItem(null); + this.bagHolder.add(null); assertTrue(this.bagHolderContains(null)); - this.bagHolder.removeItem(null); + this.bagHolder.remove(null); assertFalse(this.bagHolderContains(null)); assertTrue(this.setHolderContains("bar")); - this.setHolder.removeItem("bar"); + this.setHolder.remove("bar"); assertFalse(this.setHolderContains("bar")); - this.setHolder.addItem(null); + this.setHolder.add(null); assertTrue(this.setHolderContains(null)); - this.setHolder.removeItem(null); + this.setHolder.remove(null); assertFalse(this.setHolderContains(null)); } public void testRemoveItems() { assertTrue(this.bagHolderContainsAll(this.buildRemoveItems())); - this.bagHolder.removeItems(this.buildRemoveItems()); + this.bagHolder.removeAll(this.buildRemoveItems()); assertFalse(this.bagHolderContainsAny(this.buildRemoveItems())); assertTrue(this.setHolderContainsAll(this.buildRemoveItems())); - this.setHolder.removeItems(this.buildRemoveItems()); + this.setHolder.removeAll(this.buildRemoveItems()); assertFalse(this.setHolderContainsAny(this.buildRemoveItems())); } @@ -202,9 +202,9 @@ public class SimpleCollectionValueModelTests extends TestCase { assertFalse(this.bagHolderContains("bar")); assertTrue(this.bagHolderContains("jar")); - this.bagHolder.addItem(null); + this.bagHolder.add(null); assertTrue(this.bagHolderContains(null)); - this.bagHolder.removeItem(null); + this.bagHolder.remove(null); assertFalse(this.bagHolderContains(null)); ((SimpleCollectionValueModel) this.bagHolder).setValue(null); @@ -216,9 +216,9 @@ public class SimpleCollectionValueModelTests extends TestCase { assertFalse(this.setHolderContains("bar")); assertTrue(this.setHolderContains("jar")); - this.setHolder.addItem(null); + this.setHolder.add(null); assertTrue(this.setHolderContains(null)); - this.setHolder.removeItem(null); + this.setHolder.remove(null); assertFalse(this.setHolderContains(null)); ((SimpleCollectionValueModel) this.setHolder).setValue(null); @@ -234,47 +234,47 @@ public class SimpleCollectionValueModelTests extends TestCase { } public void testCollectionChange2() { - this.bagHolder.addCollectionChangeListener(ValueModel.VALUE, this.buildBagListener()); + this.bagHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildBagListener()); this.verifyBagChange(); - this.setHolder.addCollectionChangeListener(ValueModel.VALUE, this.buildSetListener()); + this.setHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildSetListener()); this.verifySetChange(); } private void verifyBagChange() { this.bagEvent = null; this.bagEventType = null; - this.bagHolder.addItem("foo"); + this.bagHolder.add("foo"); this.verifyBagEvent(ADD, "foo"); this.bagEvent = null; this.bagEventType = null; - this.bagHolder.addItem("foo"); + this.bagHolder.add("foo"); this.verifyBagEvent(ADD, "foo"); this.bagEvent = null; this.bagEventType = null; - this.bagHolder.addItem("joo"); + this.bagHolder.add("joo"); this.verifyBagEvent(ADD, "joo"); this.bagEvent = null; this.bagEventType = null; - this.bagHolder.addItem(null); + this.bagHolder.add(null); this.verifyBagEvent(ADD, null); this.bagEvent = null; this.bagEventType = null; - this.bagHolder.addItem(null); + this.bagHolder.add(null); this.verifyBagEvent(ADD, null); this.bagEvent = null; this.bagEventType = null; - this.bagHolder.removeItem("joo"); + this.bagHolder.remove("joo"); this.verifyBagEvent(REMOVE, "joo"); this.bagEvent = null; this.bagEventType = null; - this.bagHolder.removeItem(null); + this.bagHolder.remove(null); this.verifyBagEvent(REMOVE, null); this.bagEvent = null; @@ -284,7 +284,7 @@ public class SimpleCollectionValueModelTests extends TestCase { this.bagEvent = null; this.bagEventType = null; - this.bagHolder.addItems(this.buildBag()); + this.bagHolder.addAll(this.buildBag()); this.verifyBagEvent(ADD); assertEquals(this.buildBag(), CollectionTools.bag(this.bagEvent.items())); } @@ -292,46 +292,46 @@ public class SimpleCollectionValueModelTests extends TestCase { private void verifySetChange() { this.setEvent = null; this.setEventType = null; - this.setHolder.addItem("foo"); + this.setHolder.add("foo"); assertNull(this.setEvent); assertNull(this.setEventType); this.setEvent = null; this.setEventType = null; - this.setHolder.addItem("joo"); + this.setHolder.add("joo"); this.verifySetEvent(ADD, "joo"); this.setEvent = null; this.setEventType = null; - this.setHolder.addItem("joo"); + this.setHolder.add("joo"); assertNull(this.setEvent); assertNull(this.setEventType); this.setEvent = null; this.setEventType = null; - this.setHolder.addItem(null); + this.setHolder.add(null); this.verifySetEvent(ADD, null); this.setEvent = null; this.setEventType = null; - this.setHolder.addItem(null); + this.setHolder.add(null); assertNull(this.setEvent); assertNull(this.setEventType); this.setEvent = null; this.setEventType = null; - this.setHolder.removeItem("joo"); + this.setHolder.remove("joo"); this.verifySetEvent(REMOVE, "joo"); this.setEvent = null; this.setEventType = null; - this.setHolder.removeItem("joo"); + this.setHolder.remove("joo"); assertNull(this.setEvent); assertNull(this.setEventType); this.setEvent = null; this.setEventType = null; - this.setHolder.removeItem(null); + this.setHolder.remove(null); this.verifySetEvent(REMOVE, null); this.setEvent = null; @@ -341,7 +341,7 @@ public class SimpleCollectionValueModelTests extends TestCase { this.setEvent = null; this.setEventType = null; - this.setHolder.addItems(this.buildSet()); + this.setHolder.addAll(this.buildSet()); assertNull(this.setEvent); assertNull(this.setEventType); } @@ -391,7 +391,7 @@ public class SimpleCollectionValueModelTests extends TestCase { private void verifyBagEvent(String eventType) { assertEquals(eventType, this.bagEventType); assertEquals(this.bagHolder, this.bagEvent.getSource()); - assertEquals(ValueModel.VALUE, this.bagEvent.collectionName()); + assertEquals(CollectionValueModel.VALUES, this.bagEvent.collectionName()); } private void verifyBagEvent(String eventType, Object item) { @@ -402,7 +402,7 @@ public class SimpleCollectionValueModelTests extends TestCase { private void verifySetEvent(String eventType) { assertEquals(eventType, this.setEventType); assertEquals(this.setHolder, this.setEvent.getSource()); - assertEquals(ValueModel.VALUE, this.setEvent.collectionName()); + assertEquals(CollectionValueModel.VALUES, this.setEvent.collectionName()); } private void verifySetEvent(String eventType, Object item) { diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SortedListValueModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SortedListValueModelAdapterTests.java index bb9c30195f..919705308f 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SortedListValueModelAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SortedListValueModelAdapterTests.java @@ -73,9 +73,9 @@ public class SortedListValueModelAdapterTests extends TestCase { public void itemsAdded(ListChangeEvent e) {/* OK */} public void itemsReplaced(ListChangeEvent e) {/* OK */} }); - this.wrappedCollectionHolder.addItem("foo"); - this.wrappedCollectionHolder.addItem("bar"); - this.wrappedCollectionHolder.addItem("baz"); + this.wrappedCollectionHolder.add("foo"); + this.wrappedCollectionHolder.add("bar"); + this.wrappedCollectionHolder.add("baz"); assertEquals(3, this.adapter.size()); this.verifyList(this.wrappedCollection, this.adapter); } @@ -83,13 +83,13 @@ public class SortedListValueModelAdapterTests extends TestCase { public void testAddItem() { List synchList = new SynchronizedList(this.adapter); Bag synchCollection = new SynchronizedBag(this.wrappedCollectionHolder); - this.wrappedCollectionHolder.addItem("foo"); + this.wrappedCollectionHolder.add("foo"); assertTrue(this.wrappedCollection.contains("foo")); - this.wrappedCollectionHolder.addItem("bar"); - this.wrappedCollectionHolder.addItem("baz"); - this.wrappedCollectionHolder.addItem("joo"); - this.wrappedCollectionHolder.addItem("jar"); - this.wrappedCollectionHolder.addItem("jaz"); + this.wrappedCollectionHolder.add("bar"); + this.wrappedCollectionHolder.add("baz"); + this.wrappedCollectionHolder.add("joo"); + this.wrappedCollectionHolder.add("jar"); + this.wrappedCollectionHolder.add("jaz"); assertEquals(6, this.wrappedCollection.size()); this.verifyList(this.wrappedCollection, this.adapter); @@ -100,15 +100,15 @@ public class SortedListValueModelAdapterTests extends TestCase { public void testRemoveItem() { List synchList = new SynchronizedList(this.adapter); Bag synchCollection = new SynchronizedBag(this.wrappedCollectionHolder); - this.wrappedCollectionHolder.addItem("foo"); - this.wrappedCollectionHolder.addItem("bar"); - this.wrappedCollectionHolder.addItem("baz"); - this.wrappedCollectionHolder.addItem("joo"); - this.wrappedCollectionHolder.addItem("jar"); - this.wrappedCollectionHolder.addItem("jaz"); - this.wrappedCollectionHolder.removeItem("jaz"); + this.wrappedCollectionHolder.add("foo"); + this.wrappedCollectionHolder.add("bar"); + this.wrappedCollectionHolder.add("baz"); + this.wrappedCollectionHolder.add("joo"); + this.wrappedCollectionHolder.add("jar"); + this.wrappedCollectionHolder.add("jaz"); + this.wrappedCollectionHolder.remove("jaz"); assertFalse(this.wrappedCollection.contains("jaz")); - this.wrappedCollectionHolder.removeItem("foo"); + this.wrappedCollectionHolder.remove("foo"); assertFalse(this.wrappedCollection.contains("foo")); assertEquals(4, this.wrappedCollection.size()); @@ -123,15 +123,15 @@ public class SortedListValueModelAdapterTests extends TestCase { public void itemsRemoved(ListChangeEvent e) {/* OK */} public void itemsReplaced(ListChangeEvent e) {/* OK */} }); - this.wrappedCollectionHolder.addItem("foo"); - this.wrappedCollectionHolder.addItem("bar"); - this.wrappedCollectionHolder.addItem("baz"); - this.wrappedCollectionHolder.addItem("joo"); - this.wrappedCollectionHolder.addItem("jar"); - this.wrappedCollectionHolder.addItem("jaz"); - this.wrappedCollectionHolder.removeItem("jaz"); + this.wrappedCollectionHolder.add("foo"); + this.wrappedCollectionHolder.add("bar"); + this.wrappedCollectionHolder.add("baz"); + this.wrappedCollectionHolder.add("joo"); + this.wrappedCollectionHolder.add("jar"); + this.wrappedCollectionHolder.add("jaz"); + this.wrappedCollectionHolder.remove("jaz"); assertFalse(this.wrappedCollection.contains("jaz")); - this.wrappedCollectionHolder.removeItem("foo"); + this.wrappedCollectionHolder.remove("foo"); assertFalse(this.wrappedCollection.contains("foo")); assertEquals(4, this.wrappedCollection.size()); @@ -141,13 +141,13 @@ public class SortedListValueModelAdapterTests extends TestCase { public void testSetComparator() { List synchList = new SynchronizedList(this.adapter); Bag synchCollection = new SynchronizedBag(this.wrappedCollectionHolder); - this.wrappedCollectionHolder.addItem("foo"); + this.wrappedCollectionHolder.add("foo"); assertTrue(this.wrappedCollection.contains("foo")); - this.wrappedCollectionHolder.addItem("bar"); - this.wrappedCollectionHolder.addItem("baz"); - this.wrappedCollectionHolder.addItem("joo"); - this.wrappedCollectionHolder.addItem("jar"); - this.wrappedCollectionHolder.addItem("jaz"); + this.wrappedCollectionHolder.add("bar"); + this.wrappedCollectionHolder.add("baz"); + this.wrappedCollectionHolder.add("joo"); + this.wrappedCollectionHolder.add("jar"); + this.wrappedCollectionHolder.add("jaz"); assertEquals(6, this.wrappedCollection.size()); this.verifyList(this.wrappedCollection, this.adapter); diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SynchronizedBag.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SynchronizedBag.java index 0b8eeb0d9b..3ca2d93678 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SynchronizedBag.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/SynchronizedBag.java @@ -29,7 +29,7 @@ class SynchronizedBag<E> implements Bag<E>, CollectionChangeListener { private Bag<E> synchBag = new HashBag<E>(); SynchronizedBag(CollectionValueModel cvm) { - cvm.addCollectionChangeListener(ValueModel.VALUE, this); + cvm.addCollectionChangeListener(CollectionValueModel.VALUES, this); } @@ -126,7 +126,7 @@ class SynchronizedBag<E> implements Bag<E>, CollectionChangeListener { public void collectionChanged(CollectionChangeEvent e) { this.synchBag.clear(); - CollectionTools.addAll(this.synchBag, (Iterator) ((CollectionValueModel) e.getSource()).value()); + CollectionTools.addAll(this.synchBag, (Iterator) ((CollectionValueModel) e.getSource()).values()); } diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesCollectionValueModelTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesCollectionValueModelTests.java index 89b27635e2..b4466bef15 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesCollectionValueModelTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/prefs/PreferencesCollectionValueModelTests.java @@ -23,6 +23,7 @@ import org.eclipse.jpt.utility.internal.model.event.CollectionChangeEvent; import org.eclipse.jpt.utility.internal.model.event.PropertyChangeEvent; import org.eclipse.jpt.utility.internal.model.listener.CollectionChangeListener; import org.eclipse.jpt.utility.internal.model.listener.PropertyChangeListener; +import org.eclipse.jpt.utility.internal.model.value.CollectionValueModel; import org.eclipse.jpt.utility.internal.model.value.PropertyValueModel; import org.eclipse.jpt.utility.internal.model.value.SimplePropertyValueModel; import org.eclipse.jpt.utility.internal.model.value.ValueModel; @@ -60,7 +61,7 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase { this.preferencesAdapter = new PreferencesCollectionValueModel(this.nodeHolder); this.listener = this.buildCollectionChangeListener(); this.itemListener = this.buildItemListener(); - this.preferencesAdapter.addCollectionChangeListener(ValueModel.VALUE, this.listener); + this.preferencesAdapter.addCollectionChangeListener(CollectionValueModel.VALUES, this.listener); this.event = null; } @@ -120,7 +121,7 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase { this.expectedValues.clear(); this.nodeHolder.setValue(null); this.verifyEvent(this.expectedValues); - assertFalse(((Iterator) this.preferencesAdapter.value()).hasNext()); + assertFalse(((Iterator) this.preferencesAdapter.values()).hasNext()); this.event = null; this.nodeHolder.setValue(this.testNode); @@ -156,7 +157,7 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase { assertNotNull(this.event); assertEquals(this.preferencesAdapter, this.event.getSource()); - assertEquals(ValueModel.VALUE, this.event.collectionName()); + assertEquals(CollectionValueModel.VALUES, this.event.collectionName()); assertEquals(1, this.event.itemsSize()); assertEquals(KEY_NAME_2, ((PreferencePropertyValueModel) this.event.items().next()).getKey()); @@ -191,7 +192,7 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase { * - the node will throw an IllegalStateException - the adapter should handle it OK... */ public void testRemoveNode() throws Exception { - assertTrue(this.preferencesAdapter.hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(this.preferencesAdapter.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); Preferences parent = this.testNode.parent(); parent.addNodeChangeListener(this.buildParentNodeChangeListener()); @@ -200,7 +201,7 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase { this.waitForEventQueueToClear(); assertTrue(this.listenerRemoved); - assertFalse(this.preferencesAdapter.hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertFalse(this.preferencesAdapter.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); } private NodeChangeListener buildParentNodeChangeListener() { @@ -210,7 +211,7 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase { } public void childRemoved(NodeChangeEvent e) { if (e.getChild() == PreferencesCollectionValueModelTests.this.testNode) { - PreferencesCollectionValueModelTests.this.preferencesAdapter.removeCollectionChangeListener(ValueModel.VALUE, PreferencesCollectionValueModelTests.this.listener); + PreferencesCollectionValueModelTests.this.preferencesAdapter.removeCollectionChangeListener(CollectionValueModel.VALUES, PreferencesCollectionValueModelTests.this.listener); // this line of code will not execute if the line above triggers an exception PreferencesCollectionValueModelTests.this.listenerRemoved = true; } @@ -219,25 +220,25 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase { } public void testHasListeners() throws Exception { - assertTrue(this.preferencesAdapter.hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(this.preferencesAdapter.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); assertTrue(this.nodeHasAnyPrefListeners(this.testNode)); - this.preferencesAdapter.removeCollectionChangeListener(ValueModel.VALUE, this.listener); + this.preferencesAdapter.removeCollectionChangeListener(CollectionValueModel.VALUES, this.listener); assertFalse(this.nodeHasAnyPrefListeners(this.testNode)); - assertFalse(this.preferencesAdapter.hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertFalse(this.preferencesAdapter.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); CollectionChangeListener listener2 = this.buildCollectionChangeListener(); this.preferencesAdapter.addCollectionChangeListener(listener2); - assertTrue(this.preferencesAdapter.hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertTrue(this.preferencesAdapter.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); assertTrue(this.nodeHasAnyPrefListeners(this.testNode)); this.preferencesAdapter.removeCollectionChangeListener(listener2); assertFalse(this.nodeHasAnyPrefListeners(this.testNode)); - assertFalse(this.preferencesAdapter.hasAnyCollectionChangeListeners(ValueModel.VALUE)); + assertFalse(this.preferencesAdapter.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); } private void verifyEvent(Map items) { assertNotNull(this.event); assertEquals(this.preferencesAdapter, this.event.getSource()); - assertEquals(ValueModel.VALUE, this.event.collectionName()); + assertEquals(CollectionValueModel.VALUES, this.event.collectionName()); assertEquals(items.size(), this.event.itemsSize()); this.verifyItems(items, this.event.items()); } @@ -252,7 +253,7 @@ public class PreferencesCollectionValueModelTests extends PreferencesTestCase { private void verifyAdapter(PreferencesCollectionValueModel cvm) { assertEquals(this.expectedValues.size(), cvm.size()); - this.verifyItems(this.expectedValues, (Iterator) cvm.value()); + this.verifyItems(this.expectedValues, (Iterator) cvm.values()); } private void verifyItems(Map expected, Iterator stream) { diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterTests.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterTests.java index a66c76cc3b..a7eb90e405 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterTests.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/ListModelAdapterTests.java @@ -58,17 +58,17 @@ public class ListModelAdapterTests extends TestCase { assertEquals(6, synchList.size()); this.compare(listModel, synchList); - collectionHolder.addItem("tom"); - collectionHolder.addItem("dick"); - collectionHolder.addItem("harry"); - collectionHolder.addItem(null); + collectionHolder.add("tom"); + collectionHolder.add("dick"); + collectionHolder.add("harry"); + collectionHolder.add(null); assertEquals(10, synchList.size()); this.compare(listModel, synchList); - collectionHolder.removeItem("foo"); - collectionHolder.removeItem("jar"); - collectionHolder.removeItem("harry"); - collectionHolder.removeItem(null); + collectionHolder.remove("foo"); + collectionHolder.remove("jar"); + collectionHolder.remove("harry"); + collectionHolder.remove(null); assertEquals(6, synchList.size()); this.compare(listModel, synchList); } @@ -156,15 +156,15 @@ public class ListModelAdapterTests extends TestCase { assertEquals(6, synchList.size()); this.compareSort(listModel, synchList, comparator); - collectionHolder.addItem("tom"); - collectionHolder.addItem("dick"); - collectionHolder.addItem("harry"); + collectionHolder.add("tom"); + collectionHolder.add("dick"); + collectionHolder.add("harry"); assertEquals(9, synchList.size()); this.compareSort(listModel, synchList, comparator); - collectionHolder.removeItem("foo"); - collectionHolder.removeItem("jar"); - collectionHolder.removeItem("harry"); + collectionHolder.remove("foo"); + collectionHolder.remove("jar"); + collectionHolder.remove("harry"); assertEquals(6, synchList.size()); this.compareSort(listModel, synchList, comparator); } diff --git a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterUITest.java b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterUITest.java index 37e97bfc14..146757de5e 100644 --- a/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterUITest.java +++ b/jpa/tests/org.eclipse.jpt.utility.tests/src/org/eclipse/jpt/utility/tests/internal/model/value/swing/TableModelAdapterUITest.java @@ -88,7 +88,7 @@ import org.eclipse.jpt.utility.tests.internal.model.value.swing.TableModelAdapte * list value model (the sorted people adapter) */ public class TableModelAdapterUITest { - private CollectionValueModel eyeColorListHolder; + private CollectionValueModel eyeColorsHolder; private PropertyValueModel crowdHolder; private PropertyValueModel selectedPersonHolder; private ListValueModel sortedPeopleAdapter; @@ -107,7 +107,7 @@ public class TableModelAdapterUITest { protected void exec(String[] args) throws Exception { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - this.eyeColorListHolder = this. buildEyeColorCollectionHolder(); + this.eyeColorsHolder = this. buildEyeColorCollectionHolder(); this.crowdHolder = this.buildCrowdHolder(); this.selectedPersonHolder = this.buildSelectedPersonHolder(); this.sortedPeopleAdapter = this.buildSortedPeopleAdapter(); @@ -298,7 +298,7 @@ public class TableModelAdapterUITest { } private ComboBoxModel buildReadOnlyEyeColorComboBoxModel() { - return new ComboBoxModelAdapter(this.eyeColorListHolder, new SimplePropertyValueModel()); + return new ComboBoxModelAdapter(this.eyeColorsHolder, new SimplePropertyValueModel()); } private ListCellRenderer buildEyeColorRenderer() { @@ -431,7 +431,7 @@ public class TableModelAdapterUITest { void addEyeColor() { String color = this.promptUserForEyeColor(); if (color != null) { - this.eyeColorListHolder.addItem(color); + this.eyeColorsHolder.add(color); } } @@ -443,7 +443,7 @@ public class TableModelAdapterUITest { } if ((eyeColor.length() == 0)) { JOptionPane.showMessageDialog(null, "The eye color is required.", "Invalid Eye Color", JOptionPane.ERROR_MESSAGE); - } else if (CollectionTools.contains((Iterator) this.eyeColorListHolder.value(), eyeColor)) { + } else if (CollectionTools.contains((Iterator) this.eyeColorsHolder.values(), eyeColor)) { JOptionPane.showMessageDialog(null, "The eye color already exists.", "Invalid Eye Color", JOptionPane.ERROR_MESSAGE); } else { return eyeColor; @@ -601,7 +601,7 @@ public class TableModelAdapterUITest { } private ComboBoxModel buildEyeColorComboBoxModel() { - return new ComboBoxModelAdapter(this.eyeColorListHolder, this.buildEyeColorAdapter()); + return new ComboBoxModelAdapter(this.eyeColorsHolder, this.buildEyeColorAdapter()); } private PropertyValueModel buildEyeColorAdapter() { |