modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java | 21
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 177 ++++--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java | 5
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 262 +++++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java | 5
6 files changed, 356 insertions(+), 124 deletions(-)
New commits:
commit a68a711863123bd05a4531e4607fca7b6db0dfb5
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 25 16:49:13 2011 -0500
Lazy Create SubTab Views
This means that for resource and group detail views we no longer create
the views for all active subtabs in advance. Instead, we create them when
they are navigated to. This means that construction/init/oninit/destroy/onDestroy
logis is avoided for non-rendered tabs. This should make things a bit
snappier overall and also protects against unwanted db round trips initiated
(perhaps unintentionally) from onInit (or even construction).
In short, supply SubTabs with ViewFactories as opposed to the view itself,
and generate the Canvas as needed. Note that once created we re-use the canvas
until the entire detail view is destroyed.
- also, move async db loads from construction to oninit in resource
ActivityView and group Activity2View. In general avoid async work
and db rts in the constructor. Wait for the widget to be attached to a
parent (oninit), or even better, when rendered (onDraw).
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
index 3492891..d257bec 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
@@ -21,6 +21,7 @@ package org.rhq.enterprise.gui.coregui.client.components.tab;
import com.smartgwt.client.widgets.Canvas;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableButton;
@@ -34,6 +35,7 @@ public class SubTab implements Locatable {
private String locatorId;
private ViewName viewName;
private Canvas canvas;
+ private ViewFactory viewFactory;
private LocatableButton button;
public SubTab(String locatorId, ViewName viewName, Canvas canvas) {
@@ -43,11 +45,22 @@ public class SubTab implements Locatable {
this.button = null;
}
+ public SubTab(String locatorId, ViewName viewName, Canvas initialCanvas, ViewFactory viewFactory) {
+ this.locatorId = locatorId;
+ this.viewName = viewName;
+ this.canvas = initialCanvas;
+ this.viewFactory = viewFactory;
+ this.button = null;
+ }
+
public String getLocatorId() {
return locatorId;
}
public Canvas getCanvas() {
+ if (null == canvas && null != viewFactory) {
+ canvas = viewFactory.createView();
+ }
return canvas;
}
@@ -55,6 +68,14 @@ public class SubTab implements Locatable {
this.canvas = canvas;
}
+ public ViewFactory getViewFactory() {
+ return viewFactory;
+ }
+
+ public void setViewFactory(ViewFactory viewFactory) {
+ this.viewFactory = viewFactory;
+ }
+
public LocatableButton getButton() {
return button;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index 1611328..b722739 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -40,6 +40,7 @@ import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedHandler;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
@@ -115,12 +116,19 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
return (visible && enabled);
}
- protected void updateSubTab(TwoLevelTab tab, SubTab subTab, Canvas canvas, boolean visible, boolean enabled) {
+ protected void updateSubTab(TwoLevelTab tab, SubTab subTab, boolean visible, boolean enabled,
+ ViewFactory viewFactory) {
+ updateSubTab(tab, subTab, null, visible, enabled, viewFactory);
+ }
+
+ protected void updateSubTab(TwoLevelTab tab, SubTab subTab, Canvas canvas, boolean visible, boolean enabled,
+ ViewFactory viewFactory) {
tab.setVisible(subTab, visible);
if (visible) {
tab.setSubTabEnabled(subTab, enabled);
if (enabled) {
subTab.setCanvas(canvas);
+ subTab.setViewFactory(viewFactory);
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index 89079ac..9b2ad10 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -49,6 +49,7 @@ import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.tab.SubTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.detail.AbstractTwoLevelTabSetView;
@@ -252,104 +253,180 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
private void updateSummaryTab() {
// Summary tab is always visible and enabled.
- updateSubTab(this.summaryTab, this.summaryActivity, new ActivityView(this.summaryActivity
- .extendLocatorId("View"), this.groupComposite), true, true);
- updateSubTab(this.summaryTab, this.summaryActivity2, new ActivityView2(this.summaryActivity2
- .extendLocatorId("View2"), this.groupComposite), true, true);
+ updateSubTab(this.summaryTab, this.summaryActivity, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ActivityView(summaryActivity.extendLocatorId("View"), groupComposite);
+ }
+ });
+ updateSubTab(this.summaryTab, this.summaryActivity2, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ActivityView2(summaryActivity2.extendLocatorId("View2"), groupComposite);
+ }
+ });
// TODO (ips): Add Timeline subtab?
}
- private void updateMonitoringTab(int groupId, GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
+ private void updateMonitoringTab(final int groupId, GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
boolean visible;
- Canvas canvas;
+ ViewFactory viewFactory;
if (updateTab(this.monitoringTab, groupCategory == GroupCategory.COMPATIBLE, true)) {
visible = hasMetricsOfType(this.groupComposite, DataType.MEASUREMENT);
- canvas = (visible) ? new FullHTMLPane(this.monitorGraphs.extendLocatorId("View"),
- "/rhq/group/monitor/graphs-plain.xhtml?groupId=" + groupId) : null;
- updateSubTab(this.monitoringTab, this.monitorGraphs, canvas, visible, true);
-
- // visible = same test as above
- canvas = (visible) ? new FullHTMLPane(this.monitorTables.extendLocatorId("View"),
- "/rhq/group/monitor/tables-plain.xhtml?groupId=" + groupId) : null;
- updateSubTab(this.monitoringTab, this.monitorTables, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(monitorGraphs.extendLocatorId("View"),
+ "/rhq/group/monitor/graphs-plain.xhtml?groupId=" + groupId);
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorGraphs, visible, true, viewFactory);
+
+ // visible = same test as above
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(monitorTables.extendLocatorId("View"),
+ "/rhq/group/monitor/tables-plain.xhtml?groupId=" + groupId);
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorTables, visible, true, viewFactory);
visible = hasMetricsOfType(this.groupComposite, DataType.TRAIT);
- canvas = (visible) ? new TraitsView(this.monitorTraits.extendLocatorId("View"), groupId) : null;
- updateSubTab(this.monitoringTab, this.monitorTraits, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new TraitsView(monitorTraits.extendLocatorId("View"), groupId);
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorTraits, visible, true, viewFactory);
visible = hasMetricsOfType(this.groupComposite, null);
- canvas = (visible) ? new SchedulesView(this.monitorSched.extendLocatorId("View"), this.groupComposite) : null;
- updateSubTab(this.monitoringTab, this.monitorSched, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new SchedulesView(monitorSched.extendLocatorId("View"), groupComposite);
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorSched, visible, true, viewFactory);
visible = facets.contains(ResourceTypeFacet.CALL_TIME);
- canvas = (visible) ? new FullHTMLPane(this.monitorCallTime.extendLocatorId("View"),
- "/rhq/group/monitor/response-plain.xhtml?groupId=" + groupId) : null;
- updateSubTab(this.monitoringTab, this.monitorCallTime, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(monitorCallTime.extendLocatorId("View"),
+ "/rhq/group/monitor/response-plain.xhtml?groupId=" + groupId);
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorCallTime, visible, true, viewFactory);
// TODO (ips): Add Availability subtab.
}
}
- private void updateInventoryTab(int groupId, Set<ResourceTypeFacet> facets) {
+ private void updateInventoryTab(final int groupId, Set<ResourceTypeFacet> facets) {
// Inventory tab is always visible and enabled.
- boolean canModifyMembers = (!isAutoGroup() && !isAutoCluster() && globalPermissions
+ final boolean canModifyMembers = (!isAutoGroup() && !isAutoCluster() && globalPermissions
.contains(Permission.MANAGE_INVENTORY));
- updateSubTab(this.inventoryTab, this.inventoryMembers, new MembersView(this.inventoryMembers
- .extendLocatorId("View"), groupId, canModifyMembers), true, true);
- updateSubTab(this.inventoryTab, this.inventoryConn, new CurrentGroupPluginConfigurationView(this.inventoryConn
- .extendLocatorId("View"), this.groupComposite), facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION),
- true);
- updateSubTab(this.inventoryTab, this.inventoryConnHistory, new HistoryGroupPluginConfigurationView(
- this.inventoryConnHistory.extendLocatorId("View"), this.groupComposite), facets
- .contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true);
+ updateSubTab(this.inventoryTab, this.inventoryMembers, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new MembersView(inventoryMembers.extendLocatorId("View"), groupId, canModifyMembers);
+ }
+ });
+ updateSubTab(this.inventoryTab, this.inventoryConn, facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION),
+ true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new CurrentGroupPluginConfigurationView(inventoryConn.extendLocatorId("View"),
+ groupComposite);
+ }
+ });
+ updateSubTab(this.inventoryTab, this.inventoryConnHistory, facets
+ .contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new HistoryGroupPluginConfigurationView(inventoryConnHistory.extendLocatorId("View"),
+ groupComposite);
+ }
+ });
}
private void updateOperationsTab(GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
if (updateTab(this.operationsTab, groupCategory == GroupCategory.COMPATIBLE
&& facets.contains(ResourceTypeFacet.OPERATION), true)) {
- updateSubTab(this.operationsTab, this.operationsSchedules, new GroupOperationScheduleListView(
- this.operationsSchedules.extendLocatorId("View"), this.groupComposite), true, true);
- updateSubTab(this.operationsTab, this.operationsHistory, new GroupOperationHistoryListView(
- this.operationsHistory.extendLocatorId("View"), this.groupComposite), true, true);
+ updateSubTab(this.operationsTab, this.operationsSchedules, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new GroupOperationScheduleListView(operationsSchedules.extendLocatorId("View"),
+ groupComposite);
+ }
+ });
+ updateSubTab(this.operationsTab, this.operationsHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new GroupOperationHistoryListView(operationsHistory.extendLocatorId("View"), groupComposite);
+ }
+ });
}
}
- private void updateAlertsTab(ResourceGroupComposite groupComposite, GroupCategory groupCategory) {
+ private void updateAlertsTab(final ResourceGroupComposite groupComposite, GroupCategory groupCategory) {
// alerts tab is always visible, even for mixed groups
if (updateTab(this.alertsTab, true, true)) {
// alert history is always available
- updateSubTab(this.alertsTab, this.alertHistory, GroupAlertHistoryView.get(this.alertHistory
- .extendLocatorId("View"), groupComposite), true, true);
+ updateSubTab(this.alertsTab, this.alertHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return GroupAlertHistoryView.get(alertHistory.extendLocatorId("View"), groupComposite);
+ }
+ });
// but alert definitions can only be created on compatible groups
boolean visible = (groupCategory == GroupCategory.COMPATIBLE);
- Canvas canvas = (visible) ? new GroupAlertDefinitionsView(alertDef.extendLocatorId("View"),
- this.groupComposite) : null;
- updateSubTab(this.alertsTab, this.alertDef, canvas, visible, true);
+ ViewFactory viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new GroupAlertDefinitionsView(alertDef.extendLocatorId("View"), groupComposite);
+ }
+ };
+ updateSubTab(this.alertsTab, this.alertDef, visible, true, viewFactory);
}
}
- private void updateConfigurationTab(int groupId, GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
+ private void updateConfigurationTab(final int groupId, GroupCategory groupCategory, Set<ResourceTypeFacet> facets) {
boolean visible = (groupCategory == GroupCategory.COMPATIBLE && facets
.contains(ResourceTypeFacet.CONFIGURATION));
Set<Permission> groupPermissions = this.groupComposite.getResourcePermission().getPermissions();
if (updateTab(this.configurationTab, visible, visible && groupPermissions.contains(Permission.CONFIGURE_READ))) {
//updateSubTab(this.configurationTab, this.configCurrent, new FullHTMLPane(
// "/rhq/group/configuration/viewCurrent-plain.xhtml?groupId=" + groupId), true, true);
- updateSubTab(this.configurationTab, this.configCurrent, new GroupResourceConfigurationEditView(
- this.configCurrent.extendLocatorId("View"), this.groupComposite), true, true);
- updateSubTab(this.configurationTab, this.configHistory, new FullHTMLPane(this.configHistory
- .extendLocatorId("View"), "/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId), true,
- true);
+ updateSubTab(this.configurationTab, this.configCurrent, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new GroupResourceConfigurationEditView(configCurrent.extendLocatorId("View"), groupComposite);
+ }
+ });
+ updateSubTab(this.configurationTab, this.configHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(configHistory.extendLocatorId("View"),
+ "/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId);
+ }
+ });
}
}
- private void updateEventsTab(ResourceGroupComposite groupComposite, GroupCategory groupCategory,
+ private void updateEventsTab(final ResourceGroupComposite groupComposite, GroupCategory groupCategory,
Set<ResourceTypeFacet> facets) {
// allow mixed groups to show events from supporting resources
boolean visible = (groupCategory == GroupCategory.MIXED || (groupCategory == GroupCategory.COMPATIBLE && facets
.contains(ResourceTypeFacet.EVENT)));
if (updateTab(this.eventsTab, visible, true)) {
- updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(this.eventHistory
- .extendLocatorId("View"), groupComposite), true, true);
+ updateSubTab(this.eventsTab, this.eventHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return EventCompositeHistoryView.get(eventHistory.extendLocatorId("View"), groupComposite);
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
index a7c1b4f..98176d6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView2.java
@@ -77,6 +77,11 @@ public class ActivityView2 extends AbstractActivityView {
public ActivityView2(String locatorId, ResourceGroupComposite groupComposite) {
super(locatorId, groupComposite);
this.groupComposite = groupComposite;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
loadData();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 4af193b..0f712a6 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -48,6 +48,7 @@ import org.rhq.enterprise.gui.coregui.client.alert.definitions.ResourceAlertDefi
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
import org.rhq.enterprise.gui.coregui.client.components.tab.SubTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.InventoryView;
@@ -264,89 +265,167 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
markForRedraw();
}
- private void updateSummaryTabContent(Resource resource) {
- updateSubTab(this.summaryTab, this.summaryActivity, new ActivityView(this.summaryActivity
- .extendLocatorId("View"), this.resourceComposite), true, true);
+ private void updateSummaryTabContent(final Resource resource) {
+ updateSubTab(this.summaryTab, this.summaryActivity, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ActivityView(summaryActivity.extendLocatorId("View"), resourceComposite);
+ }
+ });
- updateSubTab(this.summaryTab, this.summaryTimeline, new FullHTMLPane(this.summaryTimeline
- .extendLocatorId("View"), "/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId()), true, true);
+ updateSubTab(this.summaryTab, this.summaryTimeline, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(summaryTimeline.extendLocatorId("View"),
+ "/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId());
+ }
+ });
}
// Inventory Tab (always enabled and visible)
- private void updateInventoryTabContent(ResourceComposite resourceComposite, Resource resource,
+ private void updateInventoryTabContent(final ResourceComposite resourceComposite, final Resource resource,
Set<ResourceTypeFacet> facets) {
ResourceType type = this.resourceComposite.getResource().getResourceType();
boolean visible = !type.getChildResourceTypes().isEmpty();
- Canvas canvas = (visible) ? ResourceCompositeSearchView.getChildrenOf(this.inventoryTab
- .extendLocatorId("ChildrenView"), resourceComposite) : null;
- updateSubTab(this.inventoryTab, this.inventoryChildren, canvas, visible, true);
-
- updateSubTab(this.inventoryTab, this.inventoryChildHistory, new Canvas(), visible, true);
+ ViewFactory viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return ResourceCompositeSearchView.getChildrenOf(inventoryTab.extendLocatorId("ChildrenView"),
+ resourceComposite);
+ }
+ };
+ updateSubTab(this.inventoryTab, this.inventoryChildren, visible, true, viewFactory);
+
+ updateSubTab(this.inventoryTab, this.inventoryChildHistory, visible, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ // TODO
+ return new Canvas();
+ }
+ });
visible = facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION);
- canvas = (visible) ? new PluginConfigurationEditView(this.inventoryTab.extendLocatorId("PluginConfigView"),
- resourceComposite) : null;
- updateSubTab(this.inventoryTab, this.inventoryConn, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new PluginConfigurationEditView(inventoryTab.extendLocatorId("PluginConfigView"),
+ resourceComposite);
+ }
+ };
+ updateSubTab(this.inventoryTab, this.inventoryConn, visible, true, viewFactory);
// same test, use above setting for 'visible'
- canvas = (visible) ? new PluginConfigurationHistoryView(this.inventoryConnHistory.extendLocatorId("View"),
- this.resourceComposite.getResourcePermission().isInventory(), this.resourceComposite.getResource().getId())
- : null;
- updateSubTab(this.inventoryTab, this.inventoryConnHistory, canvas, visible, true);
-
- boolean canModifyMembership = globalPermissions.contains(Permission.MANAGE_INVENTORY);
- updateSubTab(this.inventoryTab, this.inventoryGroups, ResourceGroupListView.getGroupsOf(this.inventoryTab
- .extendLocatorId("GroupsView"), resource.getId(), canModifyMembership), true, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new PluginConfigurationHistoryView(inventoryConnHistory.extendLocatorId("View"),
+ resourceComposite.getResourcePermission().isInventory(), resourceComposite.getResource().getId());
+ }
+ };
+ updateSubTab(this.inventoryTab, this.inventoryConnHistory, visible, true, viewFactory);
+
+ final boolean canModifyMembership = globalPermissions.contains(Permission.MANAGE_INVENTORY);
+ updateSubTab(this.inventoryTab, this.inventoryGroups, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return ResourceGroupListView.getGroupsOf(inventoryTab.extendLocatorId("GroupsView"), resource.getId(),
+ canModifyMembership);
+ }
+ });
boolean enabled = globalPermissions.contains(Permission.MANAGE_INVENTORY);
- canvas = (enabled) ? new ResourceResourceAgentView(this.inventoryTab.extendLocatorId("AgentView"), resourceId)
- : null;
- updateSubTab(this.inventoryTab, this.inventoryAgent, canvas, true, enabled);
+ viewFactory = (!enabled) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ResourceResourceAgentView(inventoryTab.extendLocatorId("AgentView"), resourceId);
+ }
+ };
+ updateSubTab(this.inventoryTab, this.inventoryAgent, true, enabled, viewFactory);
}
- private void updateAlertsTabContent(ResourceComposite resourceComposite) {
- updateSubTab(this.alertsTab, this.alertHistory, ResourceAlertHistoryView.get(this.alertHistory
- .extendLocatorId("View"), resourceComposite), true, true);
+ private void updateAlertsTabContent(final ResourceComposite resourceComposite) {
+ updateSubTab(this.alertsTab, this.alertHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return ResourceAlertHistoryView.get(alertHistory.extendLocatorId("View"), resourceComposite);
+ }
+ });
- updateSubTab(this.alertsTab, this.alertDef, new ResourceAlertDefinitionsView(alertsTab
- .extendLocatorId("AlertDefView"), this.resourceComposite), true, true);
+ updateSubTab(this.alertsTab, this.alertDef, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ResourceAlertDefinitionsView(alertsTab.extendLocatorId("AlertDefView"), resourceComposite);
+ }
+ });
}
- private void updateMonitoringTabContent(Resource resource, Set<ResourceTypeFacet> facets) {
+ private void updateMonitoringTabContent(final Resource resource, Set<ResourceTypeFacet> facets) {
boolean visible = hasMetricsOfType(this.resourceComposite, DataType.MEASUREMENT);
- //canvas = (visible) ? new GraphListView(this.monitoringTab.extendLocatorId("GraphListView"), resource) : null;
- Canvas canvas = (visible) ? new FullHTMLPane(this.monitorGraphs.extendLocatorId("View"),
- "/rhq/resource/monitor/graphs-plain.xhtml?id=" + resource.getId()) : null;
- updateSubTab(this.monitoringTab, this.monitorGraphs, canvas, visible, true);
+ ViewFactory viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(monitorGraphs.extendLocatorId("View"),
+ "/rhq/resource/monitor/graphs-plain.xhtml?id=" + resource.getId());
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorGraphs, visible, true, viewFactory);
// visible = same test as above
- canvas = (visible) ? new MeasurementTableView(this.monitorTables.extendLocatorId("View"), resource.getId())
- : null;
- updateSubTab(this.monitoringTab, this.monitorTables, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new MeasurementTableView(monitorTables.extendLocatorId("View"), resource.getId());
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorTables, visible, true, viewFactory);
visible = hasMetricsOfType(this.resourceComposite, DataType.TRAIT);
- canvas = (visible) ? new TraitsView(this.monitoringTab.extendLocatorId("TraitsView"), resource.getId()) : null;
- updateSubTab(this.monitoringTab, this.monitorTraits, canvas, visible, true);
-
- updateSubTab(this.monitoringTab, this.monitorAvail, new FullHTMLPane(this.monitorAvail.extendLocatorId("View"),
- "/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()), true, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new TraitsView(monitoringTab.extendLocatorId("TraitsView"), resource.getId());
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorTraits, visible, true, viewFactory);
+
+ updateSubTab(this.monitoringTab, this.monitorAvail, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(monitorAvail.extendLocatorId("View"),
+ "/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId());
+ }
+ });
- updateSubTab(this.monitoringTab, this.monitorSched, new SchedulesView(monitoringTab
- .extendLocatorId("SchedulesView"), this.resourceComposite), hasMetricsOfType(this.resourceComposite, null),
- true);
+ updateSubTab(this.monitoringTab, this.monitorSched, hasMetricsOfType(this.resourceComposite, null), true,
+ new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new SchedulesView(monitoringTab.extendLocatorId("SchedulesView"), resourceComposite);
+ }
+ });
visible = facets.contains(ResourceTypeFacet.CALL_TIME);
- canvas = (visible) ? new FullHTMLPane(this.monitorCallTime.extendLocatorId("View"),
- "/rhq/resource/monitor/response-plain.xhtml?id=" + resource.getId()) : null;
- updateSubTab(this.monitoringTab, this.monitorCallTime, canvas, visible, true);
+ viewFactory = (!visible) ? null : new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(monitorCallTime.extendLocatorId("View"),
+ "/rhq/resource/monitor/response-plain.xhtml?id=" + resource.getId());
+ }
+ };
+ updateSubTab(this.monitoringTab, this.monitorCallTime, visible, true, viewFactory);
}
- private void updateEventsTabContent(ResourceComposite resourceComposite, Set<ResourceTypeFacet> facets) {
+ private void updateEventsTabContent(final ResourceComposite resourceComposite, Set<ResourceTypeFacet> facets) {
if (updateTab(this.eventsTab, facets.contains(ResourceTypeFacet.EVENT), true)) {
- updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(this.eventsTab
- .extendLocatorId("CompositeHistoryView"), resourceComposite), true, true);
+ updateSubTab(this.eventsTab, this.eventHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return EventCompositeHistoryView.get(eventsTab.extendLocatorId("CompositeHistoryView"),
+ resourceComposite);
+ }
+ });
}
}
@@ -359,44 +438,81 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
// 4) user can navigate to the group operation that spawned this resource operation history, if appropriate
// note: enabled operation execution/schedules from left-nav, if it doesn't already exist
- updateSubTab(this.operationsTab, this.operationsSchedules, new ResourceOperationScheduleListView(
- operationsTab.extendLocatorId("SchedulesView"), this.resourceComposite), true, true);
+ updateSubTab(this.operationsTab, this.operationsSchedules, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ResourceOperationScheduleListView(operationsTab.extendLocatorId("SchedulesView"),
+ resourceComposite);
+ }
+ });
- updateSubTab(this.operationsTab, this.operationsHistory, new ResourceOperationHistoryListView(operationsTab
- .extendLocatorId("HistoryView"), this.resourceComposite), true, true);
+ updateSubTab(this.operationsTab, this.operationsHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ResourceOperationHistoryListView(operationsTab.extendLocatorId("HistoryView"),
+ resourceComposite);
+ }
+ });
}
}
- private void updateConfigurationTabContent(ResourceComposite resourceComposite, Resource resource,
+ private void updateConfigurationTabContent(final ResourceComposite resourceComposite, final Resource resource,
ResourcePermission resourcePermissions, Set<ResourceTypeFacet> facets) {
if (updateTab(this.configurationTab, facets.contains(ResourceTypeFacet.CONFIGURATION), resourcePermissions
.isConfigureRead())) {
- updateSubTab(this.configurationTab, this.configCurrent, new ResourceConfigurationEditView(this
- .extendLocatorId("ResourceConfigView"), resourceComposite), true, true);
+ updateSubTab(this.configurationTab, this.configCurrent, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ResourceConfigurationEditView(configurationTab.extendLocatorId("ResourceConfigView"),
+ resourceComposite);
+ }
+ });
- updateSubTab(this.configurationTab, this.configHistory, new ConfigurationHistoryView(this
- .extendLocatorId("ConfigHistView"), this.resourceComposite.getResourcePermission().isConfigureWrite(),
- resource.getId()), true, true);
+ updateSubTab(this.configurationTab, this.configHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new ConfigurationHistoryView(configurationTab.extendLocatorId("ConfigHistView"),
+ resourceComposite.getResourcePermission().isConfigureWrite(), resource.getId());
+ }
+ });
}
}
- private void updateContentTabContent(Resource resource, Set<ResourceTypeFacet> facets) {
+ private void updateContentTabContent(final Resource resource, Set<ResourceTypeFacet> facets) {
if (updateTab(this.contentTab, facets.contains(ResourceTypeFacet.CONTENT), true)) {
- updateSubTab(this.contentTab, this.contentDeployed, new FullHTMLPane(this.contentDeployed
- .extendLocatorId("View"), "/rhq/resource/content/view-plain.xhtml?id=" + resource.getId()), true, true);
+ updateSubTab(this.contentTab, this.contentDeployed, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(contentDeployed.extendLocatorId("View"),
+ "/rhq/resource/content/view-plain.xhtml?id=" + resource.getId());
+ }
+ });
- updateSubTab(this.contentTab, this.contentNew, new FullHTMLPane(this.contentNew.extendLocatorId("View"),
- "/rhq/resource/content/deploy-plain.xhtml?id=" + resource.getId()), true, true);
+ updateSubTab(this.contentTab, this.contentNew, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(contentNew.extendLocatorId("View"),
+ "/rhq/resource/content/deploy-plain.xhtml?id=" + resource.getId());
+ }
+ });
- updateSubTab(this.contentTab, this.contentSubscrip, new FullHTMLPane(this.contentSubscrip
- .extendLocatorId("View"), "/rhq/resource/content/subscription-plain.xhtml?id=" + resource.getId()),
- true, true);
+ updateSubTab(this.contentTab, this.contentSubscrip, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(contentSubscrip.extendLocatorId("View"),
+ "/rhq/resource/content/subscription-plain.xhtml?id=" + resource.getId());
+ }
+ });
- updateSubTab(this.contentTab, this.contentHistory, new FullHTMLPane(this.configHistory
- .extendLocatorId("View"), "/rhq/resource/content/history-plain.xhtml?id=" + resource.getId()), true,
- true);
+ updateSubTab(this.contentTab, this.contentHistory, true, true, new ViewFactory() {
+ @Override
+ public Canvas createView() {
+ return new FullHTMLPane(configHistory.extendLocatorId("View"),
+ "/rhq/resource/content/history-plain.xhtml?id=" + resource.getId());
+ }
+ });
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
index 452d85c..37b34f1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -72,6 +72,11 @@ public class ActivityView extends AbstractActivityView {
public ActivityView(String locatorId, ResourceComposite resourceComposite) {
super(locatorId, null);
this.resourceComposite = resourceComposite;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
loadData();
}