dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09888
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2680: Minor fix
------------------------------------------------------------
revno: 2680
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-01-20 22:14:33 +0100
message:
Minor fix
modified:
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java
dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/PaginatedListTest.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java 2011-01-20 19:55:28 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/util/PaginatedList.java 2011-01-20 21:14:33 +0000
@@ -71,6 +71,14 @@
}
/**
+ * Sets the current page position to the first page.
+ */
+ public void reset()
+ {
+ fromIndex = 0;
+ }
+
+ /**
* Returns the number of pages in the list.
*/
public int pageSize()
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/PaginatedListTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/PaginatedListTest.java 2011-01-20 19:55:28 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/util/PaginatedListTest.java 2011-01-20 21:14:33 +0000
@@ -88,4 +88,16 @@
assertEquals( 3, list.pageSize() );
}
+
+ @Test
+ public void testReset()
+ {
+ PaginatedList<String> list = new PaginatedList<String>( Arrays.asList( "A", "B", "C" ), 2 );
+
+ assertTrue( list.nextPage().contains( "A" ) );
+
+ list.reset();
+
+ assertTrue( list.nextPage().contains( "A" ) );
+ }
}