dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07259
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2048: Added an interface to Grid in api
------------------------------------------------------------
revno: 2048
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Fri 2010-09-03 14:44:40 +0200
message:
Added an interface to Grid in api
renamed:
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/Grid.java => dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java
dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java
dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/grid/GridTest.java
dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.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-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java 2010-09-01 08:32:05 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/patient/hibernate/HibernatePatientIdentifierStore.java 2010-09-03 12:44:40 +0000
@@ -28,7 +28,6 @@
package org.hisp.dhis.patient.hibernate;
import java.util.Collection;
-import java.util.List;
import org.hibernate.Query;
import org.hibernate.criterion.Projections;
@@ -36,7 +35,6 @@
import org.hisp.dhis.hibernate.HibernateGenericStore;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.patient.Patient;
-import org.hisp.dhis.patient.PatientAttribute;
import org.hisp.dhis.patient.PatientIdentifier;
import org.hisp.dhis.patient.PatientIdentifierStore;
import org.hisp.dhis.patient.PatientIdentifierType;
=== modified file 'dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java'
--- dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2010-08-31 05:47:11 +0000
+++ dhis-2/dhis-services/dhis-service-reporting/src/main/java/org/hisp/dhis/reporttable/impl/DefaultReportTableService.java 2010-09-03 12:44:40 +0000
@@ -60,7 +60,8 @@
import org.hisp.dhis.reporttable.ReportTableData;
import org.hisp.dhis.reporttable.ReportTableService;
import org.hisp.dhis.reporttable.jdbc.ReportTableManager;
-import org.hisp.dhis.system.grid.Grid;
+import org.hisp.dhis.common.Grid;
+import org.hisp.dhis.system.grid.ListGrid;
import org.hisp.dhis.system.util.Filter;
import org.hisp.dhis.system.util.FilterUtils;
import org.springframework.transaction.annotation.Transactional;
@@ -395,7 +396,7 @@
private Grid getGrid( ReportTable reportTable )
{
- final Grid grid = new Grid();
+ final Grid grid = new ListGrid();
for ( final IdentifiableObject metaObject : reportTable.getReportIndicators() )
{
=== renamed file 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/Grid.java' => 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java'
--- dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/Grid.java 2010-05-12 18:23:51 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/grid/ListGrid.java 2010-09-03 12:44:40 +0000
@@ -33,12 +33,14 @@
import java.util.List;
import org.apache.commons.math.stat.regression.SimpleRegression;
+import org.hisp.dhis.common.Grid;
/**
* @author Lars Helge Overland
* @version $Id$
*/
-public class Grid
+public class ListGrid
+ implements Grid
{
/**
* A two dimensional List which simulates a grid where the first list
@@ -54,7 +56,7 @@
/**
* Default constructor.
*/
- public Grid()
+ public ListGrid()
{
grid = new ArrayList<List<String>>();
}
@@ -63,17 +65,11 @@
// Public methods
// ---------------------------------------------------------------------
- /**
- * Returns the current height / number of rows in the grid.
- */
public int getHeight()
{
return ( grid != null && grid.size() > 0 ) ? grid.size() : 0;
}
- /**
- * Returns the current width / number of columns in the grid.
- */
public int getWidth()
{
verifyGridState();
@@ -81,9 +77,6 @@
return ( grid != null && grid.size() > 0 ) ? grid.get( 0 ).size() : 0;
}
- /**
- * Adds a new row the the grid and moves the cursor accordingly.
- */
public void nextRow()
{
grid.add( new ArrayList<String>() );
@@ -91,39 +84,21 @@
currentRowIndex++;
}
- /**
- * Adds the value to the end of the current row.
- *
- * @param value the value to add.
- */
public void addValue( String value )
{
grid.get( currentRowIndex ).add( value );
}
- /**
- * Returns the row with the given index.
- *
- * @param rowIndex the index of the row.
- */
public List<String> getRow( int rowIndex )
{
return grid.get( rowIndex );
}
- /**
- * Returns all rows.
- */
public List<List<String>> getRows()
{
return grid;
}
- /**
- * Returns the column with the given index.
- *
- * @param columnIndex the index of the column.
- */
public List<String> getColumn( int columnIndex )
{
List<String> column = new ArrayList<String>();
@@ -136,13 +111,6 @@
return column;
}
- /**
- * Adds a new column at the end of the grid.
- *
- * @param columnValues the column values to add.
- * @throws IllegalStateException if the columnValues has different length
- * than the rows in grid, or if the grid rows are not of the same length.
- */
public void addColumn( List<String> columnValues )
{
verifyGridState();
@@ -161,11 +129,6 @@
}
}
- /**
- * Column must hold numeric data.
- *
- * @param columnIndex the index of the base column.
- */
public void addRegressionColumn( int columnIndex )
{
verifyGridState();
=== modified file 'dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/grid/GridTest.java'
--- dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/grid/GridTest.java 2010-04-12 21:23:33 +0000
+++ dhis-2/dhis-support/dhis-support-system/src/test/java/org/hisp/dhis/system/grid/GridTest.java 2010-09-03 12:44:40 +0000
@@ -39,12 +39,12 @@
public class GridTest
extends TestCase
{
- private Grid grid;
+ private ListGrid grid;
@Override
public void setUp()
{
- grid = new Grid();
+ grid = new ListGrid();
grid.nextRow();
grid.addValue( "11" );
@@ -138,7 +138,7 @@
public void testAddRegressionColumn()
{
- grid = new Grid();
+ grid = new ListGrid();
grid.nextRow();
grid.addValue( "10.0" );