modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/GroupAlertHistoryView.java | 10
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/ResourceAlertHistoryView.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/FullHTMLPane.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java | 70 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java | 232 ++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java | 47 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java | 55 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/ViewFactory.java | 31 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 17
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 28 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java | 266 ++--------
17 files changed, 556 insertions(+), 254 deletions(-)
New commits:
commit c9bbab5aef98111111634e6522af529d48956e43
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Oct 28 01:01:02 2010 -0400
fix several bugs in the group config component; extract abstract class to be used as superclass of Inventory, Reports, and Administration top level views; refactored Reports view to extend this new class; make FullHTMLPane locatable
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
index b28f6a6..f622596 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
@@ -49,6 +49,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
/**
* @author Greg Hinkle
*/
+// TODO (ips, 10/28/10): Refactor this class to extend AbstractSectionedLeftNavigationView.
public class AdministrationView extends LocatableHLayout implements BookmarkableView {
public static final String VIEW_ID = "Administration";
@@ -242,7 +243,6 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
content = new RemoteAgentInstallView(this.extendLocatorId("RemoteAgentInstall"));
}
} else if (SECTION_CONFIGURATION_VIEW_ID.equals(sectionName)) {
-
String url = null;
if (PAGE_SYSTEM_SETTINGS_VIEW_ID.equals(pageName)) {
url = "/admin/config/Config.do?mode=edit";
@@ -258,7 +258,7 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
}
if (url != null) {
url = addQueryStringParam(url, "nomenu=true");
- content = new FullHTMLPane(url);
+ content = new FullHTMLPane(this.extendLocatorId(pageName), url);
}
} else if (SECTION_TOPOLOGY_VIEW_ID.equals(sectionName)) {
@@ -272,7 +272,7 @@ public class AdministrationView extends LocatableHLayout implements Bookmarkable
} else if (PAGE_PARTITION_EVENTS_VIEW_ID.equals(pageName)) {
url = "/rhq/ha/listPartitionEvents-plain.xhtml";
}
- content = new FullHTMLPane(url);
+ content = new FullHTMLPane(this.extendLocatorId(pageName), url);
}
// when changing sections make sure the previous section's selection is deselected
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
index 6e6c9c4..d7c2180 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/templates/ResourceTypeTreeView.java
@@ -224,7 +224,8 @@ public class ResourceTypeTreeView extends LocatableVLayout implements Bookmarkab
private void editMetricTemplate(int resourceTypeId) {
// TODO: convert this to GWT
Layout metricCanvas = getMetricTemplateCanvas();
- FullHTMLPane jspPage = new FullHTMLPane("/admin/platform/monitor/Config.do?nomenu=true&mode=configure&id="
+ FullHTMLPane jspPage = new FullHTMLPane(extendLocatorId("MetricTemplate"),
+ "/admin/platform/monitor/Config.do?nomenu=true&mode=configure&id="
+ resourceTypeId + "&type=" + resourceTypeId);
prepareSubCanvas(metricCanvas, jspPage, true);
switchToCanvas(ResourceTypeTreeView.this, metricCanvas);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
index ba78b54..7254669 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertHistoryView.java
@@ -55,7 +55,9 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
* @author Heiko W. Rupp
*/
public class AlertHistoryView extends TableSection {
- public static final String VIEW_ID = "RecentAlerts";
+ // TODO: Create a subclass for the subsystem view.
+ public static final String SUBSYSTEM_VIEW_ID = "RecentAlerts";
+ private static final String SUBSYSTEM_VIEW_TITLE = "Recent Alerts";
private static SortSpecifier DEFAULT_SORT_SPECIFIER = new SortSpecifier(AlertCriteria.SORT_FIELD_CTIME,
SortDirection.DESCENDING);
@@ -64,11 +66,11 @@ public class AlertHistoryView extends TableSection {
// for subsystem views
public AlertHistoryView(String locatorId) {
- this(locatorId, EntityContext.forSubsystemView(), false);
+ this(locatorId, SUBSYSTEM_VIEW_TITLE, EntityContext.forSubsystemView(), false);
}
- protected AlertHistoryView(String tableTitle, EntityContext context, boolean hasWriteAccess) {
- super("AlertsView", tableTitle, new SortSpecifier[] { DEFAULT_SORT_SPECIFIER });
+ protected AlertHistoryView(String locatorId, String tableTitle, EntityContext context, boolean hasWriteAccess) {
+ super(locatorId, tableTitle, new SortSpecifier[] { DEFAULT_SORT_SPECIFIER });
this.context = context;
this.hasWriteAccess = hasWriteAccess;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/GroupAlertHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/GroupAlertHistoryView.java
index b65ad1b..a0943c0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/GroupAlertHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/GroupAlertHistoryView.java
@@ -26,16 +26,14 @@ import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
* @author Joseph Marques
*/
public class GroupAlertHistoryView extends AlertHistoryView {
-
- public static GroupAlertHistoryView get(ResourceGroupComposite composite) {
+ public static GroupAlertHistoryView get(String locatorId, ResourceGroupComposite composite) {
String tableTitle = "Group Alert History";
EntityContext context = EntityContext.forGroup(composite.getResourceGroup().getId());
boolean hasWriteAccess = composite.getResourcePermission().isAlert();
-
- return new GroupAlertHistoryView(tableTitle, context, hasWriteAccess);
+ return new GroupAlertHistoryView(locatorId, tableTitle, context, hasWriteAccess);
}
- private GroupAlertHistoryView(String tableTitle, EntityContext context, boolean hasWriteAccess) {
- super(tableTitle, context, hasWriteAccess);
+ private GroupAlertHistoryView(String locatorId, String tableTitle, EntityContext context, boolean hasWriteAccess) {
+ super(locatorId, tableTitle, context, hasWriteAccess);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/ResourceAlertHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/ResourceAlertHistoryView.java
index e47f5b0..daecace 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/ResourceAlertHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/ResourceAlertHistoryView.java
@@ -26,15 +26,14 @@ import org.rhq.core.domain.resource.composite.ResourceComposite;
* @author Joseph Marques
*/
public class ResourceAlertHistoryView extends AlertHistoryView {
-
- public static ResourceAlertHistoryView get(ResourceComposite composite) {
+ public static ResourceAlertHistoryView get(String locatorId, ResourceComposite composite) {
String tableTitle = "Resource Alert History";
EntityContext context = EntityContext.forResource(composite.getResource().getId());
boolean hasWriteAccess = composite.getResourcePermission().isAlert();
- return new ResourceAlertHistoryView(tableTitle, context, hasWriteAccess);
+ return new ResourceAlertHistoryView(locatorId, tableTitle, context, hasWriteAccess);
}
- private ResourceAlertHistoryView(String tableTitle, EntityContext context, boolean hasWriteAccess) {
- super(tableTitle, context, hasWriteAccess);
+ private ResourceAlertHistoryView(String locatorId, String tableTitle, EntityContext context, boolean hasWriteAccess) {
+ super(locatorId, tableTitle, context, hasWriteAccess);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/FullHTMLPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/FullHTMLPane.java
index bc296cc..f0c553f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/FullHTMLPane.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/FullHTMLPane.java
@@ -19,21 +19,18 @@
package org.rhq.enterprise.gui.coregui.client.components;
import com.smartgwt.client.types.ContentsType;
-import com.smartgwt.client.widgets.HTMLPane;
+
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHTMLPane;
/**
* @author Greg Hinkle
*/
-public class FullHTMLPane extends HTMLPane {
- public FullHTMLPane() {
+public class FullHTMLPane extends LocatableHTMLPane {
+ public FullHTMLPane(String locatorId, String url) {
+ super(locatorId);
setWidth100();
setHeight100();
setContentsType(ContentsType.PAGE);
- }
-
- public FullHTMLPane(String url) {
- this();
- com.allen_sauer.gwt.log.client.Log.debug("Creating IFrame pane with URL [" + url + "]...");
setContentsURL(url);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
index f544ac6..b5a324e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/GroupConfigurationEditor.java
@@ -32,7 +32,7 @@ import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.ItemChangedEvent;
import com.smartgwt.client.widgets.form.events.ItemChangedHandler;
-import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.CanvasItem;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.FormItemIcon;
@@ -40,7 +40,6 @@ import com.smartgwt.client.widgets.form.fields.SpacerItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
-import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.form.fields.events.FormItemClickHandler;
import com.smartgwt.client.widgets.form.fields.events.FormItemIconClickEvent;
import com.smartgwt.client.widgets.layout.HLayout;
@@ -221,7 +220,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
final DynamicForm setAllForm = new DynamicForm();
setAllForm.setNumCols(4);
- setAllForm.setColWidths(175, 25, 250, 100);
+ setAllForm.setColWidths(175, 25, 200, 100);
setAllForm.setCellPadding(5);
List<FormItem> setAllItems = new ArrayList<FormItem>();
@@ -232,7 +231,9 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
StaticTextItem unsetAllHeader = new StaticTextItem();
unsetAllHeader.setShowTitle(false);
- unsetAllHeader.setDefaultValue("<h4>Unset</h4>");
+ if (!propertyDefinitionSimple.isRequired()) {
+ unsetAllHeader.setDefaultValue("<h4>Unset</h4>");
+ }
setAllItems.add(unsetAllHeader);
StaticTextItem valueAllHeader = new StaticTextItem();
@@ -264,10 +265,42 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
setAllItems.add(masterUnsetItem);
setAllItems.add(masterValueItem);
- ButtonItem applyButtonItem = new ButtonItem();
- applyButtonItem.setTitle("Apply");
+ //ButtonItem applyButtonItem = new ButtonItem();
+ //applyButtonItem.setTitle("Apply");
//applyButtonItem.setEndRow(true);
- setAllItems.add(applyButtonItem);
+ //setAllItems.add(applyButtonItem);
+
+ // NOTE (ips, 10/27/10): Using a ButtonItem didn't work out, because SmartGWT would always display it in a new
+ // table row, rather than in the next column in the current row (most likely a bug). So
+ // we use an IButton wrapped in a CanvasItem instead.
+ CanvasItem canvasItem = new CanvasItem();
+ canvasItem.setShowTitle(false);
+ HLayout buttonCanvas = new HLayout();
+ buttonCanvas.setWidth(90);
+ buttonCanvas.setHeight100();
+ buttonCanvas.setAlign(Alignment.LEFT);
+ final IButton applyButton = new IButton("Apply");
+ applyButton.setDisabled(true);
+ buttonCanvas.addMember(applyButton);
+ canvasItem.setCanvas(buttonCanvas);
+ canvasItem.setEndRow(true);
+ setAllItems.add(canvasItem);
+
+ masterValueItem.addChangedHandler(new ChangedHandler() {
+ @Override
+ public void onChanged(ChangedEvent changedEvent) {
+ applyButton.enable();
+ applyButton.focus();
+ }
+ });
+
+ masterUnsetItem.addChangedHandler(new ChangedHandler() {
+ @Override
+ public void onChanged(ChangedEvent changedEvent) {
+ applyButton.enable();
+ applyButton.focus();
+ }
+ });
setAllForm.setFields(setAllItems.toArray(new FormItem[setAllItems.size()]));
layout.addMember(setAllForm);
@@ -290,7 +323,9 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
items.add(memberHeader);
StaticTextItem unsetHeader = new StaticTextItem();
unsetHeader.setShowTitle(false);
- unsetHeader.setDefaultValue("<h4>Unset</h4>");
+ if (!propertyDefinitionSimple.isRequired()) {
+ unsetHeader.setDefaultValue("<h4>Unset</h4>");
+ }
items.add(unsetHeader);
StaticTextItem valueHeader = new StaticTextItem();
valueHeader.setShowTitle(false);
@@ -310,7 +345,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
Configuration configuration = memberConfiguration.getConfiguration();
PropertySimple memberPropertySimple =
(PropertySimple)getProperty(configuration, aggregatePropertySimple, index);
- FormItem valueItem = buildSimpleField(propertyDefinitionSimple, memberPropertySimple);
+ FormItem valueItem = buildSimpleField(propertyDefinitionSimple, memberPropertySimple);
valueItems.add(valueItem);
valueItemNameToPropertySimpleMap.put(valueItem.getName(), memberPropertySimple);
FormItem unsetItem = buildUnsetItem(propertyDefinitionSimple, memberPropertySimple, valueItem);
@@ -320,6 +355,12 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
}
membersForm.setItems(items.toArray(new FormItem[items.size()]));
+ for (FormItem valueItem : valueItems) {
+ String defaultValue = valueItem.getAttribute("defaultValue");
+ setValue(valueItem, defaultValue);
+ valueItem.setDisabled(false);
+ }
+
final IButton okButton = new IButton("OK");
okButton.disable();
okButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
@@ -367,8 +408,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
}
firePropertyChangedEvent(aggregatePropertySimple, propertyDefinitionSimple, isValid);
-
- membersForm.markForRedraw();
+
popup.destroy();
}
});
@@ -380,9 +420,9 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
}
});
- applyButtonItem.addClickHandler(new ClickHandler() {
+ applyButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
@Override
- public void onClick(com.smartgwt.client.widgets.form.fields.events.ClickEvent clickEvent) {
+ public void onClick(ClickEvent clickEvent) {
Object value = masterValueItem.getValue();
for (FormItem valueItem : valueItems) {
setValue(valueItem, value);
@@ -399,6 +439,7 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
});
final IButton cancelButton = new IButton("Cancel");
+ cancelButton.focus();
cancelButton.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {
public void onClick(ClickEvent clickEvent) {
popup.destroy();
@@ -419,7 +460,8 @@ public class GroupConfigurationEditor extends ConfigurationEditor {
@Override
protected boolean updatePropertyValueOnChange(PropertyDefinitionSimple propertyDefinitionSimple,
PropertySimple propertySimple) {
- return isAggregateProperty(propertySimple) && super.updatePropertyValueOnChange(propertyDefinitionSimple, propertySimple); // TODO: Implement this method.
+ return isAggregateProperty(propertySimple) && super.updatePropertyValueOnChange(propertyDefinitionSimple,
+ propertySimple);
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java
new file mode 100644
index 0000000..94b957f
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/AbstractSectionedLeftNavigationView.java
@@ -0,0 +1,232 @@
+/*
+ * 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 as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.view;
+
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+import com.smartgwt.client.types.VisibilityMode;
+import com.smartgwt.client.widgets.Canvas;
+import com.smartgwt.client.widgets.grid.events.CellClickEvent;
+import com.smartgwt.client.widgets.grid.events.CellClickHandler;
+import com.smartgwt.client.widgets.layout.SectionStack;
+import com.smartgwt.client.widgets.layout.SectionStackSection;
+import com.smartgwt.client.widgets.tree.Tree;
+import com.smartgwt.client.widgets.tree.TreeGrid;
+import com.smartgwt.client.widgets.tree.TreeNode;
+
+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.components.tree.EnhancedTreeNode;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
+
+/**
+ * The base class for the various top-level views which have a sectioned navigation menu on the left side and a content
+ * pane on the right side.
+ *
+ * @author Greg Hinkle
+ * @author Ian Springer
+ * @author Jay Shaughnessy
+ */
+public abstract class AbstractSectionedLeftNavigationView extends LocatableHLayout implements BookmarkableView {
+ private String viewId;
+ private ViewId currentSectionViewId;
+ private ViewId currentPageViewId;
+
+ private SectionStack sectionStack;
+
+ private Canvas contentCanvas;
+ private Canvas currentContent;
+ private Map<String, TreeGrid> treeGrids = new LinkedHashMap<String, TreeGrid>();
+ private Map<String, NavigationSection> sectionsByName;
+
+ public AbstractSectionedLeftNavigationView(String locatorId) {
+ this(locatorId, locatorId);
+ }
+
+ public AbstractSectionedLeftNavigationView(String locatorId, String viewId) {
+ super(locatorId);
+ this.viewId = viewId;
+ }
+
+ @Override
+ protected void onInit() {
+ super.onInit();
+
+ setWidth100();
+ setHeight100();
+
+ contentCanvas = new Canvas();
+ contentCanvas.setWidth("*");
+ contentCanvas.setHeight100();
+
+ sectionStack = new LocatableSectionStack(this.getLocatorId());
+ sectionStack.setShowResizeBar(true);
+ sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
+ sectionStack.setWidth(250);
+ sectionStack.setHeight100();
+
+ List<NavigationSection> sections = getNavigationSections();
+ this.sectionsByName = new HashMap<String, NavigationSection>(sections.size());
+ for (NavigationSection section : sections) {
+ TreeGrid treeGrid = buildTreeGridForSection(section);
+ addSection(treeGrid);
+ this.sectionsByName.put(section.getName(), section);
+ }
+
+ addMember(sectionStack);
+ addMember(contentCanvas);
+ }
+
+ protected abstract Canvas defaultView();
+
+ protected abstract List<NavigationSection> getNavigationSections();
+
+ private TreeGrid buildTreeGridForSection(NavigationSection navigationSection) {
+ final TreeGrid treeGrid = new LocatableTreeGrid(navigationSection.getName());
+ treeGrid.setLeaveScrollbarGap(false);
+ treeGrid.setShowHeader(false);
+
+ List<NavigationItem> navigationItems = navigationSection.getNavigationItems();
+ TreeNode[] treeNodes = new TreeNode[navigationItems.size()];
+ for (int i = 0, navigationItemsSize = navigationItems.size(); i < navigationItemsSize; i++) {
+ NavigationItem item = navigationItems.get(i);
+ final TreeNode treeNode = new EnhancedTreeNode(item.getName());
+ treeNode.setIcon(item.getIcon());
+ treeNodes[i] = treeNode;
+ }
+
+ TreeNode rootNode = new EnhancedTreeNode(navigationSection.getName(), treeNodes);
+ Tree tree = new Tree();
+ tree.setRoot(rootNode);
+ treeGrid.setData(tree);
+
+ return treeGrid;
+ }
+
+ private void addSection(final TreeGrid treeGrid) {
+ final String sectionName = treeGrid.getTree().getRoot().getName();
+ this.treeGrids.put(sectionName, treeGrid);
+
+ treeGrid.addCellClickHandler(new CellClickHandler() {
+ @Override
+ public void onCellClick(CellClickEvent event) {
+ // We use cell click as opposed to selected changed handler
+ // because we want to be able to refresh even if clicking
+ // on an already selected node.
+ TreeNode selectedRecord = (TreeNode) treeGrid.getSelectedRecord();
+ if (selectedRecord != null) {
+ String pageName = selectedRecord.getName();
+ String viewPath = viewId + "/" + sectionName + "/" + pageName;
+ CoreGUI.goToView(viewPath);
+ }
+ }
+ });
+
+ SectionStackSection section = new SectionStackSection(sectionName);
+ section.setExpanded(true);
+ section.addItem(treeGrid);
+
+ this.sectionStack.addSection(section);
+ }
+
+ public void setContent(Canvas newContent) {
+ // A call to destroy (e.g. certain IFrames/FullHTMLPane) can actually remove multiple children of the
+ // contentCanvas. As such, we need to query for the children after each destroy to ensure only valid children
+ // are in the array.
+ Canvas[] children;
+ while ((children = contentCanvas.getChildren()).length > 0) {
+ children[0].destroy();
+ }
+
+ contentCanvas.addChild(newContent);
+ contentCanvas.markForRedraw();
+ currentContent = newContent;
+ }
+
+ private void renderContentView(ViewPath viewPath) {
+ currentSectionViewId = viewPath.getCurrent();
+ currentPageViewId = viewPath.getNext();
+
+ String sectionName = currentSectionViewId.getPath();
+ String pageName = currentPageViewId.getPath();
+
+ NavigationSection section = this.sectionsByName.get(sectionName);
+ NavigationItem item = section.getNavigationItem(pageName);
+ // TODO: null checks for section and item.
+ ViewFactory viewFactory = item.getViewFactory();
+ Canvas content = viewFactory.createView();
+
+ // When changing sections make sure the previous section's selection is deselected.
+ selectSectionPageTreeGridNode(sectionName, pageName);
+
+ // Ignore clicks on subsection folder nodes.
+ if (null != content) {
+ setContent(content);
+
+ if (content instanceof BookmarkableView) {
+ ((BookmarkableView) content).renderView(viewPath.next().next());
+ }
+ }
+ }
+
+ public void renderView(ViewPath viewPath) {
+ if (!viewPath.isCurrent(currentSectionViewId) || !viewPath.isNext(currentPageViewId)) {
+ if (viewPath.isEnd()) {
+ // Display default view
+ setContent(defaultView());
+ } else {
+ renderContentView(viewPath);
+ }
+ } else {
+ if (this.currentContent instanceof BookmarkableView) {
+ ((BookmarkableView) this.currentContent).renderView(viewPath.next().next());
+ }
+ }
+ }
+
+ private void selectSectionPageTreeGridNode(String sectionName, String pageName) {
+ for (String name : treeGrids.keySet()) {
+ TreeGrid treeGrid = treeGrids.get(name);
+ if (!name.equals(sectionName)) {
+ treeGrid.deselectAllRecords();
+ } else {
+ Tree tree = treeGrid.getTree();
+ TreeNode node = tree.find(sectionName + "/" + pageName);
+ if (node != null) {
+ treeGrid.selectSingleRecord(node);
+ } else {
+ CoreGUI.getErrorHandler().handleError("Unknown page name '" + pageName + "' for section '"
+ + sectionName + "' - URL is invalid.");
+ }
+ }
+ }
+ }
+
+ protected static String addQueryStringParam(String url, String param) {
+ char separatorChar = (url.indexOf('?') == -1) ? '?' : '&';
+ return url + separatorChar + param;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java
new file mode 100644
index 0000000..ee64e84
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationItem.java
@@ -0,0 +1,47 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.view;
+
+/**
+ * @author Ian Springer
+ */
+public class NavigationItem {
+ private String name;
+ private String icon;
+ private ViewFactory viewFactory;
+
+ public NavigationItem(String name, String icon, ViewFactory viewFactory) {
+ this.icon = icon;
+ this.name = name;
+ this.viewFactory = viewFactory;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getIcon() {
+ return icon;
+ }
+
+ public ViewFactory getViewFactory() {
+ return viewFactory;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java
new file mode 100644
index 0000000..f4d04fb
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/NavigationSection.java
@@ -0,0 +1,55 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.view;
+
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Ian Springer
+ */
+public class NavigationSection {
+ private String name;
+ private List<NavigationItem> navigationItems;
+ private Map<String, NavigationItem> navigationItemsByName;
+
+ public NavigationSection(String name, NavigationItem ... navigationItems) {
+ this.name = name;
+ this.navigationItems = Arrays.asList(navigationItems);
+ this.navigationItemsByName = new LinkedHashMap<String, NavigationItem>(navigationItems.length);
+ for (NavigationItem navigationItem : navigationItems) {
+ this.navigationItemsByName.put(navigationItem.getName(), navigationItem);
+ }
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public List<NavigationItem> getNavigationItems() {
+ return navigationItems;
+ }
+
+ public NavigationItem getNavigationItem(String name) {
+ return navigationItemsByName.get(name);
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/ViewFactory.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/ViewFactory.java
new file mode 100644
index 0000000..a95b716
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/view/ViewFactory.java
@@ -0,0 +1,31 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * 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 for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.view;
+
+import com.smartgwt.client.widgets.Canvas;
+
+/**
+ * Factory for a "view", which is a SmartGWT Canvas.
+ *
+ * @author Ian Springer
+ */
+public interface ViewFactory {
+ Canvas createView();
+}
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 2d2c7c8..dfa408a 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
@@ -221,11 +221,13 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
if (updateTab(this.monitoringTab, groupCategory == GroupCategory.COMPATIBLE, true)) {
visible = hasMetricsOfType(this.groupComposite, DataType.MEASUREMENT);
- canvas = (visible) ? new FullHTMLPane("/rhq/group/monitor/graphs-plain.xhtml?groupId=" + groupId) : null;
+ 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("/rhq/group/monitor/tables-plain.xhtml?groupId=" + groupId) : null;
+ 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);
visible = hasMetricsOfType(this.groupComposite, DataType.TRAIT);
@@ -237,7 +239,8 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
updateSubTab(this.monitoringTab, this.monitorSched, canvas, visible, true);
visible = facets.contains(ResourceTypeFacet.CALL_TIME);
- canvas = (visible) ? new FullHTMLPane("/rhq/group/monitor/response-plain.xhtml?groupId=" + groupId) : null;
+ 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);
// TODO (ips): Add Availability subtab.
}
@@ -255,16 +258,17 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
if (updateTab(this.operationsTab, groupCategory == GroupCategory.COMPATIBLE
&& facets.contains(ResourceTypeFacet.OPERATION), true)) {
- updateSubTab(this.operationsTab, this.opHistory, new FullHTMLPane(
+ updateSubTab(this.operationsTab, this.opHistory, new FullHTMLPane(this.opHistory.extendLocatorId("View"),
"/rhq/group/operation/groupOperationHistory-plain.xhtml?groupId=" + groupId), true, true);
- updateSubTab(this.operationsTab, this.opSched, new FullHTMLPane(
+ updateSubTab(this.operationsTab, this.opSched, new FullHTMLPane(this.opSched.extendLocatorId("View"),
"/rhq/group/operation/groupOperationSchedules-plain.xhtml?groupId=" + groupId), true, true);
}
// 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(groupComposite), true, true);
+ updateSubTab(this.alertsTab, this.alertHistory, GroupAlertHistoryView.get(
+ this.alertHistory.extendLocatorId("View"), groupComposite), true, true);
// but alert definitions can only be created on compatible groups
visible = (groupCategory == GroupCategory.COMPATIBLE);
canvas = (visible) ? new GroupAlertDefinitionsView(alertDef.extendLocatorId("View"),
@@ -279,6 +283,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
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);
}
// allow mixed groups to show events from supporting resources
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
index 5ade636..3145c05 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
@@ -58,6 +58,7 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
* @author Greg Hinkle
* @author Joseph Marques
*/
+// TODO (ips, 10/28/10): Refactor this class to extend AbstractSectionedLeftNavigationView.
public class InventoryView extends LocatableHLayout implements BookmarkableView {
public static final String VIEW_ID = "Inventory";
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
index f0154d3..e5926aa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
@@ -54,7 +54,7 @@ public class ResourceSearchView extends Table {
private static final String DEFAULT_TITLE = "Resources";
- private ArrayList<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
+ private List<ResourceSelectListener> selectListeners = new ArrayList<ResourceSelectListener>();
/**
* A list of all Resources in the system.
@@ -74,12 +74,19 @@ public class ResourceSearchView extends Table {
this(locatorId, criteria, DEFAULT_TITLE);
}
+ /**
+ * A Resource list filtered by a given criteria with the given title.
+ *
+ * @param headerIcons 24x24 icon(s) to be displayed in the header
+ */
public ResourceSearchView(String locatorId, Criteria criteria, String title, String... headerIcons) {
this(locatorId, criteria, title, null, null, headerIcons);
}
/**
* A Resource list filtered by a given criteria with the given title.
+ *
+ * @param headerIcons 24x24 icon(s) to be displayed in the header
*/
public ResourceSearchView(String locatorId, Criteria criteria, String title, SortSpecifier[] sortSpecifier,
String[] excludeFields, String... headerIcons) {
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 3b1d107..517c105 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
@@ -206,28 +206,36 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.summaryTab, this.summaryOverview,
new OverviewView(this.summaryTab.extendLocatorId("OverviewView"), this.resourceComposite), true, true);
- updateSubTab(this.summaryTab, this.summaryDashboard, new DashboardView(this.resourceComposite), true, true);
+ updateSubTab(this.summaryTab, this.summaryDashboard, new DashboardView(
+ this.summaryDashboard.extendLocatorId("View"), this.resourceComposite), true, true);
updateSubTab(this.summaryTab, this.summaryTimeline, new FullHTMLPane(
+ this.summaryTimeline.extendLocatorId("View"),
"/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId()), true, true);
visible = hasMetricsOfType(this.resourceComposite, DataType.MEASUREMENT);
//canvas = (visible) ? new GraphListView(this.monitoringTab.extendLocatorId("GraphListView"), resource) : null;
- canvas = (visible) ? new FullHTMLPane("/rhq/resource/monitor/graphs-plain.xhtml?id=" + resource.getId()) : null;
+ 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);
+
// visible = same test as above
- canvas = (visible) ? new FullHTMLPane("/rhq/common/monitor/tables-plain.xhtml?id=" + resource.getId()) : null;
+ canvas = (visible) ? new FullHTMLPane(this.monitorTables.extendLocatorId("View"),
+ "/rhq/common/monitor/tables-plain.xhtml?id=" + resource.getId()) : null;
updateSubTab(this.monitoringTab, this.monitorTables, canvas, visible, true);
+
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(
+ updateSubTab(this.monitoringTab, this.monitorAvail, new FullHTMLPane(this.monitorAvail.extendLocatorId("View"),
"/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()), true, true);
updateSubTab(this.monitoringTab, this.monitorSched,
new SchedulesView(monitoringTab.extendLocatorId("SchedulesView"), resource.getId()),
hasMetricsOfType(this.resourceComposite, null), true);
+
visible = facets.contains(ResourceTypeFacet.CALL_TIME);
- canvas = (visible) ? new FullHTMLPane("/rhq/resource/monitor/response-plain.xhtml?id=" + resource.getId())
+ 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);
@@ -257,11 +265,12 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
// note: enabled operation execution/schedules from left-nav, if it doesn't already exist
updateSubTab(this.operationsTab, this.opHistory, OperationHistoryView.getResourceHistoryView(
operationsTab.extendLocatorId("HistoryView"), this.resourceComposite), true, true);
- updateSubTab(this.operationsTab, this.opSched, new FullHTMLPane(
+ updateSubTab(this.operationsTab, this.opSched, new FullHTMLPane(this.opSched.extendLocatorId("View"),
"/rhq/resource/operation/resourceOperationSchedules-plain.xhtml?id=" + resource.getId()), true, true);
}
- updateSubTab(this.alertsTab, this.alertHistory, ResourceAlertHistoryView.get(resourceComposite), true, true);
+ updateSubTab(this.alertsTab, this.alertHistory,
+ ResourceAlertHistoryView.get(this.alertHistory.extendLocatorId("View"), resourceComposite), true, true);
updateSubTab(this.alertsTab, this.alertDef,
new ResourceAlertDefinitionsView(alertsTab.extendLocatorId("AlertDefView"), this.resourceComposite), true,
true);
@@ -283,12 +292,15 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
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.contentNew, new FullHTMLPane(
+ 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.contentSubscrip, new FullHTMLPane(
+ this.contentSubscrip.extendLocatorId("View"),
"/rhq/resource/content/subscription-plain.xhtml?id=" + resource.getId()), true, true);
updateSubTab(this.contentTab, this.contentHistory, new FullHTMLPane(
+ this.configHistory.extendLocatorId("View"),
"/rhq/resource/content/history-plain.xhtml?id=" + resource.getId()), true, true);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java
index b857b35..078c8e9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/DashboardView.java
@@ -30,7 +30,8 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceSelectLi
public class DashboardView extends FullHTMLPane implements ResourceSelectListener {
private ResourceComposite resourceComposite;
- public DashboardView(ResourceComposite resourceComposite) {
+ public DashboardView(String locatorId, ResourceComposite resourceComposite) {
+ super(locatorId, null);
this.resourceComposite = resourceComposite;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
index 1f5a37b..d5cd465 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
@@ -22,249 +22,121 @@
*/
package org.rhq.enterprise.gui.coregui.client.report;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import java.util.ArrayList;
+import java.util.List;
-import com.google.gwt.http.client.URL;
-import com.google.gwt.user.client.History;
-import com.smartgwt.client.types.VisibilityMode;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
-import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.SectionStack;
-import com.smartgwt.client.widgets.layout.SectionStackSection;
-import com.smartgwt.client.widgets.tree.Tree;
-import com.smartgwt.client.widgets.tree.TreeGrid;
-import com.smartgwt.client.widgets.tree.TreeNode;
-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.alert.AlertHistoryView;
import org.rhq.enterprise.gui.coregui.client.components.FullHTMLPane;
-import org.rhq.enterprise.gui.coregui.client.components.tree.EnhancedTreeNode;
+import org.rhq.enterprise.gui.coregui.client.components.view.AbstractSectionedLeftNavigationView;
+import org.rhq.enterprise.gui.coregui.client.components.view.NavigationItem;
+import org.rhq.enterprise.gui.coregui.client.components.view.NavigationSection;
+import org.rhq.enterprise.gui.coregui.client.components.view.ViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.platform.PlatformPortletView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ConfigurationHistoryView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
import org.rhq.enterprise.gui.coregui.client.report.measurement.MeasurementOOBView;
import org.rhq.enterprise.gui.coregui.client.report.tag.TaggedView;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableSectionStack;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
/**
* @author Greg Hinkle
*/
-public class ReportTopView extends LocatableHLayout implements BookmarkableView {
+public class ReportTopView extends AbstractSectionedLeftNavigationView {
public static final String VIEW_ID = "Reports";
private static final String SUBSYSTEMS_SECTION_VIEW_ID = "Subsystems";
private static final String INVENTORY_SECTION_VIEW_ID = "Inventory";
- private ViewId currentSectionViewId;
- private ViewId currentPageViewId;
-
- private SectionStack sectionStack;
-
- private Canvas contentCanvas;
- private Canvas currentContent;
- private Map<String, TreeGrid> treeGrids = new LinkedHashMap<String, TreeGrid>();
-
public ReportTopView(String locatorId) {
- super(locatorId);
+ super(locatorId, VIEW_ID);
}
@Override
- protected void onInit() {
- super.onInit();
-
- setWidth100();
- setHeight100();
+ protected List<NavigationSection> getNavigationSections() {
+ List<NavigationSection> sections = new ArrayList<NavigationSection>();
- contentCanvas = new Canvas();
- contentCanvas.setWidth("*");
- contentCanvas.setHeight100();
+ NavigationSection subsystemsSection = buildSubsystemsSection();
+ sections.add(subsystemsSection);
- sectionStack = new LocatableSectionStack(this.getLocatorId());
- sectionStack.setShowResizeBar(true);
- sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
- sectionStack.setWidth(250);
- sectionStack.setHeight100();
+ NavigationSection inventorySection = buildInventorySection();
+ sections.add(inventorySection);
- addSection(buildSubsystemsSection());
- addSection(buildInventorySection());
-
- addMember(sectionStack);
- addMember(contentCanvas);
+ return sections;
}
- private void addSection(TreeGrid treeGrid) {
- final String sectionName = treeGrid.getTree().getRoot().getName();
- this.treeGrids.put(sectionName, treeGrid);
-
- treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
- public void onSelectionChanged(SelectionEvent selectionEvent) {
- if (selectionEvent.getState()) {
- TreeNode node = (TreeNode) selectionEvent.getRecord();
- String pageName = node.getName();
- String viewPath = ReportTopView.VIEW_ID + "/" + sectionName + "/" + pageName;
- String currentViewPath = History.getToken();
- if (!currentViewPath.startsWith(viewPath)) {
- CoreGUI.goToView(viewPath);
- }
- }
- }
- });
-
- SectionStackSection section = new SectionStackSection(sectionName);
- section.setExpanded(true);
- section.addItem(treeGrid);
-
- this.sectionStack.addSection(section);
- }
-
- private HTMLFlow defaultView() {
+ @Override
+ protected HTMLFlow defaultView() {
String contents = "<h1>Reports</h1>\n" + "This section provides access to global reports.";
HTMLFlow flow = new HTMLFlow(contents);
flow.setPadding(20);
return flow;
}
- private TreeGrid buildSubsystemsSection() {
- final TreeGrid inventoryTreeGrid = new LocatableTreeGrid(SUBSYSTEMS_SECTION_VIEW_ID);
- inventoryTreeGrid.setLeaveScrollbarGap(false);
- inventoryTreeGrid.setShowHeader(false);
-
- Tree tree = new Tree();
- final TreeNode tagCloud = new EnhancedTreeNode(TaggedView.VIEW_ID);
- tagCloud.setIcon("global/Cloud_16.png");
-
- final TreeNode suspectMetrics = new EnhancedTreeNode(MeasurementOOBView.VIEW_ID);
- suspectMetrics.setIcon("subsystems/monitor/Monitor_failed_16.png");
-
- final TreeNode recentConfigurationChanges = new EnhancedTreeNode(ConfigurationHistoryView.VIEW_ID);
- recentConfigurationChanges.setIcon("subsystems/configure/Configure_16.png");
-
- final TreeNode recentOperations = new EnhancedTreeNode(OperationHistoryView.VIEW_ID);
- recentOperations.setIcon("subsystems/control/Operation_16.png");
-
- final TreeNode recentAlerts = new EnhancedTreeNode(AlertHistoryView.VIEW_ID);
- recentAlerts.setIcon("subsystems/alert/Alert_LOW_16.png");
-
- final TreeNode alertDefinitions = new EnhancedTreeNode("Alert Definitions");
- alertDefinitions.setIcon("subsystems/alert/Alerts_16.png");
-
- TreeNode inventoryNode = new EnhancedTreeNode(SUBSYSTEMS_SECTION_VIEW_ID, tagCloud, suspectMetrics,
- recentConfigurationChanges, recentOperations, recentAlerts, alertDefinitions);
- tree.setRoot(inventoryNode);
-
- inventoryTreeGrid.setData(tree);
-
- return inventoryTreeGrid;
- }
-
- private TreeGrid buildInventorySection() {
-
- final TreeGrid reportsTreeGrid = new LocatableTreeGrid(INVENTORY_SECTION_VIEW_ID);
- reportsTreeGrid.setLeaveScrollbarGap(false);
- reportsTreeGrid.setShowHeader(false);
-
- Tree tree = new Tree();
- final TreeNode inventorySummary = new EnhancedTreeNode("InventorySummary");
- inventorySummary.setIcon("subsystems/inventory/Inventory_16.png");
-
- final TreeNode platforms = new EnhancedTreeNode(PlatformPortletView.VIEW_ID);
- platforms.setIcon("types/Platform_up_16.png");
-
- TreeNode reportsNode = new EnhancedTreeNode(INVENTORY_SECTION_VIEW_ID, inventorySummary, platforms);
- tree.setRoot(reportsNode);
-
- reportsTreeGrid.setData(tree);
-
- return reportsTreeGrid;
- }
-
- public void setContent(Canvas newContent) {
- // A call to destroy (e.g. certain IFrames/FullHTMLPane) can actually remove multiple children of the
- // contentCanvas. As such, we need to query for the children after each destroy to ensure only valid children
- // are in the array.
- Canvas[] children;
- while ((children = contentCanvas.getChildren()).length > 0) {
- children[0].destroy();
- }
-
- contentCanvas.addChild(newContent);
- contentCanvas.markForRedraw();
- this.currentContent = newContent;
- }
-
- private void renderContentView(ViewPath viewPath) {
- currentSectionViewId = viewPath.getCurrent();
- currentPageViewId = viewPath.getNext();
-
- String sectionName = currentSectionViewId.getPath();
- String pageName = currentPageViewId.getPath();
-
- pageName = URL.decode(pageName);
+ private NavigationSection buildSubsystemsSection() {
+ NavigationItem tagItem = new NavigationItem(TaggedView.VIEW_ID, "global/Cloud_16.png", new ViewFactory() {
+ public Canvas createView() {
+ return new TaggedView(extendLocatorId("Tag"));
+ }
+ });
- Canvas content = null;
- if (SUBSYSTEMS_SECTION_VIEW_ID.equals(sectionName)) {
- if (TaggedView.VIEW_ID.equals(pageName)) {
- content = new TaggedView(this.extendLocatorId("Tag"));
- } else if (MeasurementOOBView.VIEW_ID.equals(pageName)) {
- content = new MeasurementOOBView(this.extendLocatorId("SuspectMetrics"));
- } else if (ConfigurationHistoryView.VIEW_ID.equals(pageName)) {
- content = new ConfigurationHistoryView(this.extendLocatorId("ConfigHistory"));
- } else if (OperationHistoryView.VIEW_ID.equals(pageName)) {
- content = new OperationHistoryView(this.extendLocatorId("RecentOps"));
- } else if (AlertHistoryView.VIEW_ID.equals(pageName)) {
- content = new AlertHistoryView(this.extendLocatorId("RecentAlerts"));
- } else if ("Alert Definitions".equals(pageName)) {
- // TODO (mazz)
+ NavigationItem suspectMetricsItem = new NavigationItem(MeasurementOOBView.VIEW_ID,
+ "subsystems/monitor/Monitor_failed_16.png", new ViewFactory() {
+ public Canvas createView() {
+ return new MeasurementOOBView(extendLocatorId("SuspectMetrics"));
}
- } else if (INVENTORY_SECTION_VIEW_ID.equals(sectionName)) {
- if ("InventorySummary".equals(pageName)) {
- content = new FullHTMLPane("/rhq/admin/report/resourceInstallReport-body.xhtml");
- } else if (PlatformPortletView.VIEW_ID.equals(pageName)) {
- content = new PlatformPortletView(this.extendLocatorId("Platforms"));
+ });
+
+ NavigationItem recentConfigurationChangesItem = new NavigationItem(ConfigurationHistoryView.VIEW_ID,
+ "subsystems/configure/Configure_16.png", new ViewFactory() {
+ public Canvas createView() {
+ return new ConfigurationHistoryView(extendLocatorId("ConfigHistory"));
}
- }
+ });
- for (String name : treeGrids.keySet()) {
- TreeGrid treeGrid = treeGrids.get(name);
- if (name.equals(sectionName)) {
- TreeNode node = treeGrid.getTree().find(pageName);
- if (node != null) {
- treeGrid.selectSingleRecord(node);
- }
- } else {
- treeGrid.deselectAllRecords();
+ NavigationItem recentOperationsItem = new NavigationItem(OperationHistoryView.VIEW_ID,
+ "subsystems/control/Operation_16.png", new ViewFactory() {
+ public Canvas createView() {
+ return new OperationHistoryView(extendLocatorId("RecentOps"));
}
- }
+ });
- if (null != content) {
- setContent(content);
+ NavigationItem recentAlertsItem = new NavigationItem(AlertHistoryView.SUBSYSTEM_VIEW_ID,
+ "subsystems/alert/Alert_LOW_16.png", new ViewFactory() {
+ public Canvas createView() {
+ return new AlertHistoryView(extendLocatorId("RecentAlerts"));
+ }
+ });
- if (content instanceof BookmarkableView) {
- ((BookmarkableView) content).renderView(viewPath.next().next());
+ NavigationItem alertDefinitionsItem = new NavigationItem("AlertDefinitions",
+ "subsystems/alert/Alerts_16.png", new ViewFactory() {
+ public Canvas createView() {
+ return null; // TODO: mazz
}
- }
+ });
+
+ return new NavigationSection(SUBSYSTEMS_SECTION_VIEW_ID, tagItem, suspectMetricsItem,
+ recentConfigurationChangesItem, recentOperationsItem, recentAlertsItem, alertDefinitionsItem);
}
- public void renderView(ViewPath viewPath) {
- if (!viewPath.isCurrent(currentSectionViewId) || !viewPath.isNext(currentPageViewId)) {
- if (viewPath.isEnd()) {
- // Display default view
- setContent(defaultView());
- } else {
- renderContentView(viewPath);
+ private NavigationSection buildInventorySection() {
+ NavigationItem
+ inventorySummaryItem = new NavigationItem("InventorySummary", "subsystems/inventory/Inventory_16.png",
+ new ViewFactory() {
+ public Canvas createView() {
+ return new FullHTMLPane(extendLocatorId("InventorySummary"),
+ "/rhq/admin/report/resourceInstallReport-body.xhtml");
}
- } else {
- if (this.currentContent instanceof BookmarkableView) {
- ((BookmarkableView) this.currentContent).renderView(viewPath.next().next());
+ });
+
+ NavigationItem platformSystemInfoItem = new NavigationItem(PlatformPortletView.VIEW_ID, "types/Platform_up_16.png",
+ new ViewFactory() {
+ public Canvas createView() {
+ return new PlatformPortletView(extendLocatorId("Platforms"));
}
- }
+ });
+
+ return new NavigationSection(INVENTORY_SECTION_VIEW_ID, inventorySummaryItem, platformSystemInfoItem);
}
}
\ No newline at end of file