=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java 2010-12-02 17:54:22 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/indicator/IndicatorService.java 2010-12-02 18:13:14 +0000 @@ -148,4 +148,12 @@ Collection getAllIndicatorGroupSets(); Collection getIndicatorGroupSets( Collection identifiers ); + + Collection getIndicatorGroupSetsBetween( int first, int max ); + + Collection getIndicatorGroupSetsBetweenByName( String name, int first, int max ); + + int getIndicatorGroupSetCount(); + + int getIndicatorGroupSetCountByName( String name ); } === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java 2010-12-02 17:54:22 +0000 +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/indicator/DefaultIndicatorService.java 2010-12-02 18:13:14 +0000 @@ -430,4 +430,24 @@ } ); } + public int getIndicatorGroupSetCountByName( String name ) + { + return indicatorGroupSetStore.getCountByName( name ); + } + + public int getIndicatorGroupSetCount() + { + return indicatorGroupSetStore.getCount(); + } + + public Collection getIndicatorGroupSetsBetween( int first, int max ) + { + return i18n( i18nService, indicatorGroupSetStore.getBetween( first, max ) ); + } + + public Collection getIndicatorGroupSetsBetweenByName( String name, int first, int max ) + { + return i18n( i18nService, indicatorGroupSetStore.getBetweenByName( name, first, max ) ); + } + } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/ListIndicatorGroupSetAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/ListIndicatorGroupSetAction.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroupset/ListIndicatorGroupSetAction.java 2010-12-02 18:13:14 +0000 @@ -27,13 +27,17 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +import static org.apache.commons.lang.StringUtils.isNotBlank; + import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.hisp.dhis.indicator.IndicatorGroup; import org.hisp.dhis.indicator.IndicatorGroupSet; import org.hisp.dhis.indicator.IndicatorService; import org.hisp.dhis.indicator.comparator.IndicatorGroupSetNameComparator; +import org.hisp.dhis.paging.ActionPagingSupport; import com.opensymphony.xwork2.Action; @@ -42,7 +46,7 @@ * @version $Id$ */ public class ListIndicatorGroupSetAction - implements Action + extends ActionPagingSupport { // ------------------------------------------------------------------------- // Dependencies @@ -56,7 +60,7 @@ } // ------------------------------------------------------------------------- - // Output + // Input & Output // ------------------------------------------------------------------------- private List indicatorGroupSets; @@ -65,6 +69,18 @@ { return indicatorGroupSets; } + + private String key; + + public String getKey() + { + return key; + } + + public void setKey( String key ) + { + this.key = key; + } // ------------------------------------------------------------------------- // Action implementation @@ -73,8 +89,19 @@ public String execute() throws Exception { - indicatorGroupSets = new ArrayList( indicatorService.getAllIndicatorGroupSets() ); - + if ( isNotBlank( key ) ) // Filter on key only if set + { + this.paging = createPaging( indicatorService.getIndicatorGroupSetCountByName( key ) ); + + indicatorGroupSets = new ArrayList( indicatorService.getIndicatorGroupSetsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) ); + } + else + { + this.paging = createPaging( indicatorService.getIndicatorGroupSetCount() ); + + indicatorGroupSets = new ArrayList( indicatorService.getIndicatorGroupSetsBetween( paging.getStartPos(), paging.getPageSize() ) ); + } + Collections.sort( indicatorGroupSets, new IndicatorGroupSetNameComparator() ); return SUCCESS; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2010-12-02 17:54:22 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/struts.xml 2010-12-02 18:13:14 +0000 @@ -548,6 +548,7 @@ /dhis-web-maintenance-datadictionary/indicatorGroupSet.vm /dhis-web-maintenance-datadictionary/menu.vm javascript/indicatorGroupSet.js + ../dhis-web-commons/paging/paging.css - +
$i18n.getString( "filter_by_name" ):
#filterDiv( "indicatorGroupSet" )
@@ -34,6 +34,8 @@ #end
+

+ #parse( "/dhis-web-commons/paging/paging.vm" )