modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMetricD3GraphView.java | 2 - modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AbstractGraph.java | 9 ++++ modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java | 19 ++++++++-- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricGraphData.java | 11 +++++ modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java | 6 ++- modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 2 + modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties | 2 + modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 2 + modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 2 + modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties | 2 + modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 2 + modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties | 2 + modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 2 + modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js | 8 +++- 14 files changed, 62 insertions(+), 9 deletions(-)
New commits: commit 254f44d6aadea6afc43d2e2c654eb3a47a28530c Author: Mike Thompson mithomps@redhat.com Date: Wed Mar 6 17:42:11 2013 -0800
Charting - i18n the date and time formats for both availability and bar chart hovers.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMetricD3GraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMetricD3GraphView.java index f147e32..8e8c462 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMetricD3GraphView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractMetricD3GraphView.java @@ -126,7 +126,7 @@ public abstract class AbstractMetricD3GraphView extends LocatableVLayout { //@todo: this is a hack around timing issue of jsni not seeing the DOM drawJsniChart(); } - }.schedule(300); + }.schedule(900); }
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AbstractGraph.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AbstractGraph.java index c129f05..ea78ad4 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AbstractGraph.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AbstractGraph.java @@ -150,6 +150,15 @@ public abstract class AbstractGraph implements HasD3MetricJsniChart { return metricGraphData.getChartHoverBarLabel(); }
+ public String getChartHoverTimeFormat() { + return metricGraphData.getChartHoverTimeFormat(); + } + + public String getChartHoverDateFormat() { + return metricGraphData.getChartHoverDateFormat(); + } + + public Integer getChartHeight() { return metricGraphData.getChartHeight(); } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java index 37f8956..05810c3 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java @@ -132,7 +132,9 @@ public class AvailabilityLineGraphType { global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverStartLabel()(), global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverEndLabel()(), global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverBarLabel()(), - global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverAvailabilityLabel()() + global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverAvailabilityLabel()(), + global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverTimeFormat()(), + global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverDateFormat()() );
@@ -215,8 +217,10 @@ public class AvailabilityLineGraphType { var hoverString, xValue = (d.x == undefined) ? 0 : +d.x, date = new Date(+xValue), - timeFormatter = $wnd.d3.time.format("%I:%M:%S %p"), - dateFormatter = $wnd.d3.time.format("%m/%d/%y"), + //timeFormatter = $wnd.d3.time.format("%I:%M:%S %p"), + //dateFormatter = $wnd.d3.time.format("%m/%d/%y"), + timeFormatter = $wnd.d3.time.format(availChartContext.chartHoverTimeFormat), + dateFormatter = $wnd.d3.time.format(availChartContext.chartHoverDateFormat), availType = d.availType, availStart = new Date(+d.availStart), availEnd = new Date(+d.availEnd), @@ -228,7 +232,9 @@ public class AvailabilityLineGraphType { '<hr class="chartHoverDivider"></hr>' + '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverBarAvailabilityLabel + ': </span><span style="width:50px;">' + availType + '</span></div>' + '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverStartLabel + ': </span><span style="width:50px;">' + timeFormatter(availStart) + '</span></div>' + + '<div class="chartHoverAlignRight"><span >' + ' </span><span style="width:50px;">' + dateFormatter(availStart) + '</span></div>' + '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverEndLabel + ': </span><span style="width:50px;">' + timeFormatter(availEnd) + '</span></div>' + + '<div class="chartHoverAlignRight"><span >' + ' </span><span style="width:50px;">' + dateFormatter(availEnd) + '</span></div>' + '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverBarLabel + ': </span><span style="width:50px;">' + availDuration + '</span></div>' + '</div>'; return hoverString; @@ -268,4 +274,11 @@ public class AvailabilityLineGraphType { public String getChartHoverBarLabel() { return MSG.chart_hover_bar_label(); } + + public String getChartHoverTimeFormat() { + return MSG.chart_hover_time_format(); + } + public String getChartHoverDateFormat() { + return MSG.chart_hover_date_format(); + } } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricGraphData.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricGraphData.java index 7da01a9..a820977 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricGraphData.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricGraphData.java @@ -19,7 +19,6 @@ package org.rhq.enterprise.gui.coregui.client.inventory.common.charttype;
import java.util.ArrayList; -import java.util.Date; import java.util.List;
import org.rhq.core.domain.measurement.MeasurementDefinition; @@ -59,6 +58,8 @@ public class MetricGraphData implements JsonMetricProducer { private final String chartHoverEndLabel = MSG.chart_hover_end_label(); private final String chartHoverPeriodLabel = MSG.chart_hover_period_label(); private final String chartHoverBarLabel = MSG.chart_hover_bar_label(); + private final String chartHoverTimeFormat = MSG.chart_hover_time_format(); + private final String chartHoverDateFormat = MSG.chart_hover_date_format(); private int entityId = 0; private String entityName; private int definitionId; @@ -199,6 +200,14 @@ public class MetricGraphData implements JsonMetricProducer { return chartHoverBarLabel; }
+ public String getChartHoverTimeFormat() { + return chartHoverTimeFormat; + } + + public String getChartHoverDateFormat() { + return chartHoverDateFormat; + } + public Integer getChartHeight() { if (null != chartHeight) { return chartHeight; diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java index 57ae668..f9fac26 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java @@ -63,7 +63,9 @@ public final class MetricStackedBarGraph extends AbstractGraph { global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AbstractGraph::getChartHoverStartLabel()(), global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AbstractGraph::getChartHoverEndLabel()(), global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AbstractGraph::getChartHoverPeriodLabel()(), - global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AbstractGraph::getChartHoverBarLabel()() + global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AbstractGraph::getChartHoverBarLabel()(), + global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AbstractGraph::getChartHoverTimeFormat()(), + global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AbstractGraph::getChartHoverDateFormat()() );
@@ -576,7 +578,7 @@ public final class MetricStackedBarGraph extends AbstractGraph { // Public API draw: function (chartContext) { "use strict"; - console.group("Creating Chart: %s",chartContext.chartSelection); + console.group("Creating Chart: %s --> %s",chartContext.chartSelection, chartContext.chartTitle); console.time("chart"); //console.log("Json Data:\n"+chartContext.data);
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties index ca80bdd..42e4fde 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties @@ -15,6 +15,8 @@ chart_title_avg_label = Avg chart_title_min_label = Min chart_title_peak_label = Max chart_hover_availability_label = Availability +chart_hover_date_format = %m/%d/%y +chart_hover_time_format = %I:%M:%S %p chart_hover_start_label = Start chart_hover_end_label = End chart_hover_period_label = Period diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties index 15fc353..e97c527 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties @@ -38,6 +38,8 @@ ##chart_title_min_label = Min ##chart_title_peak_label = Max ##chart_hover_availability_label = Availability +##chart_hover_date_format = %m/%d/%y +##chart_hover_time_format = %I:%M:%S %p ##chart_hover_start_label = Start ##chart_hover_end_label = End ##chart_hover_period_label = Period diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties index 1949371..6187155 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties @@ -18,6 +18,8 @@ ##chart_title_min_label = Min ##chart_title_peak_label = Max ##chart_hover_availability_label = Availability +##chart_hover_date_format = %m/%d/%y +##chart_hover_time_format = %I:%M:%S %p ##chart_hover_start_label = Start ##chart_hover_end_label = End ##chart_hover_period_label = Period diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties index d41fbbf..dfdfa29 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties @@ -18,6 +18,8 @@ ##chart_title_min_label = Min ##chart_title_peak_label = Max ##chart_hover_availability_label = Availability +##chart_hover_date_format = %m/%d/%y +##chart_hover_time_format = %I:%M:%S %p ##chart_hover_start_label = Start ##chart_hover_end_label = End ##chart_hover_period_label = Period diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties index 7d0ad16..a44f465 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties @@ -16,6 +16,8 @@ ##chart_title_min_label = Min ##chart_title_peak_label = Max ##chart_hover_availability_label = Availability +##chart_hover_date_format = %m/%d/%y +##chart_hover_time_format = %I:%M:%S %p ##chart_hover_start_label = Start ##chart_hover_end_label = End ##chart_hover_period_label = Period diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties index 4a93655..a99ff58 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties @@ -15,6 +15,8 @@ ##chart_title_min_label = Min ##chart_title_peak_label = Max ##chart_hover_availability_label = Availability +##chart_hover_date_format = %m/%d/%y +##chart_hover_time_format = %I:%M:%S %p ##chart_hover_start_label = Start ##chart_hover_end_label = End ##chart_hover_period_label = Period diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties index 810539e..106d53a 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties @@ -15,6 +15,8 @@ ##chart_title_min_label = Min ##chart_title_peak_label = Max ##chart_hover_availability_label = Availability +##chart_hover_date_format = %m/%d/%y +##chart_hover_time_format = %I:%M:%S %p ##chart_hover_start_label = Start ##chart_hover_end_label = End ##chart_hover_period_label = Period diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties index f551de2..8a5d6f8 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties @@ -15,6 +15,8 @@ ##chart_title_min_label = Min ##chart_title_peak_label = Max ##chart_hover_availability_label = Availability +##chart_hover_date_format = %m/%d/%y +##chart_hover_time_format = %I:%M:%S %p ##chart_hover_start_label = Start ##chart_hover_end_label = End ##chart_hover_period_label = Period diff --git a/modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js b/modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js index 6cd3a08..5156136 100644 --- a/modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js +++ b/modules/enterprise/gui/coregui/src/main/webapp/js/rhq.js @@ -9,7 +9,7 @@ * A ChartContext can be passed to multiple chart renders to display different chart types * of that data. */ -var ChartContext = function (chartId, chartHeight, metricsData, xAxisLabel, chartTitle, yAxisUnits, minChartTitle, avgChartTitle, peakChartTitle, dateLabel, timeLabel, downLabel, unknownLabel, noDataLabel, hoverStartLabel,hoverEndLabel, hoverPeriodLabel, hoverBarLabel) +var ChartContext = function (chartId, chartHeight, metricsData, xAxisLabel, chartTitle, yAxisUnits, minChartTitle, avgChartTitle, peakChartTitle, dateLabel, timeLabel, downLabel, unknownLabel, noDataLabel, hoverStartLabel,hoverEndLabel, hoverPeriodLabel, hoverBarLabel, chartHoverTimeFormat, chartHoverDateFormat) { "use strict"; if(!(this instanceof ChartContext)){ @@ -35,9 +35,11 @@ var ChartContext = function (chartId, chartHeight, metricsData, xAxisLabel, char this.hoverEndLabel = hoverEndLabel; this.hoverPeriodLabel = hoverPeriodLabel; this.hoverBarLabel = hoverBarLabel; + this.chartHoverTimeFormat = chartHoverTimeFormat; + this.chartHoverDateFormat = chartHoverDateFormat;
}, -AvailChartContext = function (chartId, availData, dateLabel, timeLabel, hoverStartLabel, hoverEndLabel, hoverBarLabel, availabilityLabel) { +AvailChartContext = function (chartId, availData, dateLabel, timeLabel, hoverStartLabel, hoverEndLabel, hoverBarLabel, availabilityLabel, chartHoverTimeFormat, chartHoverDateFormat) { "use strict"; if (!(this instanceof AvailChartContext)) { throw new Error("AvailChartContext function cannot be called as a function.") @@ -52,5 +54,7 @@ AvailChartContext = function (chartId, availData, dateLabel, timeLabel, hoverSta this.hoverEndLabel = hoverEndLabel; this.hoverBarLabel = hoverBarLabel; this.hoverBarAvailabilityLabel = availabilityLabel; + this.chartHoverTimeFormat = chartHoverTimeFormat; + this.chartHoverDateFormat = chartHoverDateFormat;
};
rhq-commits@lists.fedorahosted.org