modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java | 83 ++++------ modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java | 9 - modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java | 7 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/ResourceScheduledMetricDatasource.java | 18 +- modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java | 17 +- modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 28 +++ 6 files changed, 91 insertions(+), 71 deletions(-)
New commits: commit 845b952460943a34ca1663f08d8e7dec6961b8b8 Author: Joseph Marques joseph@redhat.com Date: Wed Nov 17 17:56:32 2010 -0500
i18n for org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java index 0efea7e..835f8e5 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/AvailabilityBarView.java @@ -19,14 +19,12 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring;
import com.google.gwt.user.client.rpc.AsyncCallback; -import com.smartgwt.client.widgets.HTMLFlow; import com.smartgwt.client.widgets.Img; import com.smartgwt.client.widgets.events.MouseOutEvent; import com.smartgwt.client.widgets.events.MouseOutHandler; import com.smartgwt.client.widgets.events.MouseOverEvent; import com.smartgwt.client.widgets.events.MouseOverHandler; import com.smartgwt.client.widgets.layout.HLayout; -import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.measurement.Availability; import org.rhq.core.domain.measurement.AvailabilityType; @@ -37,6 +35,7 @@ import org.rhq.core.domain.util.PageControl; import org.rhq.core.domain.util.PageList; import org.rhq.core.domain.util.PageOrdering; import org.rhq.enterprise.gui.coregui.client.CoreGUI; +import org.rhq.enterprise.gui.coregui.client.Messages; import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
/** @@ -44,10 +43,10 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup; */ public class AvailabilityBarView extends HLayout {
+ Messages MSG = CoreGUI.getMessages();
private Resource resource;
- public AvailabilityBarView(Resource resource) { this.resource = resource; setHeight(28); @@ -55,56 +54,48 @@ public class AvailabilityBarView extends HLayout { setMargin(10); }
- @Override protected void onInit() { super.onInit();
- PageControl pc = PageControl.getUnlimitedInstance(); pc.initDefaultOrderingField("av.startTime", PageOrdering.ASC);
- GWTServiceLookup.getAvailabilityService().findAvailabilityForResource( - resource.getId(), pc, - new AsyncCallback<PageList<Availability>>() { - public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError("Failed to load availability history", caught); - } + GWTServiceLookup.getAvailabilityService().findAvailabilityForResource(resource.getId(), pc, + new AsyncCallback<PageList<Availability>>() { + public void onFailure(Throwable caught) { + CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_availability_loadFailed(), caught); + }
- public void onSuccess(PageList<Availability> result) { - update(result); - } + public void onSuccess(PageList<Availability> result) { + update(result); } - ); + }); }
private void update(PageList<Availability> result) {
long start = result.get(0).getStartTime().getTime(); - long end = result.get(result.size() - 1).getEndTime() != null ? result.get(result.size() - 1).getEndTime().getTime() : System.currentTimeMillis(); + long end = result.get(result.size() - 1).getEndTime() != null ? result.get(result.size() - 1).getEndTime() + .getTime() : System.currentTimeMillis();
long diff = end - start;
- - Img leftCap = new Img("availBar/leftCap.png",8,28); + Img leftCap = new Img("availBar/leftCap.png", 8, 28); addMember(leftCap);
for (Availability a : result) {
long endTime = a.getEndTime() != null ? a.getEndTime().getTime() : System.currentTimeMillis();
- double width = (((double) (endTime - a.getStartTime().getTime()) / diff) * 100); String widthString = width + "%"; if (width == 0) { widthString = "2px"; }
- String imagePath = a.getAvailabilityType() == AvailabilityType.UP ? "availBar/up.png" : "availBar/down.png";
- - final Img section = new Img(imagePath); section.setHeight(28); section.setOpacity(60); @@ -121,51 +112,47 @@ public class AvailabilityBarView extends HLayout { } });
- long duration = endTime - a.getStartTime().getTime();
- String durationString = MeasurementConverterClient.format((double)duration, MeasurementUnits.MILLISECONDS, true); - - section.setTooltip("<div style="white-space: nowrap;"><b>Availability: </b>" + a.getAvailabilityType().name() + - "<br/><b>Start: </b>" + a.getStartTime() + - "<br/><b>End: </b>" + a.getEndTime() + - "<br/><b>Duration: </b>" + durationString); + String durationString = MeasurementConverterClient.format((double) duration, MeasurementUnits.MILLISECONDS, + true);
+ section.setTooltip("<div style="white-space: nowrap;"><b>" + MSG.common_title_availability() + ": </b>" + + a.getAvailabilityType().name() + "<br/><b>" + MSG.common_title_start() + ": </b>" + a.getStartTime() + + "<br/><b>" + MSG.common_title_end() + ": </b>" + a.getEndTime() + "<br/><b>" + + MSG.common_title_duration() + ": </b>" + durationString);
addMember(section);
} - Img rightCap = new Img("availBar/rightCap.png",8,28); + Img rightCap = new Img("availBar/rightCap.png", 8, 28); addMember(rightCap);
+ /* StringBuffer buf = new StringBuffer("<table cellpadding="0" cellspacing="0" width="100%"><tr height="28">");
+ buf.append("<td width="8px" class="availBarLeftCap"> </td>");
- /* StringBuffer buf = new StringBuffer("<table cellpadding="0" cellspacing="0" width="100%"><tr height="28">"); + for (Availability a : result) {
- buf.append("<td width="8px" class="availBarLeftCap"> </td>"); + long endTime = a.getEndTime() != null ? a.getEndTime().getTime() : System.currentTimeMillis();
- for (Availability a : result) { - - long endTime = a.getEndTime() != null ? a.getEndTime().getTime() : System.currentTimeMillis(); + double width = (((double) (endTime - a.getStartTime().getTime()) / diff) * 100); + String widthString = width + "%"; + if (width == 0) { + widthString = "2px"; + }
- - double width = (((double) (endTime - a.getStartTime().getTime()) / diff) * 100); - String widthString = width + "%"; - if (width == 0) { - widthString = "2px"; - } - - buf.append("<td width="" + widthString + "" class="" + (a.getAvailabilityType() == AvailabilityType.UP ? "availBarUp" : "availBarDown") + ""> </td>"); - } - buf.append("<td width="8px" class="availBarRightCap"> </td>"); - buf.append("</tr></table>"); + buf.append("<td width="" + widthString + "" class="" + (a.getAvailabilityType() == AvailabilityType.UP ? "availBarUp" : "availBarDown") + ""> </td>"); + } + buf.append("<td width="8px" class="availBarRightCap"> </td>"); + buf.append("</tr></table>");
- HTMLFlow bar = new HTMLFlow(buf.toString()); + HTMLFlow bar = new HTMLFlow(buf.toString());
- addMember(bar);*/ + addMember(bar);*/
} } diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java index a503a9e..becbd02 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/GraphListView.java @@ -49,7 +49,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout; public class GraphListView extends LocatableVLayout implements ResourceSelectListener {
private Resource resource; - private Label loadingLabel = new Label("Loading..."); + private Label loadingLabel = new Label(MSG.common_msg_loading());
public GraphListView(String locatorId, Resource resource) { super(locatorId); @@ -107,13 +107,14 @@ public class GraphListView extends LocatableVLayout implements ResourceSelectLis System.currentTimeMillis() - (1000L * 60 * 60 * 8), System.currentTimeMillis(), 60, new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() { public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError("Failed to load data for graphs", caught); - loadingLabel.setContents("failed to load graphs"); + CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_graphs_loadFailed(), + caught); + loadingLabel.setContents(MSG.view_resource_monitor_graphs_loadFailed()); }
public void onSuccess(List<List<MeasurementDataNumericHighLowComposite>> result) { if (result.isEmpty()) { - loadingLabel.setContents("No graphs available"); + loadingLabel.setContents(MSG.view_resource_monitor_graphs_noneAvailable()); } else { loadingLabel.hide(); int i = 0; diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java index 2855a22..6d6f5bc 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/LiveGraphView.java @@ -69,7 +69,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWindow; */ public class LiveGraphView extends LocatableVLayout {
- private static final String INSTRUCTIONS = "Point your mouse to a data point on the chart"; + private static final String INSTRUCTIONS = MSG.view_resource_monitor_graph_instructions();
private final Label selectedPointLabel = new Label(INSTRUCTIONS); private final Label positionLabel = new Label(); @@ -226,7 +226,8 @@ public class LiveGraphView extends LocatableVLayout { dataService.findLiveData(resourceId, new int[] { definition.getId() }, new AsyncCallback<Set<MeasurementData>>() { public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError("Failed to load live data", caught); + CoreGUI.getErrorHandler() + .handleError(MSG.view_resource_monitor_graphs_loadFailed(), caught); }
public void onSuccess(Set<MeasurementData> result) { @@ -271,7 +272,7 @@ public class LiveGraphView extends LocatableVLayout { public static void displayAsDialog(String locatorId, int resourceId, MeasurementDefinition def) { final LiveGraphView graph = new LiveGraphView(locatorId, resourceId, def); final Window graphPopup = new LocatableWindow(locatorId); - graphPopup.setTitle("Detailed Graph"); + graphPopup.setTitle(MSG.view_resource_monitor_detailed_graph_label()); graphPopup.setWidth(800); graphPopup.setHeight(400); graphPopup.setIsModal(true); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/ResourceScheduledMetricDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/ResourceScheduledMetricDatasource.java index 10c21fa..b255539 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/ResourceScheduledMetricDatasource.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/ResourceScheduledMetricDatasource.java @@ -57,26 +57,26 @@ public class ResourceScheduledMetricDatasource extends RPCDataSource<Measurement protected List<DataSourceField> addDataSourceFields() { List<DataSourceField> fields = super.addDataSourceFields();
- DataSourceIntegerField id = new DataSourceIntegerField("id"); + DataSourceIntegerField id = new DataSourceIntegerField("id", MSG.common_title_id()); id.setPrimaryKey(true); fields.add(id);
- DataSourceTextField name = new DataSourceTextField("name"); + DataSourceTextField name = new DataSourceTextField("name", MSG.common_title_name()); fields.add(name);
- DataSourceTextField displayName = new DataSourceTextField("displayName"); + DataSourceTextField displayName = new DataSourceTextField("displayName", MSG.common_title_display_name()); fields.add(displayName);
- DataSourceTextField description = new DataSourceTextField("description"); + DataSourceTextField description = new DataSourceTextField("description", MSG.common_title_description()); fields.add(description);
- DataSourceTextField units = new DataSourceTextField("units"); + DataSourceTextField units = new DataSourceTextField("units", MSG.common_title_units()); fields.add(units);
- DataSourceTextField numericType = new DataSourceTextField("numericType"); + DataSourceTextField numericType = new DataSourceTextField("numericType", MSG.common_title_numeric_type()); fields.add(numericType);
- DataSourceTextField category = new DataSourceTextField("category"); + DataSourceTextField category = new DataSourceTextField("category", MSG.common_title_category()); fields.add(category);
return fields; @@ -92,7 +92,7 @@ public class ResourceScheduledMetricDatasource extends RPCDataSource<Measurement GWTServiceLookup.getMeasurementDataService().findMeasurementDefinitionsByCriteria(criteria, new AsyncCallback<PageList<MeasurementDefinition>>() { public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError("Failed to load metric definitions", caught); + CoreGUI.getErrorHandler().handleError(MSG.dataSource_definitions_loadFailed(), caught); }
public void onSuccess(PageList<MeasurementDefinition> result) { @@ -110,7 +110,7 @@ public class ResourceScheduledMetricDatasource extends RPCDataSource<Measurement GWTServiceLookup.getMeasurementDataService().findMeasurementSchedulesByCriteria(criteria, new AsyncCallback<PageList<MeasurementSchedule>>() { public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError("Failed to load metric schedules", caught); + CoreGUI.getErrorHandler().handleError(MSG.dataSource_schedules_loadFailed(), caught); }
public void onSuccess(PageList<MeasurementSchedule> result) { diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java index ef3b3a8..da91f8c 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/SmallGraphView.java @@ -72,10 +72,13 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableWidgetCanvas */ public class SmallGraphView extends LocatableVLayout {
- private static final String INSTRUCTIONS = "Point your mouse to a data point on the chart"; + private static final String INSTRUCTIONS = MSG.view_resource_monitor_graph_instructions();
- private static final String[] MONTH_NAMES = { "jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", - "nov", "dec" }; + private static final String[] MONTH_NAMES = { MSG.common_calendar_january_short(), + MSG.common_calendar_february_short(), MSG.common_calendar_march_short(), MSG.common_calendar_april_short(), + MSG.common_calendar_may_short(), MSG.common_calendar_june_short(), MSG.common_calendar_july_short(), + MSG.common_calendar_august_short(), MSG.common_calendar_september_short(), MSG.common_calendar_october_short(), + MSG.common_calendar_november_short(), MSG.common_calendar_december_short() };
private final Label selectedPointLabel = new Label(INSTRUCTIONS); private final Label positionLabel = new Label(); @@ -149,7 +152,7 @@ public class SmallGraphView extends LocatableVLayout { resourceCriteria.addFilterId(resourceId); resourceService.findResourcesByCriteria(resourceCriteria, new AsyncCallback<PageList<Resource>>() { public void onFailure(Throwable caught) { - CoreGUI.getErrorHandler().handleError("Failed to find resource for graph", caught); + CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_graphs_lookupFailed(), caught); }
public void onSuccess(PageList<Resource> result) { @@ -170,7 +173,7 @@ public class SmallGraphView extends LocatableVLayout { new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() { public void onFailure(Throwable caught) { CoreGUI.getErrorHandler().handleError( - "Failed to load data for graph", caught); + MSG.view_resource_monitor_graphs_loadFailed(), caught); }
public void onSuccess( @@ -228,7 +231,7 @@ public class SmallGraphView extends LocatableVLayout { titleLayout.addMember(title);
Img liveGraph = new LocatableImg(getLocatorId(), "subsystems/monitor/Monitor_16.png", 16, 16); - liveGraph.setTooltip("Click for a live graph of current values"); + liveGraph.setTooltip(MSG.view_resource_monitor_graph_live_tooltip());
liveGraph.addClickHandler(new ClickHandler() { public void onClick(ClickEvent clickEvent) { @@ -371,7 +374,7 @@ public class SmallGraphView extends LocatableVLayout { private void displayAsDialog(String locatorId) { SmallGraphView graph = new SmallGraphView(locatorId, resourceId, definition, data); Window graphPopup = new Window(); - graphPopup.setTitle("Detailed Graph"); + graphPopup.setTitle(MSG.view_resource_monitor_detailed_graph_label()); graphPopup.setWidth(800); graphPopup.setHeight(400); graphPopup.setIsModal(true); 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 b211a94..a1bba52 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 @@ -75,6 +75,8 @@ common_title_dateCreated=Date Created~ common_title_default=Default~ common_title_description=Description~ common_title_display=Display~ +common_title_display_name=Display Name~ +common_title_duration=Duration~ common_title_edit_mode=Edit Mode~ common_title_enabled=Enabled?~ common_title_end = End~ @@ -94,6 +96,7 @@ common_title_mixedGroups = Mixed Groups~ common_title_mixedGroups_total=Mixed Group Total~ common_title_name = Name~ common_title_new_dashboard=New Dashboard~ +common_title_numeric_type=Numeric Type~ common_title_operations=Operations~ common_title_operations_range=Operation Range~ common_title_over=Over~ @@ -120,6 +123,7 @@ common_title_summary_counts=Summary Counts~ common_title_timestamp =Date/Time~ common_title_total=Total~ common_title_type = Type~ +common_title_units = Units~ common_title_user=User~ common_title_value = Value~ common_title_version = Version~ @@ -142,6 +146,21 @@ common_val_yes_lower = yes~ common_val_never=Never~ common_val_na=N/A~
+# Common Calendar +#-------------- +common_calendar_january_short=jan +common_calendar_february_short=feb +common_calendar_march_short=mar +common_calendar_april_short=apr +common_calendar_may_short=may +common_calendar_june_short=jun +common_calendar_july_short=jul +common_calendar_august_short=aug +common_calendar_september_short=sept +common_calendar_october_short=oct +common_calendar_november_short=nov +common_calendar_december_short=dec +
#=================== Widgets =====================
@@ -288,6 +307,8 @@ dataSource_measurementOob_error_fetchFailure = Failed to load measurement OOB in
# Measurements #---------------------- +dataSource_definitions_loadFailed=Failed to load metric definitions~ +dataSource_schedules_loadFailed=Failed to load metric schedules~ dataSource_schedules_field_resourceGroupId=Group ID~ dataSource_schedules_enableFailure=Failed to enable the collection of [{0}] metrics for resource group with ID [{1}]. The metrics were: [{2}]~ dataSource_schedules_enableSuccessful_concise=You have enabled the collection of [{0}] measurements~ @@ -609,6 +630,13 @@ view_inventory_resources_loadFailed=Failed to load resource composite data~ view_inventory_resources_title=Member Resources~ view_inventory_resources_title_children=Child Resources~ view_inventory_resources_title_members=Member Resources~ +view_resource_monitor_availability_loadFailed=Failed to load availability history~ +view_resource_monitor_graphs_noneAvailable=No graphs available~ +view_resource_monitor_graphs_loadFailed=Failed to load graph data~ +view_resource_monitor_graphs_lookupFailed=Failed to find resource for graph~ +view_resource_monitor_graph_instructions=Point your mouse to a data point on the chart~ +view_resource_monitor_graph_live_tooltip=Click for a live graph of current values~ +view_resource_monitor_detailed_graph_label=Detailed Graph~ view_tree_common_loadFailed_generic=Failed to load data for tree~ view_tree_common_loadFailed_root=Failed to load root for tree~ view_tree_common_loadFailed_descendants=Failed to load descendants for tree~
rhq-commits@lists.fedorahosted.org