dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #01033
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 301: Improved column readability
------------------------------------------------------------
revno: 301
committer: Lars Helge Oeverland larshelge@xxxxxxxxx
branch nick: trunk
timestamp: Tue 2009-05-19 12:46:43 +0200
message:
Improved column readability
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/displayTableForm.vm
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2009-05-18 21:42:15 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/reporttable/ReportTable.java 2009-05-19 10:46:43 +0000
@@ -29,7 +29,9 @@
import java.io.Serializable;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -65,6 +67,7 @@
public static final String REPORTING_MONTH_COLUMN_NAME = "reporting_month_name";
public static final String SEPARATOR = "_";
+ public static final String SPACE = " ";
public static final String MODE_DATAELEMENTS = "dataelements";
public static final String MODE_INDICATORS = "indicators";
@@ -205,6 +208,12 @@
private List<String> crossTabColumns = new ArrayList<String>();
/**
+ * Generated pretty-print names for crosstabulated columns in the report table,
+ * where key is column name and value is pretty column name.
+ */
+ private Map<String, String> prettyCrossTabColumns = new HashMap<String, String>();
+
+ /**
* Generated unique identifiers used to retrieve the corresponding value from the datavalue table.
*/
private List<String> crossTabIdentifiers = new ArrayList<String>();
@@ -430,9 +439,11 @@
for ( OrganisationUnit unit : crossTabUnits )
{
String columnName = getColumnName( indicator, categoryOptionCombo, period, unit );
+ String prettyColumnName = getPrettyColumnName( indicator, categoryOptionCombo, period, unit );
String columnIdentifier = getColumnIdentifier( indicator, categoryOptionCombo, period, unit );
crossTabColumns.add( columnName );
+ prettyCrossTabColumns.put( columnName, prettyColumnName );
crossTabIdentifiers.add( columnIdentifier );
}
}
@@ -454,10 +465,13 @@
{
if ( !hasDisplayColumn( column ) )
{
+ String prettyColumn = prettyCrossTabColumns.get( column ) != null ?
+ prettyCrossTabColumns.get( column ) : prettyPrintColumn( column );
+
ReportTableColumn displayColumn = new ReportTableColumn();
displayColumn.setName( column );
- displayColumn.setHeader( prettyPrintColumn( column ) );
+ displayColumn.setHeader( prettyColumn );
displayColumn.setHidden( false );
displayColumns.add( displayColumn );
@@ -473,6 +487,7 @@
columns.addAll( getIndexColumns() );
columns.addAll( getIndexNameColumns() );
+ columns.add( ReportTable.REPORTING_MONTH_COLUMN_NAME );
columns.addAll( getCrossTabColumns() );
if ( isRegression() )
@@ -605,6 +620,32 @@
return list != null && list.size() > 0;
}
+ private String getPrettyColumnName( MetaObject metaObject, DataElementCategoryOptionCombo categoryOptionCombo, Period period, OrganisationUnit unit )
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ if ( metaObject != null )
+ {
+ buffer.append( metaObject.getShortName() + SPACE );
+ }
+ if ( categoryOptionCombo != null )
+ {
+ buffer.append( categoryOptionCombo.getShortName() + SPACE );
+ }
+ if ( period != null )
+ {
+ String periodName = period.getName() != null ? period.getName() : i18nFormat.formatPeriod( period );
+
+ buffer.append( periodName + SPACE );
+ }
+ if ( unit != null )
+ {
+ buffer.append( unit.getShortName() + SPACE );
+ }
+
+ return buffer.length() > 0 ? buffer.substring( 0, buffer.lastIndexOf( SPACE ) ) : buffer.toString();
+ }
+
private String getColumnName( MetaObject metaObject, DataElementCategoryOptionCombo categoryOptionCombo, Period period, OrganisationUnit unit )
{
StringBuffer buffer = new StringBuffer();
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2009-05-18 20:04:49 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/org/hisp/dhis/reporting/i18n_module.properties 2009-05-19 10:46:43 +0000
@@ -249,3 +249,6 @@
column_name = Column name
display_name = Display name
visible = Visible
+move = Move
+column = Column
+click_and_drag = Click and drag
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/displayTableForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/displayTableForm.vm 2009-05-19 08:43:37 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/displayTableForm.vm 2009-05-19 10:46:43 +0000
@@ -17,19 +17,19 @@
<p>
<table id="columnTable">
<tr>
- <th>$i18n.getString( "column_name" )</th>
- <th>$i18n.getString( "display_name" )</th>
+ <th>$i18n.getString( "column" )</th>
<th>$i18n.getString( "visible" )</th>
+ <th>$i18n.getString( "move" )</th>
</tr>
#foreach( $column in $columns )
<tr>
- <td style="min-width:200px">$encoder.htmlEncode( $column.name )</td>
- <td style="width:200px"><input type="text" id="$!encoder.htmlEncode( $column.name )" value="$!column.header" style="width:200px"/></td>
+ <td style="width:400px"><input type="text" id="$!encoder.htmlEncode( $column.name )" value="$!column.header" style="width:400px"/></td>
<td style="width:55px"><input type="checkbox" #if ( !$column.hidden )checked="checked"#end></td>
+ <td style="width:90px; color:#808080">$i18n.getString( "click_and_drag" )</td>
</tr>
#end
</table>
</p>
-<p><input type="button" value="$i18n.getString( "save" )" onclick="saveDisplayTable()" style="width:100px"><input
- type="button" value="$i18n.getString( "cancel" )" onclick="window.location.href='displayManageTableForm.action'" style="width:100px"></p>
+<p><input type="button" value="$i18n.getString( "save" )" onclick="saveDisplayTable()" style="width:120px"><input
+ type="button" value="$i18n.getString( "cancel" )" onclick="window.location.href='displayManageTableForm.action'" style="width:120px"></p>
--
Trunk
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.