modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java | 34
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 170 +++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java | 52 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeContextMenu.java | 349 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java | 216 +++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java | 18
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java | 78 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java | 75 --
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java | 23
13 files changed, 798 insertions(+), 232 deletions(-)
New commits:
commit d9c6f5bd8d0de9bb4f101db8200a0912b3012cae
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 30 14:56:39 2010 -0400
Fix history event for root node
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
index eae4e0b..ffbbc6e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
@@ -97,7 +97,7 @@ public class ResourceGroupTreeView extends VLayout implements BookmarkableView {
ClusterKey key = (ClusterKey) selectionEvent.getRecord().getAttributeAsObject("key");
if (key == null) {
// selected the root group
- setSelectedGroup(Integer.parseInt(selectionEvent.getRecord().getAttribute("id")));
+ History.newItem("ResourceGroup/" + selectionEvent.getRecord().getAttribute("id"));
} else {
System.out.println("Select group: " + key);
commit 91a0c3f00ce6afcaf515ad7c6c7b5c395cd81081
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 30 14:49:23 2010 -0400
Lost this work in the rebase
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
index 1dee039..2ae4974 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/LinkManager.java
@@ -285,6 +285,6 @@ public class LinkManager {
public static String getTagLink(String tag) {
- return "Reports/Inventory/Tag%20Cloud/" + tag;
+ return "#Reports/Inventory/Tag%20Cloud/" + tag;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java
index af48596..e0dd4aa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/resource/graph/GraphPortlet.java
@@ -54,6 +54,7 @@ public class GraphPortlet extends SmallGraphView implements CustomSettingsPortle
public static final String CFG_RESOURCE_ID = "resourceId";
public static final String CFG_DEFINITION_ID = "definitionId";
+ public static final String CFG_RESOURCE_GROUP_ID = "resourceGroupId";
public GraphPortlet(String locatorId) {
super(locatorId);
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 064e06a..41ad327 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
@@ -24,14 +24,18 @@ import java.util.Set;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Side;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.tab.Tab;
import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.ResourceTypeFacet;
import org.rhq.core.domain.resource.composite.ResourcePermission;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
@@ -57,6 +61,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public class ResourceGroupDetailView extends LocatableVLayout implements BookmarkableView, TwoLevelTabSelectedHandler {
private static final String DEFAULT_TAB_NAME = "Inventory";
+ private int groupId;
private ResourceGroupComposite groupComposite;
private ResourcePermission permissions;
@@ -88,13 +93,11 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
private ResourceGroupTitleBar titleBar;
+ private String tabName;
+ private String subTabName;
+
public ResourceGroupDetailView(String locatorId) {
super(locatorId);
- }
-
- @Override
- protected void onDraw() {
- super.onDraw();
setWidth100();
setHeight100();
@@ -114,7 +117,7 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
summaryTab.registerSubTabs(summaryOverview, summaryTimeline);
monitoringTab = new TwoLevelTab(topTabSet.extendLocatorId("Monitoring"), "Monitoring",
- "/images/icons/Monitor_grey_16.png");
+ "/images/icons/Monitor_grey_16.png");
monitorGraphs = new SubTab(monitoringTab.extendLocatorId("Graphs"), "Graphs", null);
monitorTables = new SubTab(monitoringTab.extendLocatorId("Tables"), "Tables", null);
monitorSched = new SubTab(monitoringTab.extendLocatorId("Schedules"), "Schedules", null);
@@ -122,13 +125,13 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
monitoringTab.registerSubTabs(monitorGraphs, monitorTables, monitorSched, monitorCallTime);
inventoryTab = new TwoLevelTab(topTabSet.extendLocatorId("Inventory"), "Inventory",
- "/images/icons/Inventory_grey_16.png");
+ "/images/icons/Inventory_grey_16.png");
inventoryMembers = new SubTab(inventoryTab.extendLocatorId("Members"), "Members", null);
inventoryConn = new SubTab(inventoryTab.extendLocatorId("ConnectionSettings"), "Connection Settings", null);
inventoryTab.registerSubTabs(this.inventoryMembers, this.inventoryConn);
operationsTab = new TwoLevelTab(topTabSet.extendLocatorId("Operations"), "Operations",
- "/images/icons/Operation_grey_16.png");
+ "/images/icons/Operation_grey_16.png");
this.opHistory = new SubTab(operationsTab.extendLocatorId("History"), "History", null);
this.opSched = new SubTab(operationsTab.extendLocatorId("Scheduled"), "Scheduled", null);
operationsTab.registerSubTabs(this.opHistory, this.opSched);
@@ -139,7 +142,7 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
alertsTab.registerSubTabs(alertHistory, alertDef);
configurationTab = new TwoLevelTab(topTabSet.extendLocatorId("Configuration"), "Configuration",
- "/images/icons/Configure_grey_16.png");
+ "/images/icons/Configure_grey_16.png");
this.configCurrent = new SubTab(configurationTab.extendLocatorId("Current"), "Current", null);
this.configHistory = new SubTab(configurationTab.extendLocatorId("History"), "History", null);
configurationTab.registerSubTabs(this.configCurrent, this.configHistory);
@@ -149,7 +152,7 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
eventsTab.registerSubTabs(eventHistory);
topTabSet.setTabs(summaryTab, monitoringTab, inventoryTab, operationsTab, alertsTab, configurationTab,
- eventsTab);
+ eventsTab);
topTabSet.addTwoLevelTabSelectedHandler(this);
@@ -161,12 +164,16 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
// CoreGUI.addBreadCrumb(getPlace());
}
- public void onGroupSelected(ResourceGroupComposite groupComposite) {
+ public void updateDetailViews(ResourceGroupComposite groupComposite) {
this.groupComposite = groupComposite;
this.titleBar.setGroup(groupComposite.getResourceGroup());
+ for (Tab top : topTabSet.getTabs()) {
+ ((TwoLevelTab) top).getLayout().destroyViews();
+ }
+
// FullHTMLPane timelinePane = new FullHTMLPane("/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId());
// summaryTab.updateSubTab("Overview", new DashboardView(resource));
// summaryTab.updateSubTab("Timeline", timelinePane);
@@ -189,23 +196,23 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
// inventoryTab.updateSubTab("Connection Settings", new GroupPluginConfigurationEditView(this.group.getId(), this.group.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin));
this.opHistory.setCanvas(new FullHTMLPane("/rhq/group/operation/groupOperationHistory-plain.xhtml?groupId="
- + groupId));
+ + groupId));
this.opSched.setCanvas(new FullHTMLPane("/rhq/group/operation/groupOperationSchedules-plain.xhtml?groupId="
- + groupId));
+ + groupId));
operationsTab.updateSubTab(this.opHistory);
operationsTab.updateSubTab(this.opSched);
this.alertHistory.setCanvas(new FullHTMLPane("/rhq/group/alert/listGroupAlertHistory-plain.xhtml?groupId="
- + groupId));
+ + groupId));
this.alertDef.setCanvas(new FullHTMLPane("/rhq/group/alert/listGroupAlertDefinitions-plain.xhtml?groupId="
- + groupId));
+ + groupId));
alertsTab.updateSubTab(this.alertHistory);
alertsTab.updateSubTab(this.alertDef);
this.configCurrent.setCanvas(new FullHTMLPane("/rhq/group/configuration/viewCurrent-plain.xhtml?groupId="
- + groupId));
+ + groupId));
this.configHistory
- .setCanvas(new FullHTMLPane("/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId));
+ .setCanvas(new FullHTMLPane("/rhq/group/configuration/history-plain.xhtml?groupId=" + groupId));
configurationTab.updateSubTab(this.configCurrent);
configurationTab.updateSubTab(this.configHistory);
@@ -213,42 +220,10 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
eventsTab.updateSubTab(this.eventHistory);
// topTabSet.setSelectedTab(selectedTab);
+ completeTabUpdate();
- updateTabStatus();
-
- topTabSet.markForRedraw();
}
- private void updateTabStatus() {
- final ResourceGroup group = this.groupComposite.getResourceGroup();
-
- if (group.getGroupCategory() == GroupCategory.COMPATIBLE) {
-
- // Load the fully fetched ResourceType.
- ResourceType groupType = group.getResourceType();
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(
- groupType.getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.content, ResourceTypeRepository.MetadataType.operations,
- ResourceTypeRepository.MetadataType.events,
- ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
- public void onTypesLoaded(ResourceType type) {
- group.setResourceType(type);
- GWTServiceLookup.getAuthorizationService().getImplicitGroupPermissions(group.getId(),
- new AsyncCallback<Set<Permission>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load group permissions.", caught);
- }
-
- public void onSuccess(Set<Permission> result) {
- ResourceGroupDetailView.this.permissions = new ResourcePermission(result);
- completeTabUpdate();
- }
- });
- }
- });
- }
- }
private void completeTabUpdate() {
@@ -261,7 +236,7 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
// Inventory>Connection Settings subtab is only enabled for compat groups that define conn props.
inventoryTab.setSubTabEnabled("Connection Settings", groupCategory == GroupCategory.COMPATIBLE
- && facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
+ && facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION));
// Monitoring and Alerts tabs are always enabled for compatible groups and always disabled for mixed groups.
if (groupCategory == GroupCategory.COMPATIBLE) {
@@ -300,26 +275,98 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
if (this.groupComposite == null) {
- History.fireCurrentHistoryState();
+// History.fireCurrentHistoryState();
} else {
// Switch tabs directly, rather than letting the history framework do it, to avoid redrawing the outer views.
- selectTab(tabSelectedEvent.getId(), tabSelectedEvent.getSubTabId());
+// selectTab(tabSelectedEvent.getId(), tabSelectedEvent.getSubTabId());
String tabPath = "/" + tabSelectedEvent.getId() + "/" + tabSelectedEvent.getSubTabId();
String path = "ResourceGroup/" + this.groupComposite.getResourceGroup().getId() + tabPath;
// But still add an item to the history, specifying false to tell it not to fire an event.
- History.newItem(path, false);
+ History.newItem(path, true);
}
}
public void renderView(ViewPath viewPath) {
// e.g. #ResourceGroup/10010/Inventory/Overview
- String tabName = (!viewPath.isEnd()) ? viewPath.getCurrent().getPath() : null; // e.g. "Inventory"
- String subTabName = (viewPath.viewsLeft() >= 1) ? viewPath.getNext().getPath() : null; // e.g. "Overview"
- selectTab(tabName, subTabName);
+ int groupId = Integer.parseInt(viewPath.getCurrent().getPath());
+
+ viewPath.next();
+
+
+ tabName = (!viewPath.isEnd()) ? viewPath.getCurrent().getPath() : null; // e.g. "Inventory"
+ subTabName = (viewPath.viewsLeft() >= 1) ? viewPath.getNext().getPath() : null; // e.g. "Overview"
+
+ viewPath.next();
+ viewPath.next();
+
+
+ if (this.groupId != groupId) {
+ loadSelectedGroup(groupId, viewPath);
+ } else {
+ // Same group just switching tabs
+ selectTab(tabName, subTabName, viewPath);
+ }
+ }
+
+ public void loadSelectedGroup(int groupId, final ViewPath viewPath) {
+ this.groupId = groupId;
+
+
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.addFilterId(groupId);
+ criteria.addFilterVisible(null);
+
+ GWTServiceLookup.getResourceGroupService().findResourceGroupCompositesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceGroupComposite>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load group composite", caught);
+ }
+
+ @Override
+ public void onSuccess(PageList<ResourceGroupComposite> result) {
+ groupComposite = result.get(0);
+ loadResourceType(groupComposite, viewPath);
+ }
+ });
}
- public void selectTab(String tabName, String subtabName) {
+
+ private void loadResourceType(final ResourceGroupComposite groupComposite, final ViewPath viewPath) {
+ final ResourceGroup group = this.groupComposite.getResourceGroup();
+
+ if (group.getGroupCategory() == GroupCategory.COMPATIBLE) {
+
+ // Load the fully fetched ResourceType.
+ ResourceType groupType = group.getResourceType();
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ groupType.getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.content, ResourceTypeRepository.MetadataType.operations,
+ ResourceTypeRepository.MetadataType.events,
+ ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+ group.setResourceType(type);
+ GWTServiceLookup.getAuthorizationService().getImplicitGroupPermissions(group.getId(),
+ new AsyncCallback<Set<Permission>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load group permissions.", caught);
+ }
+
+ public void onSuccess(Set<Permission> result) {
+ ResourceGroupDetailView.this.permissions = new ResourcePermission(result);
+ updateDetailViews(groupComposite);
+ selectTab(tabName, subTabName, viewPath);
+ }
+ });
+ }
+ });
+ }
+ }
+
+
+ public void selectTab(String tabName, String subtabName, ViewPath viewPath) {
if (tabName == null) {
tabName = DEFAULT_TAB_NAME;
}
@@ -335,8 +382,13 @@ public class ResourceGroupDetailView extends LocatableVLayout implements Bookmar
CoreGUI.getErrorHandler().handleError("Invalid subtab name: " + subtabName);
// TODO: Should we fire a history event here to redirect to a valid bookmark?
return;
+ } else {
+ Canvas subView = tab.getLayout().getCurrentCanvas();
+ if (subView instanceof BookmarkableView) {
+ ((BookmarkableView) subView).renderView(viewPath);
+ }
}
- tab.getLayout().selectTab(subtabName);
}
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
index 27cfc12..7f33fda 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
@@ -118,7 +118,10 @@ public class ResourceGroupTitleBar extends LocatableHLayout {
private void loadTags(final TagEditorView tagEditorView) {
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
criteria.addFilterId(group.getId());
+ criteria.addFilterVisible(null); // default is only visible groups, null to support auto-cluster-groups
criteria.fetchTags(true);
+
+
GWTServiceLookup.getResourceGroupService().findResourceGroupsByCriteria(criteria,
new AsyncCallback<PageList<ResourceGroup>>() {
public void onFailure(Throwable caught) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
index f313480..af29e89 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
@@ -22,20 +22,13 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail;
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
-import org.rhq.core.domain.criteria.ResourceGroupCriteria;
-import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewId;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
/**
@@ -45,7 +38,6 @@ public class ResourceGroupTopView extends LocatableHLayout implements Bookmarkab
private Canvas contentCanvas;
- private ResourceGroupComposite currentGroup;
private ResourceGroupTreeView treeView;
private ResourceGroupDetailView detailView;
@@ -76,44 +68,7 @@ public class ResourceGroupTopView extends LocatableHLayout implements Bookmarkab
setContent(detailView);
}
- public void setSelectedGroup(final int groupId, final ViewPath view) {
- // check if requested group is already the current group
- if (null != currentGroup && currentGroup.getResourceGroup().getId() == groupId) {
- return;
- }
-
- ResourceGroupCriteria criteria = new ResourceGroupCriteria();
- criteria.addFilterId(groupId);
- //criteria.fetchTags(true);
- groupService.findResourceGroupCompositesByCriteria(criteria,
- new AsyncCallback<PageList<ResourceGroupComposite>>() {
- public void onFailure(Throwable caught) {
- CoreGUI.getMessageCenter().notify(
- new Message("Group with id [" + groupId + "] does not exist or is not accessible.",
- Message.Severity.Warning));
- caught.printStackTrace();
- CoreGUI.goTo(InventoryView.VIEW_PATH);
- }
-
- public void onSuccess(PageList<ResourceGroupComposite> result) {
- if (result.isEmpty()) {
- //noinspection ThrowableInstanceNeverThrown
- onFailure(new Exception("Group with id [" + groupId + "] does not exist."));
- } else {
- // check if requested group is already the current group. This can happen if
- // renderView (or any callers) execute in quick succession on the same resource group,
- // because of the (async) delay in this call path
- if (null != currentGroup && currentGroup.getResourceGroup().getId() == groupId) {
- return;
- }
-
- currentGroup = result.get(0);
- treeView.setSelectedGroup(currentGroup.getResourceGroup().getId());
- detailView.onGroupSelected(currentGroup);
- }
- }
- });
- }
+
public void setContent(Canvas newContent) {
if (contentCanvas.getChildren().length > 0)
@@ -129,10 +84,9 @@ public class ResourceGroupTopView extends LocatableHLayout implements Bookmarkab
viewPath.getViewPath().add(new ViewId("Overview"));
}
- Integer groupId = Integer.parseInt(viewPath.getCurrent().getPath());
- setSelectedGroup(groupId, viewPath);
- viewPath.next();
+ this.treeView.renderView(viewPath);
+
this.detailView.renderView(viewPath);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeContextMenu.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeContextMenu.java
new file mode 100644
index 0000000..8e1e178
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeContextMenu.java
@@ -0,0 +1,349 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2010 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail;
+
+import java.util.EnumSet;
+import java.util.List;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.Window;
+import com.smartgwt.client.widgets.events.CloseClickHandler;
+import com.smartgwt.client.widgets.events.CloseClientEvent;
+import com.smartgwt.client.widgets.menu.Menu;
+import com.smartgwt.client.widgets.menu.MenuItem;
+import com.smartgwt.client.widgets.menu.MenuItemSeparator;
+import com.smartgwt.client.widgets.menu.events.ClickHandler;
+import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
+import com.smartgwt.client.widgets.tree.TreeNode;
+
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.core.domain.criteria.ResourceTypeCriteria;
+import org.rhq.core.domain.dashboard.Dashboard;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.core.domain.measurement.MeasurementDefinition;
+import org.rhq.core.domain.operation.OperationDefinition;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.group.ClusterKey;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.resource.graph.GraphPortlet;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+
+/**
+ * @author Greg Hinkle
+ */
+public class ResourceGroupTreeContextMenu extends Menu {
+
+ private ResourceType currentType;
+ private ResourceGroup group;
+ private ResourceGroup currentGroup;
+
+ public void showContextMenu(TreeNode node) {
+
+ currentType = (ResourceType) node.getAttributeAsObject("resourceType");
+
+
+ final ClusterKey clusterKey = (ClusterKey) node.getAttributeAsObject("key");
+ if (clusterKey != null) {
+ GWTServiceLookup.getClusterService().createAutoClusterBackingGroup(clusterKey, true,
+ new AsyncCallback<ResourceGroup>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to create or update auto-cluster group: " + clusterKey, caught);
+ }
+
+ @Override
+ public void onSuccess(ResourceGroup result) {
+ showContextMenu(result);
+ }
+ });
+ } else {
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.addFilterId(Integer.parseInt(node.getAttribute("id")));
+ GWTServiceLookup.getResourceGroupService().findResourceGroupsByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceGroup>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load group for context menu", caught);
+ }
+
+ @Override
+ public void onSuccess(PageList<ResourceGroup> result) {
+ showContextMenu(result.get(0));
+ }
+ });
+ }
+
+
+ }
+
+ private void showContextMenu(ResourceGroup group) {
+ this.currentGroup = group;
+
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ currentType.getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.operations,
+ ResourceTypeRepository.MetadataType.children,
+ ResourceTypeRepository.MetadataType.subCategory,
+ ResourceTypeRepository.MetadataType.pluginConfigurationDefinition,
+ ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+ public void onTypesLoaded(ResourceType type) {
+
+ currentType = type;
+
+
+ buildResourceGroupContextMenu(currentGroup, type);
+ showContextMenu();
+ }
+ });
+
+ }
+
+
+ private void buildResourceGroupContextMenu(final ResourceGroup group, final ResourceType resourceType) {
+ setItems(new MenuItem(group.getName()));
+
+ addItem(new MenuItem("Type: " + resourceType.getName()));
+
+ MenuItem editPluginConfiguration = new MenuItem("Plugin Configuration");
+ editPluginConfiguration.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ int groupId = group.getId();
+ int resourceTypeId = resourceType.getId();
+
+ Window configEditor = new Window();
+// configEditor.setTitle("Edit " + group.getName() + " plugin configuration");
+ configEditor.setWidth(800);
+ configEditor.setHeight(800);
+ configEditor.setIsModal(true);
+ configEditor.setShowModalMask(true);
+ configEditor.setCanDragResize(true);
+ configEditor.centerInPage();
+ // TODO Group config editor
+// configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId,
+// ConfigurationEditor.ConfigType.plugin));
+ configEditor.show();
+
+ }
+ });
+ editPluginConfiguration.setEnabled(resourceType.getPluginConfigurationDefinition() != null);
+ addItem(editPluginConfiguration);
+
+ MenuItem editResourceConfiguration = new MenuItem("Resource Configuration");
+ editResourceConfiguration.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ int groupId = group.getId();
+ int resourceTypeId = resourceType.getId();
+
+ final Window configEditor = new Window();
+ configEditor.setTitle("Edit " + group.getName() + " resource configuration");
+ configEditor.setWidth(800);
+ configEditor.setHeight(800);
+ configEditor.setIsModal(true);
+ configEditor.setShowModalMask(true);
+ configEditor.setCanDragResize(true);
+ configEditor.setShowResizer(true);
+ configEditor.centerInPage();
+ configEditor.addCloseClickHandler(new CloseClickHandler() {
+ public void onCloseClick(CloseClientEvent closeClientEvent) {
+ configEditor.destroy();
+ }
+ });
+ // TODO group config editor
+// configEditor.addItem(new ConfigurationEditor(resourceId, resourceTypeId,
+// ConfigurationEditor.ConfigType.resource));
+ configEditor.show();
+
+ }
+ });
+ editResourceConfiguration.setEnabled(resourceType.getResourceConfigurationDefinition() != null);
+ addItem(editResourceConfiguration);
+
+ addItem(new MenuItemSeparator());
+
+ // Operations Menu
+ MenuItem operations = new MenuItem("Operations");
+ Menu opSubMenu = new Menu();
+ if (resourceType.getOperationDefinitions() != null) {
+ for (final OperationDefinition operationDefinition : resourceType.getOperationDefinitions()) {
+ MenuItem operationItem = new MenuItem(operationDefinition.getDisplayName());
+ operationItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+
+ // TODO Group version
+// ResourceCriteria criteria = new ResourceCriteria();
+// criteria.addFilterId(selectedResourceId);
+//
+// GWTServiceLookup.getResourceService().findResourcesByCriteria(criteria,
+// new AsyncCallback<PageList<Resource>>() {
+// public void onFailure(Throwable caught) {
+// CoreGUI.getErrorHandler()
+// .handleError("Failed to get resource to run operation", caught);
+// }
+//
+// public void onSuccess(PageList<Resource> result) {
+// new OperationCreateWizard(result.get(0), operationDefinition).startOperationWizard();
+// }
+// });
+
+ }
+ });
+ opSubMenu.addItem(operationItem);
+ }
+ }
+ operations.setEnabled(resourceType.getOperationDefinitions() != null && !resourceType.getOperationDefinitions().isEmpty());
+ operations.setSubmenu(opSubMenu);
+ addItem(operations);
+
+ addItem(buildMetricsMenu(resourceType));
+
+ /* TODO: We don't support group factory create
+ // Create Menu
+ MenuItem createChildMenu = new MenuItem("Create Child");
+ Menu createChildSubMenu = new Menu();
+ for (final ResourceType childType : resourceType.getChildResourceTypes()) {
+ if (childType.isCreatable()) {
+ MenuItem createItem = new MenuItem(childType.getName());
+ createChildSubMenu.addItem(createItem);
+ createItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent event) {
+ ResourceFactoryCreateWizard.showCreateWizard(resource, childType);
+ }
+ });
+
+ }
+ }
+ createChildMenu.setSubmenu(createChildSubMenu);
+ createChildMenu.setEnabled(createChildSubMenu.getItems().length > 0);
+ contextMenu.addItem(createChildMenu);*/
+
+ /*
+ // TODO We don't group manual import
+ // Manually Add Menu
+ MenuItem importChildMenu = new MenuItem("Import");
+ Menu importChildSubMenu = new Menu();
+ for (ResourceType childType : resourceType.getChildResourceTypes()) {
+ if (childType.isSupportsManualAdd()) {
+ importChildSubMenu.addItem(new MenuItem(childType.getName()));
+ }
+ }
+ if (resourceType.getCategory() == ResourceCategory.PLATFORM) {
+ loadManuallyAddServersToPlatforms(importChildSubMenu);
+ }
+ importChildMenu.setSubmenu(importChildSubMenu);
+ importChildMenu.setEnabled(importChildSubMenu.getItems().length > 0);
+ addItem(importChildMenu);
+ */
+ }
+
+ private void loadManuallyAddServersToPlatforms(final Menu manuallyAddMenu) {
+ ResourceTypeGWTServiceAsync rts = GWTServiceLookup.getResourceTypeGWTService();
+
+ ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.addFilterSupportsManualAdd(true);
+ criteria.fetchParentResourceTypes(true);
+ rts.findResourceTypesByCriteria(criteria, new AsyncCallback<PageList<ResourceType>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load platform manual add children", caught);
+ }
+
+ public void onSuccess(PageList<ResourceType> result) {
+ for (ResourceType type : result) {
+ if (type.getParentResourceTypes() == null || type.getParentResourceTypes().isEmpty()) {
+ MenuItem item = new MenuItem(type.getName());
+ manuallyAddMenu.addItem(item);
+ }
+ }
+ }
+ });
+ }
+
+ private MenuItem buildMetricsMenu(final ResourceType type) {
+ MenuItem measurements = new MenuItem("Measurements");
+ final Menu measurementsSubMenu = new Menu();
+
+ GWTServiceLookup.getDashboardService().findDashboardsForSubject(new AsyncCallback<List<Dashboard>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load user dashboards", caught);
+ }
+
+ public void onSuccess(List<Dashboard> result) {
+
+ if (type.getMetricDefinitions() != null) {
+ for (final MeasurementDefinition def : type.getMetricDefinitions()) {
+
+ MenuItem defItem = new MenuItem(def.getDisplayName());
+ measurementsSubMenu.addItem(defItem);
+ Menu defSubItem = new Menu();
+ defItem.setSubmenu(defSubItem);
+
+ for (final Dashboard d : result) {
+ MenuItem addToDBItem = new MenuItem("Add chart to Dashboard: " + d.getName());
+ defSubItem.addItem(addToDBItem);
+
+ addToDBItem.addClickHandler(new ClickHandler() {
+ public void onClick(MenuItemClickEvent menuItemClickEvent) {
+
+ DashboardPortlet p = new DashboardPortlet(def.getDisplayName() + " Chart",
+ GraphPortlet.KEY, 250);
+ p.getConfiguration().put(
+ new PropertySimple(GraphPortlet.CFG_RESOURCE_GROUP_ID, group.getId()));
+ p.getConfiguration().put(
+ new PropertySimple(GraphPortlet.CFG_DEFINITION_ID, def.getId()));
+
+ d.addPortlet(p, 0, 0);
+
+ GWTServiceLookup.getDashboardService().storeDashboard(d,
+ new AsyncCallback<Dashboard>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to save dashboard to server",
+ caught);
+ }
+
+ public void onSuccess(Dashboard result) {
+ CoreGUI.getMessageCenter().notify(
+ new Message("Saved dashboard " + result.getName() + " to server",
+ Message.Severity.Info));
+ }
+ });
+
+ }
+ });
+
+ }
+
+ }
+ }
+
+ }
+ });
+ measurements.setSubmenu(measurementsSubMenu);
+ return measurements;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
index 1730ac3..eae4e0b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTreeView.java
@@ -24,27 +24,51 @@ package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
+import com.smartgwt.client.widgets.grid.events.SelectionEvent;
import com.smartgwt.client.widgets.layout.VLayout;
import com.smartgwt.client.widgets.tree.Tree;
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeNode;
+import com.smartgwt.client.widgets.tree.events.NodeContextClickEvent;
+import com.smartgwt.client.widgets.tree.events.NodeContextClickHandler;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.group.ClusterKey;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ClusterFlyweight;
+import org.rhq.core.domain.resource.group.composite.ClusterKeyFlyweight;
import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ViewId;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
/**
* @author Greg Hinkle
*/
-public class ResourceGroupTreeView extends VLayout {
+public class ResourceGroupTreeView extends VLayout implements BookmarkableView {
private TreeGrid treeGrid;
+ private ViewId currentViewId;
+ private int rootGroupId;
+ private int selectedGroupId;
+
+ private ResourceGroupTreeContextMenu contextMenu;
+
+ private ResourceGroup rootResourceGroup;
+ private HashMap<Integer, ResourceType> typeMap;
+ private ResourceGroup selectedGroup;
+
public ResourceGroupTreeView() {
setWidth(250);
setHeight100();
@@ -55,57 +79,221 @@ public class ResourceGroupTreeView extends VLayout {
super.onInit();
this.treeGrid = new TreeGrid();
+ treeGrid.setShowRoot(true);
this.treeGrid.setWidth100();
this.treeGrid.setHeight100();
- treeGrid.setShowRoot(true);
addMember(this.treeGrid);
+
+
+ contextMenu = new ResourceGroupTreeContextMenu();
+ treeGrid.setContextMenu(contextMenu);
+
+
+ treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
+ @Override
+ public void onSelectionChanged(SelectionEvent selectionEvent) {
+ if (selectionEvent.getState()) {
+ ClusterKey key = (ClusterKey) selectionEvent.getRecord().getAttributeAsObject("key");
+ if (key == null) {
+ // selected the root group
+ setSelectedGroup(Integer.parseInt(selectionEvent.getRecord().getAttribute("id")));
+ } else {
+ System.out.println("Select group: " + key);
+
+ selectClusterGroup(key);
+ }
+ }
+ }
+ });
+
+ treeGrid.addNodeContextClickHandler(new NodeContextClickHandler() {
+ public void onNodeContextClick(final NodeContextClickEvent event) {
+ event.getNode();
+ event.cancel();
+
+ contextMenu.showContextMenu(event.getNode());
+ }
+ });
+
}
- public void setSelectedGroup(int groupId) {
- GWTServiceLookup.getClusterService().getClusterTree(groupId,
- new AsyncCallback<ClusterFlyweight>() {
+ public void setSelectedGroup(final int groupId) {
+ this.selectedGroupId = groupId;
+
+ ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ criteria.addFilterId(groupId);
+ criteria.addFilterVisible(null);
+ criteria.fetchResourceType(true);
+
+ GWTServiceLookup.getResourceGroupService().findResourceGroupsByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceGroup>>() {
+ @Override
public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError("Failed to load tree", caught);
+ CoreGUI.getErrorHandler().handleError("Failed to load group", caught);
}
- public void onSuccess(ClusterFlyweight result) {
- loadTree(result);
+ @Override
+ public void onSuccess(PageList<ResourceGroup> result) {
+ ResourceGroup group = result.get(0);
+ ResourceGroupTreeView.this.selectedGroup = group;
+
+ if (group.getClusterResourceGroup() == null) {
+ ResourceGroupTreeView.this.rootResourceGroup = group;
+ // This is a straight up group
+ loadGroup(groupId);
+ } else {
+ // Someone select a cluster group beneath a real recursive compatible group
+
+ ResourceGroup rootGroup = group.getClusterResourceGroup();
+ ResourceGroupTreeView.this.rootResourceGroup = rootGroup;
+
+ loadGroup(rootGroup.getId());
+ }
+
}
});
+
+
+ }
+
+
+ private void loadGroup(int groupId) {
+
+ if (groupId == this.rootGroupId) {
+ // Still looking at the same compat-recursive tree
+
+ // TODO reselect tree to selected node
+ if (this.selectedGroup.getClusterKey() != null) {
+ TreeNode selectedNode = treeGrid.getTree().findById(this.selectedGroup.getClusterKey());
+ TreeNode[] parents = treeGrid.getTree().getParents(selectedNode);
+ treeGrid.getTree().openFolders(parents);
+ treeGrid.getTree().openFolder(selectedNode);
+
+ treeGrid.selectRecord(selectedNode);
+ }
+
+
+ } else {
+ this.rootGroupId = groupId;
+ GWTServiceLookup.getClusterService().getClusterTree(groupId,
+ new AsyncCallback<ClusterFlyweight>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to load tree", caught);
+ }
+
+ public void onSuccess(ClusterFlyweight result) {
+ loadTreeTypes(result);
+ }
+ });
+ }
+
+ }
+
+ private void loadTreeTypes(final ClusterFlyweight root) {
+ HashSet<Integer> typeIds = new HashSet<Integer>();
+ typeIds.add(this.rootResourceGroup.getResourceType().getId());
+ getTreeTypes(root, typeIds);
+
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(
+ typeIds.toArray(new Integer[typeIds.size()]),
+ new ResourceTypeRepository.TypesLoadedCallback() {
+ @Override
+ public void onTypesLoaded(HashMap<Integer, ResourceType> types) {
+ ResourceGroupTreeView.this.typeMap = types;
+ loadTree(root);
+ }
+ }
+ );
+ }
+
+
+ private void selectClusterGroup(ClusterKey key) {
+
+ GWTServiceLookup.getClusterService().createAutoClusterBackingGroup(key, true,
+ new AsyncCallback<ResourceGroup>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to create or update auto cluster group", caught);
+ }
+
+ @Override
+ public void onSuccess(ResourceGroup result) {
+ History.newItem("ResourceGroup/" + result.getId());
+ }
+ });
+
}
private void loadTree(ClusterFlyweight root) {
- TreeNode rootNode = new TreeNode(root.getName());
+ TreeNode rootNode = new TreeNode(rootResourceGroup.getName());
+ rootNode.setID(String.valueOf(root.getGroupId())); //getClusterKey().toString());
+ rootNode.setAttribute("resourceType", typeMap.get(rootResourceGroup.getResourceType().getId()));
- loadTree(rootNode, root);
+ ClusterKey rootKey = new ClusterKey(root.getGroupId());
+ loadTree(rootNode, root, rootKey);
Tree tree = new Tree();
+
tree.setRoot(rootNode);
+
treeGrid.setData(tree);
- markForRedraw();
+ treeGrid.markForRedraw();
}
- public void loadTree(TreeNode parent, ClusterFlyweight parentNode) {
+ public void loadTree(TreeNode parent, ClusterFlyweight parentNode, ClusterKey parentKey) {
if (!parentNode.getChildren().isEmpty()) {
+ // TODO Introduce type groups (Do we still like this model for recursive compatibles?)
+
ArrayList<TreeNode> childNodes = new ArrayList<TreeNode>();
- HashMap<Integer,TreeNode> typeNodes = new HashMap<Integer, TreeNode>();
+ HashMap<Integer, TreeNode> typeNodes = new HashMap<Integer, TreeNode>();
for (ClusterFlyweight child : parentNode.getChildren()) {
TreeNode node = new TreeNode(child.getName());
+
+ ClusterKeyFlyweight keyFlyweight = child.getClusterKey();
+ ClusterKey key = new ClusterKey(parentKey, keyFlyweight.getResourceTypeId(), keyFlyweight.getResourceKey());
+
+ ResourceType type = this.typeMap.get(keyFlyweight.getResourceTypeId());
+
+ String icon = "types/" + type.getCategory().getDisplayName() + "_up_16.png";
+
+ node.setIcon(icon);
+
+
+ node.setID(key.getKey());
+ node.setAttribute("key", key);
+ node.setAttribute("resourceType", type);
childNodes.add(node);
if (child.getChildren().isEmpty()) {
node.setIsFolder(false);
} else {
node.setIsFolder(true);
- loadTree(node, child);
+ loadTree(node, child, key);
}
}
parent.setChildren(childNodes.toArray(new TreeNode[childNodes.size()]));
}
}
+
+ public void renderView(ViewPath viewPath) {
+ currentViewId = viewPath.getCurrent();
+ int groupId = Integer.parseInt(currentViewId.getPath());
+ setSelectedGroup(groupId);
+ }
+
+
+ private void getTreeTypes(ClusterFlyweight clusterFlyweight, Set<Integer> typeIds) {
+ if (clusterFlyweight.getClusterKey() != null) {
+ typeIds.add(clusterFlyweight.getClusterKey().getResourceTypeId());
+ }
+
+ for (ClusterFlyweight child : clusterFlyweight.getChildren()) {
+ getTreeTypes(child, typeIds);
+ }
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
index 6f721b2..32e676a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDataSource.java
@@ -18,14 +18,7 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
-import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
-import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
+import java.util.Date;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
@@ -35,7 +28,13 @@ import com.smartgwt.client.data.fields.DataSourceTextField;
import com.smartgwt.client.types.FieldType;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import java.util.Date;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.ConfigurationGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
/**
* @author Greg Hinkle
@@ -108,6 +107,7 @@ public class ConfigurationHistoryDataSource extends RPCDataSource<ResourceConfig
ListGridRecord record = new ListGridRecord();
record.setAttribute("id", from.getId());
record.setAttribute("resource", from.getResource());
+ record.setAttribute("resourceTypeId", from.getResource().getResourceType().getId());
record.setAttribute("subject", from.getSubjectName());
record.setAttribute("configuration", from.getConfiguration());
record.setAttribute("createdTime", new Date(from.getCreatedTime()));
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
index b033a40..8c2b42b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryDetailView.java
@@ -20,47 +20,58 @@ package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configur
import java.util.EnumSet;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Window;
-import com.smartgwt.client.widgets.layout.Layout;
+import com.smartgwt.client.widgets.layout.VLayout;
-import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.ViewPath;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
/**
* @author Greg Hinkle
*/
-public class ConfigurationHistoryDetailView extends Layout {
+public class ConfigurationHistoryDetailView extends VLayout implements BookmarkableView {
- private ConfigurationDefinition definition;
- private Configuration configuration;
+ private int configurationUpdateId;
+
+ public ConfigurationHistoryDetailView() {
+ setWidth100();
+ setHeight100();
+ }
@Override
protected void onDraw() {
super.onDraw();
- if (definition != null && configuration != null) {
- setup();
- }
- }
- public void setConfiguration(ConfigurationDefinition definition, Configuration configuration) {
- this.definition = definition;
- this.configuration = configuration;
- setup();
}
- private void setup() {
- if (getChildren().length > 0)
- getChildren()[0].destroy();
+ private void displayHistory(final ResourceConfigurationUpdate update) {
+
+ ResourceTypeRepository.Cache.getInstance().getResourceTypes(update.getResource().getResourceType().getId(),
+ EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
+ new ResourceTypeRepository.TypeLoadedCallback() {
+
+ public void onTypesLoaded(ResourceType type) {
- ConfigurationEditor editor = new ConfigurationEditor(definition, configuration);
- editor.setReadOnly(true);
- addMember(editor);
- markForRedraw();
+ ConfigurationDefinition definition = type.getResourceConfigurationDefinition();
+
+ ConfigurationEditor editor = new ConfigurationEditor(definition, update.getConfiguration());
+ editor.setReadOnly(true);
+ addMember(editor);
+ markForRedraw();
+ }
+ });
}
public void displayInDialog() {
@@ -76,4 +87,31 @@ public class ConfigurationHistoryDetailView extends Layout {
window.addItem(this);
window.show();
}
+
+ @Override
+ public void renderView(ViewPath viewPath) {
+
+ int updateId = viewPath.getCurrentAsInt();
+
+ ResourceConfigurationUpdateCriteria criteria = new ResourceConfigurationUpdateCriteria();
+ criteria.fetchConfiguration(true);
+ criteria.fetchResource(true);
+ criteria.addFilterId(updateId);
+
+
+ GWTServiceLookup.getConfigurationService().findResourceConfigurationUpdatesByCriteria(criteria,
+ new AsyncCallback<PageList<ResourceConfigurationUpdate>>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Unable to load configuration history", caught);
+ }
+
+ public void onSuccess(PageList<ResourceConfigurationUpdate> result) {
+
+ ResourceConfigurationUpdate update = result.get(0);
+ displayHistory(update);
+ }
+ });
+
+
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
index 472ee86..1053e79 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ConfigurationHistoryView.java
@@ -19,64 +19,52 @@
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration;
import java.util.ArrayList;
-import java.util.EnumSet;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.grid.CellFormatter;
import com.smartgwt.client.widgets.grid.ListGrid;
import com.smartgwt.client.widgets.grid.ListGridRecord;
-import com.smartgwt.client.widgets.grid.events.CellDoubleClickEvent;
-import com.smartgwt.client.widgets.grid.events.CellDoubleClickHandler;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
-import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.resource.Resource;
-import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationComparisonView;
import org.rhq.enterprise.gui.coregui.client.components.table.Table;
import org.rhq.enterprise.gui.coregui.client.components.table.TableAction;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+import org.rhq.enterprise.gui.coregui.client.components.table.TableSection;
/**
* @author Greg Hinkle
*/
-public class ConfigurationHistoryView extends LocatableVLayout {
+public class ConfigurationHistoryView extends TableSection {
private Integer resourceId;
public ConfigurationHistoryView(String locatorId) {
- super(locatorId);
- setWidth100();
- setHeight100();
- setAnimateMembers(true);
-
+ super("ConfigurationHistory", "Configuration History");
+ final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
+ setDataSource(datasource);
}
public ConfigurationHistoryView(String locatorId, final int resourceId) {
- this(locatorId);
+ super("ConfigurationHistory", "Configuration History", new Criteria("resourceId", String.valueOf(resourceId)));
this.resourceId = resourceId;
+
+ final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
+ setDataSource(datasource);
+
+
}
@Override
- protected void onDraw() {
- super.onDraw();
+ protected void configureTable() {
+ super.configureTable();
- Criteria criteria = new Criteria();
- if (resourceId != null) {
- criteria.addCriteria("resourceId", (int) resourceId);
- }
- final ConfigurationHistoryDataSource datasource = new ConfigurationHistoryDataSource();
- Table table = new Table(getLocatorId(), "Configuration History", criteria);
- table.setDataSource(datasource);
- table.getListGrid().setUseAllDataSourceFields(true);
-
- ListGrid grid = table.getListGrid();
+ ListGrid grid = getListGrid();
grid.getField("id").setWidth(60);
grid.getField("createdTime").setWidth(200);
@@ -116,7 +104,7 @@ public class ConfigurationHistoryView extends LocatableVLayout {
grid.getField("subject").setWidth(150);
- table.addTableAction(extendLocatorId("Remove"), "Remove", Table.SelectionEnablement.ANY,
+ addTableAction(extendLocatorId("Remove"), "Remove", Table.SelectionEnablement.ANY,
"Are you sure you want to delete # configurations?", new TableAction() {
public void executeAction(ListGridRecord[] selection) {
// TODO: Implement this method.
@@ -124,7 +112,7 @@ public class ConfigurationHistoryView extends LocatableVLayout {
}
});
- table.addTableAction(extendLocatorId("Compare"), "Compare", Table.SelectionEnablement.MULTIPLE, null,
+ addTableAction(extendLocatorId("Compare"), "Compare", Table.SelectionEnablement.MULTIPLE, null,
new TableAction() {
public void executeAction(ListGridRecord[] selection) {
ArrayList<ResourceConfigurationUpdate> configs = new ArrayList<ResourceConfigurationUpdate>();
@@ -137,14 +125,8 @@ public class ConfigurationHistoryView extends LocatableVLayout {
}
});
- table.getListGrid().addCellDoubleClickHandler(new CellDoubleClickHandler() {
- public void onCellDoubleClick(CellDoubleClickEvent cellDoubleClickEvent) {
- ListGridRecord record = cellDoubleClickEvent.getRecord();
- showDetails(record);
- }
- });
- table.addTableAction(extendLocatorId("ShowDetail"), "Show Details", Table.SelectionEnablement.SINGLE, null,
+ addTableAction(extendLocatorId("ShowDetail"), "Show Details", Table.SelectionEnablement.SINGLE, null,
new TableAction() {
public void executeAction(ListGridRecord[] selection) {
@@ -154,30 +136,17 @@ public class ConfigurationHistoryView extends LocatableVLayout {
}
});
- addMember(table);
}
- public static void showDetails(ListGridRecord record) {
- final ResourceConfigurationUpdate update = (ResourceConfigurationUpdate) record.getAttributeAsObject("entity");
-
- ResourceTypeRepository.Cache.getInstance().getResourceTypes(update.getResource().getResourceType().getId(),
- EnumSet.of(ResourceTypeRepository.MetadataType.resourceConfigurationDefinition),
- new ResourceTypeRepository.TypeLoadedCallback() {
-
- public void onTypesLoaded(ResourceType type) {
-
- ConfigurationDefinition definition = type.getResourceConfigurationDefinition();
-
- ConfigurationHistoryDetailView detailView = new ConfigurationHistoryDetailView();
+ @Override
+ public Canvas getDetailsView(int id) {
+ ConfigurationHistoryDetailView detailView = new ConfigurationHistoryDetailView();
- detailView.setConfiguration(definition, update.getConfiguration());
+ return detailView;
- detailView.displayInDialog();
+ }
- }
- });
- }
// -------- Static Utility loaders ------------
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
index 24fc0e0..f8ebe39 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/type/ResourceTypeRepository.java
@@ -18,7 +18,15 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.type;
-import org.rhq.core.domain.configuration.RawConfiguration;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
@@ -28,15 +36,6 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceTypeGWTServiceAsync;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-
/**
* @author Greg Hinkle
*/
@@ -130,7 +129,7 @@ public class ResourceTypeRepository {
} else {
for (Integer typeId : resourceTypeIds) {
- if (!typeCache.containsKey(typeId) || (metadataTypes != null && !typeCacheLevel.get(typeId).containsAll(metadataTypes))) {
+ if (!typeCache.containsKey(typeId) || (metadataTypes != null && (typeCacheLevel.containsKey(typeId)) && !typeCacheLevel.get(typeId).containsAll(metadataTypes))) {
typesNeeded.add(typeId);
} else {
cachedTypes.put(typeId, typeCache.get(typeId));
@@ -186,7 +185,7 @@ public class ResourceTypeRepository {
criteria.setPageControl(PageControl.getUnlimitedInstance());
- System.out.println("Loading " + typesNeeded.size() + " types: " + metadataTypes.toString());
+ System.out.println("Loading " + typesNeeded.size() + ((metadataTypes != null) ? (" types: " + metadataTypes.toString()) : ""));
resourceTypeService.findResourceTypesByCriteria(criteria, new AsyncCallback<PageList<ResourceType>>() {
public void onFailure(Throwable caught) {
commit 2ffab8117be3ea68c8e77aec7413dbee0e14e673
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Mon Aug 30 14:35:52 2010 -0400
ClusterKey serialization fix (not sure how this got lost in the merge)
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java
index e6d5369..f57608d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/ClusterKey.java
@@ -44,6 +44,10 @@ import java.util.List;
*
*/
public class ClusterKey implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+
static final String DELIM = ":";
static final String DELIM_NODE = "::";
@@ -202,9 +206,14 @@ public class ClusterKey implements Serializable {
* and so typically this class is for use within a ClusterKey, which qualifies the node with
* the root group and constraining node ancestry.. */
public static class Node implements Serializable {
+ private static final long serialVersionUID = 1L;
+
int resourceTypeId;
String resourceKey;
+ public Node() {
+ }
+
public Node(int resourceTypeId, String resourceKey) {
super();
this.resourceTypeId = resourceTypeId;
commit 779937bf4fcef98bd174eecb50ae820e09a16f94
Author: Greg Hinkle <ghinkle(a)redhat.com>
Date: Sun Aug 29 20:43:38 2010 -0400
Fix show/hide animation ordering
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
index a25d7e6..01a19f3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/TableSection.java
@@ -99,13 +99,13 @@ public abstract class TableSection extends Table implements BookmarkableView {
/**
* Shows the details view for the given record of the table.
- *
+ *
* The default implementation of this method assumes there is an
* id attribute on the record and passes it to {@link #showDetails(int)}.
* Subclasses are free to override this behavior. Subclasses usually
* will need to set the {@link #setDetailsView(Canvas) details view}
* explicitly.
- *
+ *
* @param record the record whose details are to be shown
*/
public void showDetails(ListGridRecord record) {
@@ -127,7 +127,7 @@ public abstract class TableSection extends Table implements BookmarkableView {
* Subclasses are free to override this - which you usually want to do
* if you know the full details of the item are stored in the record attributes
* and thus help avoid making a round trip to the DB.
- *
+ *
* @param record the record of the item whose details to be shown; ; null if empty details view should be shown.
*/
public Canvas getDetailsView(ListGridRecord record) {
@@ -150,9 +150,9 @@ public abstract class TableSection extends Table implements BookmarkableView {
* details view will be shown if the id passed in is 0.
* This method is usually called when a user goes to the details
* page via a bookmark or direct link.
- *
+ *
* @param id the id of the row whose details are to be shown; pass in 0 to show empty details
- *
+ *
* @see #showDetails(ListGridRecord)
*/
public void showDetails(int id) {
@@ -163,7 +163,7 @@ public abstract class TableSection extends Table implements BookmarkableView {
* Returns the details canvas with information on the item that has the given ID.
* Note that an empty details view should be returned if the id passed in is 0 (as would
* be the case if a new item is to be created using the details view).
- *
+ *
* @param id the id of the details to be shown; will be 0 if an empty details view should be shown.
*/
public abstract Canvas getDetailsView(int id);
@@ -192,7 +192,7 @@ public abstract class TableSection extends Table implements BookmarkableView {
/**
* For use by subclasses that want to define their own details view.
- *
+ *
* @param detailsView the new details view
*/
protected void setDetailsView(Canvas detailsView) {
@@ -225,20 +225,24 @@ public abstract class TableSection extends Table implements BookmarkableView {
* Switches to viewing the table, hiding the details canvas.
*/
protected void switchToTableView() {
- Canvas contents = getTableContents();
+ final Canvas contents = getTableContents();
if (contents != null) {
- contents.animateShow(AnimationEffect.FADE, new AnimationCallback() {
- @Override
- public void execute(boolean b) {
- if (detailsHolder != null && detailsHolder.isVisible()) {
- detailsHolder.animateHide(AnimationEffect.FADE);
+ if (detailsHolder != null && detailsHolder.isVisible()) {
+ detailsHolder.animateHide(AnimationEffect.FADE, new AnimationCallback() {
+ @Override
+ public void execute(boolean b) {
+ // TODO: Implement this method.
for (Canvas child : detailsHolder.getMembers()) {
detailsHolder.removeMember(child);
}
+
+ contents.animateShow(AnimationEffect.FADE);
}
- }
- });
+ });
+ } else {
+ contents.animateShow(AnimationEffect.FADE);
+ }
}
}
}