|
From: <dd...@us...> - 2010-03-16 13:03:27
|
Revision: 1055
http://pulse-java.svn.sourceforge.net/pulse-java/?rev=1055&view=rev
Author: ddietz
Date: 2010-03-16 13:03:14 +0000 (Tue, 16 Mar 2010)
Log Message:
-----------
made configurable how the screen resolution filter is to perform the calculations for the filtering of the screen resolutions
Modified Paths:
--------------
trunk/bundles/Statistics/org.torweg.pulse.component.statistics.view.TechnicalInformationViewReportController.xml
trunk/components/statistics/src/java/org/torweg/pulse/component/statistics/view/TechnicalInformationViewController.java
trunk/components/statistics/src/java/org/torweg/pulse/component/statistics/view/TechnicalInformationViewControllerConfiguration.java
trunk/components/statistics/src/java/org/torweg/pulse/component/statistics/view/TechnicalInformationViewControllerResultData.java
trunk/components/statistics/xsl/Statistics/TechnicalInformationView.Data/ajax.tables.screenResolution.xsl
trunk/components/statistics/xsl/Statistics/ajax.init.Statistics.Center.TechnicalInformationView.xsl
Modified: trunk/bundles/Statistics/org.torweg.pulse.component.statistics.view.TechnicalInformationViewReportController.xml
===================================================================
--- trunk/bundles/Statistics/org.torweg.pulse.component.statistics.view.TechnicalInformationViewReportController.xml 2010-03-16 12:44:50 UTC (rev 1054)
+++ trunk/bundles/Statistics/org.torweg.pulse.component.statistics.view.TechnicalInformationViewReportController.xml 2010-03-16 13:03:14 UTC (rev 1055)
@@ -20,13 +20,22 @@
<statistical-data-resolution-period>YEAR</statistical-data-resolution-period>
</available-statistical-data-resolution-periods>
- <!--
+ <!-- [optional=true]
the value to filter the screen resolutions by
- set this to <= 0 to disable filtering
- default: 0.01
-->
- <!--<screen-resolution-lowest-display-value>0.01</screen-resolution-lowest-display-value>-->
+ <!--<screen-resolution-lowest-display-value>0.03</screen-resolution-lowest-display-value>-->
+ <!-- [optional=true]
+ the ScreenResolutionFilterMode for filtering the screen resolutions
+ - available values:
+ 1. ABSOLUTE_ROW_TOTAL (filter by check: resolution total vs. absolute row total)
+ 2. FORMAT_ROW_TOTAL (filter by check: resolution total vs. format row total)
+ - default: ABSOLUTE_ROW_TOTAL
+ -->
+ <!--<screen-resolution-lowest-display-value-filter-mode>FORMAT_ROW_TOTAL</screen-resolution-lowest-display-value-filter-mode>-->
+
<!-- the pdf-xsl for the report -->
<report-pdf-XSL
file="WEB-INF/components/statistics/xsl/Statistics/Report/ajax.Statistics.PDF.TechnicalInformationView.xsl"/>
Modified: trunk/components/statistics/src/java/org/torweg/pulse/component/statistics/view/TechnicalInformationViewController.java
===================================================================
--- trunk/components/statistics/src/java/org/torweg/pulse/component/statistics/view/TechnicalInformationViewController.java 2010-03-16 12:44:50 UTC (rev 1054)
+++ trunk/components/statistics/src/java/org/torweg/pulse/component/statistics/view/TechnicalInformationViewController.java 2010-03-16 13:03:14 UTC (rev 1055)
@@ -192,10 +192,13 @@
// clear irrelevant screen resolution information
if (getConfiguration().getScreenResolutionLowestDisplayValue() > 0) {
data.clearScreenResolutionAggregationsMatrix(getConfiguration()
- .getScreenResolutionLowestDisplayValue());
+ .getScreenResolutionLowestDisplayValue(),
+ getConfiguration()
+ .getScreenResolutionLowestDisplayValueFilterMode());
}
return data;
}
+
}
Modified: trunk/components/statistics/src/java/org/torweg/pulse/component/statistics/view/TechnicalInformationViewControllerConfiguration.java
===================================================================
--- trunk/components/statistics/src/java/org/torweg/pulse/component/statistics/view/TechnicalInformationViewControllerConfiguration.java 2010-03-16 12:44:50 UTC (rev 1054)
+++ trunk/components/statistics/src/java/org/torweg/pulse/component/statistics/view/TechnicalInformationViewControllerConfiguration.java 2010-03-16 13:03:14 UTC (rev 1055)
@@ -54,6 +54,17 @@
private double screenResolutionLowestDisplayValue = 0.01;
/**
+ * Determines whether to use the absolute/format-specific row totals for
+ * calculation during filtering.
+ * <p>
+ * <strong>default:</strong>
+ * <code>ScreenResolutionFilterMode.ABSOLUTE_ROW_TOTAL</code>
+ * </p>
+ */
+ @XmlElement(name = "screen-resolution-lowest-display-value-filter-mode")
+ private ScreenResolutionFilterMode screenResolutionLowestDisplayValueFilterMode = ScreenResolutionFilterMode.ABSOLUTE_ROW_TOTAL;
+
+ /**
* Default constructor.
*/
@Deprecated
@@ -79,4 +90,44 @@
this.screenResolutionLowestDisplayValue = lowestDisplayValue;
}
+ /**
+ * Returns the <code>ScreenResolutionFilterMode</code>.
+ *
+ * @return the <code>ScreenResolutionFilterMode</code>
+ */
+ public ScreenResolutionFilterMode getScreenResolutionLowestDisplayValueFilterMode() {
+ return this.screenResolutionLowestDisplayValueFilterMode;
+ }
+
+ /**
+ * Sets the <code>ScreenResolutionFilterMode</code>.
+ *
+ * @param screenResolutionFilterMode
+ * the <code>ScreenResolutionFilterMode</code>
+ */
+ public void setScreenResolutionLowestDisplayValueFilterMode(
+ final ScreenResolutionFilterMode screenResolutionFilterMode) {
+ this.screenResolutionLowestDisplayValueFilterMode = screenResolutionFilterMode;
+ }
+
+ /**
+ * Determines which values are used for calculating during the
+ * <code>ScreenResolution</code> filtering process.
+ *
+ * @author Daniel Dietz
+ * @version $Revision$
+ */
+ protected static enum ScreenResolutionFilterMode {
+
+ /**
+ * Use the absolute row total.
+ */
+ ABSOLUTE_ROW_TOTAL,
+
+ /**
+ * Use the format specific row total.
+ */
+ FORMAT_ROW_TOTAL;
+ }
+
}
Modified: trunk/components/statistics/src/java/org/torweg/pulse/component/statistics/view/TechnicalInformationViewControllerResultData.java
===================================================================
--- trunk/components/statistics/src/java/org/torweg/pulse/component/statistics/view/TechnicalInformationViewControllerResultData.java 2010-03-16 12:44:50 UTC (rev 1054)
+++ trunk/components/statistics/src/java/org/torweg/pulse/component/statistics/view/TechnicalInformationViewControllerResultData.java 2010-03-16 13:03:14 UTC (rev 1055)
@@ -44,6 +44,7 @@
import org.torweg.pulse.component.statistics.util.ResultIHasDurationDataMatrixRow;
import org.torweg.pulse.component.statistics.util.ScreenResolutionPerVisitAggregationRowData;
import org.torweg.pulse.component.statistics.util.ScreenResolutionPerVisitAggregationRowDataBuilder;
+import org.torweg.pulse.component.statistics.view.TechnicalInformationViewControllerConfiguration.ScreenResolutionFilterMode;
import org.torweg.pulse.util.time.Duration;
import org.torweg.pulse.util.time.IHasDurationComparator;
import org.torweg.pulse.util.time.Period;
@@ -303,14 +304,20 @@
}
/**
- * Clears all information about screen resolutions the percentage of which
- * is below the given percentage value.
+ * Clears all known <code>ScreenResolution</code>s the calculated percentage
+ * (for all data rows of the <tt>screenResolutionAggregationsMatrix</tt>) of
+ * which is below the given percentage value using the given
+ * <code>ScreenResolutionFilterMode</code> for the arithmetical filter
+ * check.
*
* @param percentage
* the percentage value
+ * @param screenResolutionFilterMode
+ * the <code>ScreenResolutionFilterMode</code>
*/
protected void clearScreenResolutionAggregationsMatrix(
- final Double percentage) {
+ final Double percentage,
+ final ScreenResolutionFilterMode screenResolutionFilterMode) {
if (this.knownScreenResolutions == null
|| this.screenResolutionAggregationsMatrix == null
@@ -321,51 +328,68 @@
List<ScreenResolution> filtered = new ArrayList<ScreenResolution>();
for (ScreenResolution resolution : this.knownScreenResolutions) {
- boolean addToList = filterDataRowsForResolution(percentage,
- resolution);
+ // determines whether to filter the resolution
+ boolean addToList = isFilterResolution(percentage, resolution,
+ screenResolutionFilterMode);
if (addToList) {
filtered.add(resolution);
+ continue;
}
}
-
this.knownScreenResolutions = filtered;
}
/**
* Filters the data rows for the given <code>ScreenResolution</code> by the
- * given percentage value.
+ * given percentage value using the given
+ * <code>ScreenResolutionFilterMode</code>.
*
* @param percentage
* the percentage value
* @param resolution
* the <code>ScreenResolution</code>
+ * @param screenResolutionFilterMode
+ * the <code>ScreenResolutionFilterMode</code>
*
* @return <code>true</code> if the <code>ScreenResolution</code> is to be
* kept in the list, <code>false</code> otherwise
*/
- private boolean filterDataRowsForResolution(final Double percentage,
- final ScreenResolution resolution) {
- boolean addToList = false;
+ private boolean isFilterResolution(final Double percentage,
+ final ScreenResolution resolution,
+ final ScreenResolutionFilterMode screenResolutionFilterMode) {
for (ResultIHasDurationDataMatrixRow<ScreenResolutionPerVisitAggregation, ScreenResolutionPerVisitAggregationRowDataBuilder, ScreenResolutionPerVisitAggregationRowData> row : this.screenResolutionAggregationsMatrix
.getRows()) {
+
+ // check existance of required data for arithmetical filter check
if (row.getData() == null
|| row.getData().getFormatResolutionsData(
resolution.getFormat()) == null) {
continue;
}
- Integer formatTotal = row.getData().getFormatTotal(
- resolution.getFormat());
+
+ // retrieve the values for arithmetical filter check
+ Integer baseTotalToCheckAgainst;
+ if (screenResolutionFilterMode
+ .equals(ScreenResolutionFilterMode.FORMAT_ROW_TOTAL)) {
+ baseTotalToCheckAgainst = row.getData().getFormatTotal(
+ resolution.getFormat());
+ } else {
+ baseTotalToCheckAgainst = row.getData().getAbsoluteTotal();
+ }
Integer resolutionTotal = row.getData().getFormatResolutionsData(
resolution.getFormat()).getCount(resolution);
- if (formatTotal != null && resolutionTotal != null) {
+
+ // arithmetical filter check
+ if (baseTotalToCheckAgainst != null && resolutionTotal != null) {
Double calculatedPercentage = (double) resolutionTotal
- / (double) formatTotal;
+ / (double) baseTotalToCheckAgainst;
if (calculatedPercentage > percentage) {
- addToList = true;
+ return true;
}
}
+
}
- return addToList;
+ return false;
}
}
Modified: trunk/components/statistics/xsl/Statistics/TechnicalInformationView.Data/ajax.tables.screenResolution.xsl
===================================================================
--- trunk/components/statistics/xsl/Statistics/TechnicalInformationView.Data/ajax.tables.screenResolution.xsl 2010-03-16 12:44:50 UTC (rev 1054)
+++ trunk/components/statistics/xsl/Statistics/TechnicalInformationView.Data/ajax.tables.screenResolution.xsl 2010-03-16 13:03:14 UTC (rev 1055)
@@ -373,6 +373,9 @@
<xsl:text>color:#BBBBBB;</xsl:text>
</xsl:if>
</xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:text>% of ∑ = 100%</xsl:text>
+ </xsl:attribute>
<xsl:value-of
select="fn:round-half-to-even((($displayValueNumber div number($absoluteRowTotal)) * 100),2)"/>
<xsl:text>%</xsl:text>
@@ -384,6 +387,7 @@
<xsl:param name="format"/>
<xsl:param name="resolution"/>
<xsl:param name="absoluteRowTotal"/>
+ <xsl:param name="screen.resolution.filter.mode" tunnel="yes"/>
<xsl:param name="displayValue">
<xsl:for-each select="data/formats/entry">
<xsl:if test="key/text()=$format">
@@ -395,8 +399,21 @@
</xsl:if>
</xsl:for-each>
</xsl:param>
-
<xsl:param name="displVal" select="string(number($displayValue))"/>
+ <xsl:param name="calculationBase">
+ <xsl:choose>
+ <xsl:when test="$screen.resolution.filter.mode='FORMAT_ROW_TOTAL'">
+ <xsl:for-each select="data/format-totals/entry">
+ <xsl:if test="key/text()=$format">
+ <xsl:value-of select="value/text()"/>
+ </xsl:if>
+ </xsl:for-each>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$absoluteRowTotal"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:param>
<td align="center">
<xsl:attribute name="style">
@@ -419,8 +436,18 @@
<xsl:text>color:#BBBBBB;</xsl:text>
</xsl:if>
</xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:choose>
+ <xsl:when test="$screen.resolution.filter.mode='FORMAT_ROW_TOTAL'">
+ <xsl:text>% of ∑</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>% of ∑ = 100%</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
<xsl:value-of
- select="fn:round-half-to-even(((number($displayValue) div number($absoluteRowTotal)) * 100),2)"/>
+ select="fn:round-half-to-even(((number($displayValue) div number($calculationBase)) * 100),2)"/>
<xsl:text>%</xsl:text>
</td>
</xsl:template>
Modified: trunk/components/statistics/xsl/Statistics/ajax.init.Statistics.Center.TechnicalInformationView.xsl
===================================================================
--- trunk/components/statistics/xsl/Statistics/ajax.init.Statistics.Center.TechnicalInformationView.xsl 2010-03-16 12:44:50 UTC (rev 1054)
+++ trunk/components/statistics/xsl/Statistics/ajax.init.Statistics.Center.TechnicalInformationView.xsl 2010-03-16 13:03:14 UTC (rev 1055)
@@ -85,6 +85,9 @@
mode="table.aggregations.matrix">
<xsl:with-param name="knownFormats" select="data/known-screen-resolution-formats/node()"/>
<xsl:with-param name="knownResolutions" select="data/known-screen-resolutions/node()"/>
+ <xsl:with-param name="screen.resolution.filter.mode"
+ select="configuration/screen-resolution-lowest-display-value-filter-mode/text()"
+ tunnel="yes"/>
</xsl:apply-templates>
<!-- inline js -->
@@ -101,7 +104,8 @@
thisTab = Ext.getCmp('Pulse.Statistics.TechnicalInformationView.<xsl:value-of select="data/statistics-server/@id"/>');
- <!-- init Toolbar: @see: ajax.util.Statistics.Center.xsl -->
+ <!--
+ init Toolbar: @see: ajax.util.Statistics.Center.xsl-->
<xsl:call-template name="statistics.toolbar.builder">
<xsl:with-param name="statistics.result" select="self::node()"/>
<xsl:with-param name="clearSessionDataCommand">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|