Revision: 1234
Author: mathiasbr
Date: 2006-07-25 05:36:54 -0700 (Tue, 25 Jul 2006)
ViewCVS: http://svn.sourceforge.net/spring-rich-c/?rev=1234&view=rev
Log Message:
-----------
patch applied from RCP-280, thanks to Markus Rogg
Modified Paths:
--------------
trunk/spring-richclient/support/src/main/java/org/springframework/binding/value/support/ListListModel.java
Added Paths:
-----------
trunk/spring-richclient/support/src/test/java/org/springframework/binding/value/support/ListListModelTests.java
Modified:
trunk/spring-richclient/support/src/main/java/org/springframework/binding/value/support/ListListModel.java
===================================================================
---
trunk/spring-richclient/support/src/main/java/org/springframework/binding/value/support/ListListModel.java
2006-07-25 12:20:29 UTC (rev 1233)
+++
trunk/spring-richclient/support/src/main/java/org/springframework/binding/value/support/ListListModel.java
2006-07-25 12:36:54 UTC (rev 1234)
@@ -130,7 +130,7 @@
}
public boolean addAll(Collection c) {
- int firstIndex = items.size() > 0 ? items.size() - 1 : 0;
+ int firstIndex = items.size();
boolean result = items.addAll(c);
if (result) {
int lastIndex = items.size() - 1;
Added:
trunk/spring-richclient/support/src/test/java/org/springframework/binding/value/support/ListListModelTests.java
===================================================================
---
trunk/spring-richclient/support/src/test/java/org/springframework/binding/value/support/ListListModelTests.java
(rev 0)
+++
trunk/spring-richclient/support/src/test/java/org/springframework/binding/value/support/ListListModelTests.java
2006-07-25 12:36:54 UTC (rev 1234)
@@ -0,0 +1,48 @@
+package org.springframework.binding.value.support;
+
+import java.util.Arrays;
+
+import javax.swing.event.ListDataEvent;
+import javax.swing.event.ListDataListener;
+
+import junit.framework.TestCase;
+
+public class ListListModelTests extends TestCase {
+
+ private TestListDataListener listener;
+
+ protected void setUp() throws Exception {
+ listener = new TestListDataListener();
+ }
+
+ public void testAddAllCollection() {
+ ListListModel model = new ListListModel(Arrays.asList(new Object[] {
"1", "2", "3" }));
+ model.addListDataListener(listener);
+ model.addAll(Arrays.asList(new Object[] { "4", "5", "6" }));
+ assertNotNull(listener.intervalAddedEvent);
+ assertEquals(3, listener.intervalAddedEvent.getIndex0());
+ assertEquals(5, listener.intervalAddedEvent.getIndex1());
+ }
+
+ private static class TestListDataListener implements ListDataListener {
+
+ ListDataEvent contentsChangedEvent;
+
+ ListDataEvent intervalAddedEvent;
+
+ ListDataEvent intervalRemovedEvent;
+
+ public void contentsChanged(ListDataEvent e) {
+ contentsChangedEvent = e;
+ }
+
+ public void intervalAdded(ListDataEvent e) {
+ intervalAddedEvent = e;
+ }
+
+ public void intervalRemoved(ListDataEvent e) {
+ intervalRemovedEvent = e;
+ }
+
+ }
+}
Property changes on:
trunk/spring-richclient/support/src/test/java/org/springframework/binding/value/support/ListListModelTests.java
___________________________________________________________________
Name: svn:keywords
+ URL Author Revision Date
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
spring-rich-c-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spring-rich-c-cvs