modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
| 29 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
| 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AdministrationView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
| 65 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
| 8
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSelectedEvent.java
| 22 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
| 25 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
| 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
| 166 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTopView.java
| 18 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsDataSource.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
| 117 +++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
| 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
| 29 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/ReportTopView.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RPCManager.java
| 27 -
19 files changed, 269 insertions(+), 270 deletions(-)
New commits:
commit f32625b5a47a803f36bc77351f8efa8344070381
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Sat Sep 11 01:25:22 2010 -0400
various fixes to tab/tree navigation/bookmarking; various refactoring of tab
components; some refactoring of Resource and group detail views
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
index 12c624c..77cc196 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/CoreGUI.java
@@ -132,11 +132,9 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
messages = GWT.create(Messages.class);
checkLoginStatus();
-
}
public static void checkLoginStatus() {
-
// String sessionIdString =
com.google.gwt.user.client.Cookies.getCookie("RHQ_Sesssion");
// if (sessionIdString == null) {
@@ -255,9 +253,8 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
}
public void onValueChange(ValueChangeEvent<String> stringValueChangeEvent) {
-
String event = URL.decodeComponent(stringValueChangeEvent.getValue());
- System.out.println("Handling history event: " + event);
+ //System.out.println("Handling history event: " + event);
currentPath = event;
currentViewPath = new ViewPath(event);
@@ -357,8 +354,24 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
contentCanvas.markForRedraw();
}
- public static void goTo(String path) {
- History.newItem(path);
+ public static void goToView(String viewPath) {
+ String currentViewPath = History.getToken();
+ if (currentViewPath.equals(viewPath)) {
+ // We're already there - just refresh the view.
+ refresh();
+ } else {
+ if (viewPath.matches("(Resource|ResourceGroup)/[^/]*")) {
+ // e.g. "Resource/10001"
+ if (!currentViewPath.startsWith(viewPath)) {
+ // The Resource that was selected is not the same Resource that was
previously selected -
+ // grab the end portion of the previous history URL and append it to
the new history URL,
+ // so the same tab is selected for the new Resource.
+ String suffix =
currentViewPath.replaceFirst("^[^/]*/[^/]*", "");
+ viewPath += suffix;
+ }
+ }
+ History.newItem(viewPath);
+ }
}
public static void refreshBreadCrumbTrail() {
@@ -386,6 +399,10 @@ public class CoreGUI implements EntryPoint,
ValueChangeHandler<String> {
});
}
+ public static void goToResourceOrGroupView(String newToken) {
+
+ }
+
private class RootCanvas extends VLayout implements BookmarkableView {
ViewId currentViewId;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
index aa9da49..935f351 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/DemoCanvas.java
@@ -78,7 +78,7 @@ public class DemoCanvas extends Canvas {
topTabSet.addTab(configTab);
topTabSet.addTab(treeTab);
//topTabSet.addTab(alertHistoryTab);
- //topTabSet.selectTab(alertHistoryTab);
+ //topTabSet.selectSubTabByTitle(alertHistoryTab);
final Menu configSelectMenu = new Menu();
configSelectMenu.addItem(new MenuItem("Agent"));
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
index 7d022ce..1302774 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewId.java
@@ -28,12 +28,10 @@ import java.util.List;
*/
public class ViewId {
-
private String path;
private List<Breadcrumb> breadcrumbs;
-
public ViewId(String path, Breadcrumb... breadcrumbs) {
this.path = path;
if ( breadcrumbs != null) {
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
index 445b0b7..d0e3c06 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ViewPath.java
@@ -19,13 +19,14 @@
package org.rhq.enterprise.gui.coregui.client;
import java.util.ArrayList;
+import java.util.List;
/**
* @author Greg Hinkle
*/
public class ViewPath {
- private ArrayList<ViewId> viewPath = new ArrayList<ViewId>();
+ private List<ViewId> viewPath = new ArrayList<ViewId>();
private int index = 0;
@@ -35,12 +36,12 @@ public class ViewPath {
}
public ViewPath(String pathString) {
- for (String pe : pathString.split("/")) {
- viewPath.add(new ViewId(pe));
+ for (String pathElement : pathString.split("/")) {
+ viewPath.add(new ViewId(pathElement));
}
}
- public ArrayList<ViewId> getViewPath() {
+ public List<ViewId> getViewPath() {
return viewPath;
}
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 7c69fa5..df0f4b5 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
@@ -91,7 +91,7 @@ public class AdministrationView extends LocatableHLayout implements
Bookmarkable
grid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
- CoreGUI.goTo("Administration/" + name + "/" +
selectionEvent.getRecord().getAttribute("name"));
+ CoreGUI.goToView("Administration/" + name +
"/" + selectionEvent.getRecord().getAttribute("name"));
}
}
});
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index 1db0e78..741d931 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -48,7 +48,6 @@ public class SubTabLayout extends LocatableVLayout {
private SubTab currentlyDisplayed;
private String currentlySelected;
- private int currentIndex;
public SubTabLayout(String locatorId) {
super(locatorId);
@@ -99,12 +98,9 @@ public class SubTabLayout extends LocatableVLayout {
// button.setStyleName("SubTabButton");
// button.setStylePrimaryName("SubTabButton");
- final Integer index = i++;
-
button.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
currentlySelected = locatorId;
- currentIndex = index;
fireSubTabSelection();
draw();
}
@@ -116,14 +112,14 @@ public class SubTabLayout extends LocatableVLayout {
}
// Initial settings
- selectTabByLocatorId(currentlySelected);
+ selectSubTabByLocatorId(currentlySelected);
}
@Override
protected void onDraw() {
super.onDraw();
- selectTabByLocatorId(currentlySelected);
+ selectSubTabByLocatorId(currentlySelected);
}
public void enableSubTab(String locatorId) {
@@ -171,17 +167,25 @@ public class SubTabLayout extends LocatableVLayout {
subtabs.put(locatorId, subTab);
}
- public int getCurrentIndex() {
- return currentIndex;
+ public SubTab getDefaultSubTab() {
+ // the default subtab is the first one in the set that is not disabled
+ for (SubTab subtab : this.subtabs.values()) {
+ if (!this.disabledSubTabs.contains(subtab.getLocatorId())) {
+ return subtab;
+ }
+ }
+ return null;
}
- public SubTab getDefaultSubTab() {
- return subtabs.values().iterator().next();
+ public boolean selectSubTab(SubTab subtab) {
+ if (subtab == null) {
+ throw new IllegalArgumentException("subtab is null.");
+ }
+ return selectSubTabByLocatorId(subtab.getLocatorId());
}
- public boolean selectTabByLocatorId(String locatorId) {
+ public boolean selectSubTabByLocatorId(String locatorId) {
boolean foundTab = false;
- int i = 0;
for (String subtabLocatorId : this.subtabs.keySet()) {
if (subtabLocatorId.equals(locatorId)) {
if (this.disabledSubTabs.contains(subtabLocatorId)) {
@@ -190,12 +194,10 @@ public class SubTabLayout extends LocatableVLayout {
CoreGUI.getErrorHandler().handleError("Cannot select disabled
subtab '" + subtab.getTitle() + "'.");
} else {
this.currentlySelected = subtabLocatorId;
- this.currentIndex = i;
foundTab = true;
}
break;
}
- i++;
}
if (foundTab) {
@@ -205,30 +207,31 @@ public class SubTabLayout extends LocatableVLayout {
return foundTab;
}
- public boolean selectTab(String title) {
- boolean foundTab = false;
- int i = 0;
+ public SubTab getSubTabByTitle(String title) {
for (String subtabLocatorId : this.subtabs.keySet()) {
SubTab subtab = this.subtabs.get(subtabLocatorId);
if (subtab.getTitle().equals(title)) {
- if (this.disabledSubTabs.contains(subtab.getLocatorId())) {
- // Nice try - user tried to select a disabled tab, probably by going
directly to a bookmark URL.
- CoreGUI.getErrorHandler().handleError("Cannot select disabled
subtab '" + title + "'.");
- } else {
- this.currentlySelected = subtab.getLocatorId();
- this.currentIndex = i;
- foundTab = true;
- }
- break;
+ return subtab;
}
- i++;
}
- if (foundTab) {
+ return null;
+ }
+
+ public boolean selectSubTabByTitle(String title) {
+ SubTab subtab = getSubTabByTitle(title);
+ if (subtab == null) {
+ return false;
+ } else {
+ if (this.disabledSubTabs.contains(subtab.getLocatorId())) {
+ // Nice try - user tried to select a disabled tab, probably by going
directly to a bookmark URL.
+ CoreGUI.getErrorHandler().handleError("Cannot select disabled subtab
'" + title + "'.");
+ return false;
+ }
+ this.currentlySelected = subtab.getLocatorId();
refresh();
+ return true;
}
-
- return foundTab;
}
public SubTab getCurrentSubTab() {
@@ -246,7 +249,7 @@ public class SubTabLayout extends LocatableVLayout {
public void fireSubTabSelection() {
TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent("?",
getCurrentSubTab().getTitle(), -1,
- currentIndex, getCurrentCanvas());
+ getCurrentCanvas());
hm.fireEvent(event);
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
index 845128f..6258e9e 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
@@ -52,6 +52,14 @@ public class TwoLevelTab extends LocatableTab {
}
}
+ public SubTab getSubTabByTitle(String title) {
+ return this.layout.getSubTabByTitle(title);
+ }
+
+ public SubTab getDefaultSubTab() {
+ return this.layout.getDefaultSubTab();
+ }
+
public SubTabLayout getLayout() {
return layout;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSelectedEvent.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSelectedEvent.java
index 374c049..5f2b2ab 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSelectedEvent.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSelectedEvent.java
@@ -18,10 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.tab;
-import com.google.gwt.event.shared.EventHandler;
import com.google.gwt.event.shared.GwtEvent;
import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.tab.Tab;
/**
* @author Greg Hinkle
@@ -30,19 +28,17 @@ public class TwoLevelTabSelectedEvent extends
GwtEvent<TwoLevelTabSelectedHandle
public static final GwtEvent.Type<TwoLevelTabSelectedHandler> TYPE = new
Type<TwoLevelTabSelectedHandler>();
- String id;
- String subTabId;
+ private String id;
+ private String subTabId;
- int tabNum;
- int subTabNum;
+ private int tabNum;
- Canvas subTabPane;
+ private Canvas subTabPane;
- public TwoLevelTabSelectedEvent(String id, String subTabId, int tabNum, int
subTabNum, Canvas subTabPane) {
+ public TwoLevelTabSelectedEvent(String id, String subTabId, int tabNum, Canvas
subTabPane) {
this.id = id;
this.subTabId = subTabId;
this.tabNum = tabNum;
- this.subTabNum = subTabNum;
this.subTabPane = subTabPane;
}
@@ -70,14 +66,6 @@ public class TwoLevelTabSelectedEvent extends
GwtEvent<TwoLevelTabSelectedHandle
this.tabNum = tabNum;
}
- public int getSubTabNum() {
- return subTabNum;
- }
-
- public void setSubTabNum(int subTabNum) {
- this.subTabNum = subTabNum;
- }
-
public Canvas getSubTabPane() {
return subTabPane;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
index a5c2611..d39efb7 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
@@ -70,23 +70,30 @@ public class TwoLevelTabSet extends LocatableTabSet implements
TabSelectedHandle
}
public void onTabSelected(TabSelectedEvent tabSelectedEvent) {
- System.out.println("TwoLevelTabSet.onTabSelected(): " +
tabSelectedEvent.getTab().getTitle());
TwoLevelTab tab = (TwoLevelTab) getSelectedTab();
TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent(tab.getTitle(),
tab.getLayout().getCurrentSubTab().getTitle(), tabSelectedEvent.getTabNum(),
- tab.getLayout().getCurrentIndex(), tab.getLayout().getCurrentCanvas());
+ tab.getLayout().getCurrentCanvas());
m.fireEvent(event);
}
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
- System.out.println("TwoLevelTabSet.onTwoLevelTabSelected(): " +
tabSelectedEvent.getId() + "/" +
- tabSelectedEvent.getSubTabId());
tabSelectedEvent.setTabNum(getSelectedTabNumber());
- Tab tab = getSelectedTab();
+ Tab tab = getSelectedTab();
tabSelectedEvent.setId(tab.getTitle());
m.fireEvent(tabSelectedEvent);
}
+ public TwoLevelTab getDefaultTab() {
+ TwoLevelTab[] tabs = getTabs();
+ for (TwoLevelTab tab : tabs) {
+ if (!tab.getDisabled()) {
+ return tab;
+ }
+ }
+ return null;
+ }
+
public TwoLevelTab getTabByTitle(String title) {
return (TwoLevelTab) super.getTabByTitle(title);
}
@@ -94,4 +101,12 @@ public class TwoLevelTabSet extends LocatableTabSet implements
TabSelectedHandle
public TwoLevelTab getTabByLocatorId(String locatorId) {
return (TwoLevelTab) super.getTabByLocatorId(locatorId);
}
+
+ public void setTabEnabled(TwoLevelTab tab, boolean enabled) {
+ if (enabled) {
+ enableTab(tab);
+ } else {
+ disableTab(tab);
+ }
+ }
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
index 0d04750..4f5374c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
@@ -22,7 +22,6 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import com.google.gwt.user.client.History;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
@@ -70,7 +69,7 @@ public class FavoritesButton extends LocatableIMenuButton {
MenuItem item = new MenuItem(String.valueOf(resourceId));
item.addClickHandler(new
com.smartgwt.client.widgets.menu.events.ClickHandler() {
public void onClick(MenuItemClickEvent event) {
- History.newItem("Resource/" + resourceId);
+ CoreGUI.goToView("Resource/" + resourceId);
}
});
items[i] = item;
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 6bb216e..9d289ca 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
@@ -177,7 +177,7 @@ public class ResourceGroupDetailView extends LocatableVLayout
implements Bookmar
this.titleBar.setGroup(groupComposite.getResourceGroup());
- for (Tab top : topTabSet.getTabs()) {
+ for (Tab top : this.topTabSet.getTabs()) {
((TwoLevelTab) top).getLayout().destroyViews();
}
@@ -185,7 +185,6 @@ public class ResourceGroupDetailView extends LocatableVLayout
implements Bookmar
// summaryTab.updateSubTab("Overview", new
DashboardView(resource));
// summaryTab.updateSubTab("Timeline", timelinePane);
this.summaryOverview.setCanvas(new OverviewView(this.groupComposite));
- summaryTab.updateSubTab(this.summaryOverview);
int groupId = this.groupComposite.getResourceGroup().getId();
@@ -194,126 +193,113 @@ public class ResourceGroupDetailView extends LocatableVLayout
implements Bookmar
this.monitorTraits.setCanvas(new
TraitsView(this.monitoringTab.extendLocatorId("TraitsView"), groupId));
this.monitorSched.setCanvas(new
SchedulesView(this.monitoringTab.extendLocatorId("SchedulesView"), groupId));
this.monitorCallTime.setCanvas(new
FullHTMLPane("/rhq/group/monitor/response-plain.xhtml?groupId=" + groupId));
- monitoringTab.updateSubTab(this.monitorGraphs);
- monitoringTab.updateSubTab(this.monitorTables);
- monitoringTab.updateSubTab(this.monitorSched);
- monitoringTab.updateSubTab(this.monitorCallTime);
this.inventoryMembers.setCanvas(ResourceSearchView.getMembersOf(groupId));
- inventoryTab.updateSubTab(this.inventoryMembers);
-
- // inventoryTab.updateSubTab("Connection Settings", new
GroupPluginConfigurationEditView(this.group.getId(), this.group.getResourceType().getId(),
ConfigurationEditor.ConfigType.plugin));
+ // TODO: Uncomment this once the group config component is done.
+ //this.inventoryConn.setCanvas(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));
this.opSched.setCanvas(new
FullHTMLPane("/rhq/group/operation/groupOperationSchedules-plain.xhtml?groupId="
+ groupId));
- operationsTab.updateSubTab(this.opHistory);
- operationsTab.updateSubTab(this.opSched);
this.alertHistory.setCanvas(new
FullHTMLPane("/rhq/group/alert/listGroupAlertHistory-plain.xhtml?groupId="
+ groupId));
this.alertDef.setCanvas(new
FullHTMLPane("/rhq/group/alert/listGroupAlertDefinitions-plain.xhtml?groupId="
+ groupId));
- alertsTab.updateSubTab(this.alertHistory);
- alertsTab.updateSubTab(this.alertDef);
this.configCurrent.setCanvas(new
FullHTMLPane("/rhq/group/configuration/viewCurrent-plain.xhtml?groupId="
+ groupId));
this.configHistory
.setCanvas(new
FullHTMLPane("/rhq/group/configuration/history-plain.xhtml?groupId=" +
groupId));
- configurationTab.updateSubTab(this.configCurrent);
- configurationTab.updateSubTab(this.configHistory);
this.eventHistory.setCanvas(EventCompositeHistoryView.get(groupComposite));
- eventsTab.updateSubTab(this.eventHistory);
updateTabEnablement();
}
private void updateTabEnablement() {
-
GroupCategory groupCategory =
groupComposite.getResourceGroup().getGroupCategory();
Set<ResourceTypeFacet> facets =
groupComposite.getResourceFacets().getFacets();
// Summary and Inventory tabs are always enabled.
- topTabSet.enableTab(summaryTab);
- topTabSet.enableTab(inventoryTab);
+
+ // Only enable "Call Time" and "Traits" subtabs for groups
that implement them.
+ this.monitoringTab.setSubTabEnabled(this.monitorTraits.getLocatorId(),
hasTraits(this.groupComposite));
+ this.monitoringTab.setSubTabEnabled(this.monitorCallTime.getLocatorId(),
facets.contains(ResourceTypeFacet.CALL_TIME));
// Inventory>Connection Settings subtab is only enabled for compat groups that
define conn props.
- inventoryTab.setSubTabEnabled(this.inventoryConn.getLocatorId(), groupCategory ==
GroupCategory.COMPATIBLE
+ this.inventoryTab.setSubTabEnabled(this.inventoryConn.getLocatorId(),
groupCategory == GroupCategory.COMPATIBLE
&& 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) {
- topTabSet.enableTab(monitoringTab);
- topTabSet.enableTab(alertsTab);
- } else {
- topTabSet.disableTab(monitoringTab);
- topTabSet.disableTab(alertsTab);
- }
+ // TODO (ips): Break out mixed groups into a separate view.
+ this.topTabSet.setTabEnabled(this.monitoringTab, groupCategory ==
GroupCategory.COMPATIBLE);
+ this.topTabSet.setTabEnabled(this.alertsTab, groupCategory ==
GroupCategory.COMPATIBLE);
// Operations tab is only enabled for compatible groups of a type that supports
the Operations facet.
- if (facets.contains(ResourceTypeFacet.OPERATION)) {
- topTabSet.enableTab(operationsTab);
- } else {
- topTabSet.disableTab(operationsTab);
- }
+ this.topTabSet.setTabEnabled(this.operationsTab,
facets.contains(ResourceTypeFacet.OPERATION));
// Configuration tab is only enabled for compatible groups of a type that
supports the Configuration facet
// and when the current user has the CONFIGURE_READ permission.
- if (facets.contains(ResourceTypeFacet.CONFIGURATION) &&
permissions.isConfigureRead()) {
- topTabSet.enableTab(configurationTab);
- } else {
- topTabSet.disableTab(configurationTab);
- }
+ this.topTabSet.setTabEnabled(this.configurationTab,
facets.contains(ResourceTypeFacet.CONFIGURATION)
+ && this.permissions.isConfigureRead());
// Events tab is only enabled for compatible groups of a type that supports the
Events facet.
- if (facets.contains(ResourceTypeFacet.EVENT)) {
- topTabSet.enableTab(eventsTab);
- } else {
- topTabSet.disableTab(eventsTab);
- }
-
- // only enable "Call Time" and "Traits" subtabs for groups
that implement them.
- monitoringTab.setSubTabEnabled(monitorTraits.getLocatorId(),
hasTraits(this.groupComposite));
- monitoringTab.setSubTabEnabled(monitorCallTime.getLocatorId(),
facets.contains(ResourceTypeFacet.CALL_TIME));
+ this.topTabSet.setTabEnabled(this.eventsTab,
facets.contains(ResourceTypeFacet.EVENT));
}
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
+ //CoreGUI.printWidgetTree();
+
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());
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, true);
+ // If the tab that was selected is not already the current history item, the
user clicked on the tab, rather
+ // than going directly to the tab's URL. In this case, fire a history
event to go to the tab and make it the
+ // current history item.
+ if (!History.getToken().equals(path)) {
+ //System.out.println("Firing History event [" + path +
"]...");
+ History.newItem(path, true);
+ }
}
}
public void renderView(ViewPath viewPath) {
- // e.g. #ResourceGroup/10010/Inventory/Overview
+ // e.g. #ResourceGroup/10010/Summary/Overview
+ // ^ current path
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 (!viewPath.isEnd()) {
+ // e.g. #ResourceGroup/10010/Summary/Overview
+ // ^ current path
+ this.tabName = viewPath.getCurrent().getPath();
+ viewPath.next();
+ if (!viewPath.isEnd()) {
+ // e.g. #ResourceGroup/10010/Summary/Overview
+ // ^ current path
+ this.subTabName = viewPath.getCurrent().getPath();
+ viewPath.next();
+ } else {
+ this.subTabName = null;
+ }
+ } else {
+ this.tabName = null;
+ }
if (this.groupId != groupId) {
+ // A different group or first load - go get data.
loadSelectedGroup(groupId, viewPath);
} else {
- // Same group just switching tabs
- selectTab(tabName, subTabName, viewPath);
+ // Same group - just switch tabs.
+ selectTab(this.tabName, this.subTabName, viewPath);
}
+
}
public void loadSelectedGroup(final int groupId, final ViewPath viewPath) {
@@ -337,7 +323,6 @@ public class ResourceGroupDetailView extends LocatableVLayout
implements Bookmar
});
}
-
private void loadResourceType(final ResourceGroupComposite groupComposite, final
ViewPath viewPath) {
final ResourceGroup group = this.groupComposite.getResourceGroup();
@@ -372,33 +357,48 @@ public class ResourceGroupDetailView extends LocatableVLayout
implements Bookmar
}
}
+ /**
+ * Select the tab/subtab with the specified titles (e.g. "Monitoring",
"Graphs").
+ *
+ * @param tabTitle the title of the tab to select - if null, the default tab (the
leftmost non-disabled one) will be selected
+ * @param subtabTitle the title of the subtab to select - if null, the default subtab
(the leftmost non-disabled one) will be selected
+ * @param viewPath the view path, which may have additional view items to be
rendered
+ */
+ public void selectTab(String tabTitle, String subtabTitle, ViewPath viewPath) {
+ try {
+ TwoLevelTab tab = (tabTitle != null) ? this.topTabSet.getTabByTitle(tabTitle)
:
+ this.topTabSet.getDefaultTab();
+ if (tab == null || tab.getDisabled()) {
+ CoreGUI.getErrorHandler().handleError("Invalid tab name: " +
tabTitle);
+ // TODO: Should we fire a history event here to redirect to a valid
bookmark?
+ tab = this.topTabSet.getDefaultTab();
+ subtabTitle = null;
+ }
+ // Do *not* select the tab and trigger the tab selected event until the
subtab has been selected first.
- public void selectTab(String tabName, String subtabName, ViewPath viewPath) {
- if (tabName == null) {
- tabName = DEFAULT_TAB_NAME;
- }
- TwoLevelTab tab = this.topTabSet.getTabByTitle(tabName);
- if (tab == null) {
- CoreGUI.getErrorHandler().handleError("Invalid tab name: " +
tabName);
- // TODO: Should we fire a history event here to redirect to a valid
bookmark?
- tab = this.topTabSet.getTabByTitle(DEFAULT_TAB_NAME);
- }
- this.topTabSet.selectTab(tab);
- if (subtabName != null) {
- if (!tab.getLayout().selectTab(subtabName)) {
- CoreGUI.getErrorHandler().handleError("Invalid subtab name: " +
subtabName);
+ SubTab subtab = (subtabTitle != null) ? tab.getSubTabByTitle(subtabTitle) :
tab.getDefaultSubTab();
+ if (subtab == null || tab.getLayout().isDisabled()) {
+ CoreGUI.getErrorHandler().handleError("Invalid subtab name: " +
subtabTitle);
// 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);
- }
+ subtab = tab.getLayout().getDefaultSubTab();
}
+ tab.getLayout().selectSubTab(subtab);
+
+ // Now that the subtab has been selected, select the tab (this will cause a
tab selected event to fire).
+ this.topTabSet.selectTab(tab);
+
+ // Handle any remaining view items (e.g. id of a selected item in a subtab
that contains a Master-Details view).
+ Canvas subView = subtab.getCanvas();
+ if (subView instanceof BookmarkableView) {
+ ((BookmarkableView) subView).renderView(viewPath);
+ }
+
+ this.topTabSet.markForRedraw();
+ } catch (Exception e) {
+ System.err.println("Failed to select tab " + tabTitle +
"/" + subtabTitle + ": " + e);
}
}
-
private static boolean hasTraits(ResourceGroupComposite groupComposite) {
ResourceType type = groupComposite.getResourceGroup().getResourceType();
if (type != null) {
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 7fe5361..a205584 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
@@ -25,10 +25,7 @@ package org.rhq.enterprise.gui.coregui.client.inventory.groups.detail;
import com.smartgwt.client.widgets.Canvas;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
-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.util.selenium.LocatableHLayout;
/**
@@ -37,17 +34,14 @@ import
org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
public class ResourceGroupTopView extends LocatableHLayout implements BookmarkableView {
private Canvas contentCanvas;
-
-
private ResourceGroupTreeView treeView;
private ResourceGroupDetailView detailView;
- private ResourceGroupGWTServiceAsync groupService =
GWTServiceLookup.getResourceGroupService();
-
public ResourceGroupTopView(String locatorId) {
super(locatorId);
}
+
@Override
protected void onInit() {
super.onInit();
@@ -68,7 +62,6 @@ public class ResourceGroupTopView extends LocatableHLayout implements
Bookmarkab
setContent(detailView);
}
-
public void setContent(Canvas newContent) {
if (contentCanvas.getChildren().length > 0)
@@ -77,16 +70,9 @@ public class ResourceGroupTopView extends LocatableHLayout implements
Bookmarkab
contentCanvas.markForRedraw();
}
- public void renderView(ViewPath viewPath) {
- if (viewPath.isEnd()) {
- // default detail view
- viewPath.getViewPath().add(new ViewId("Inventory"));
- viewPath.getViewPath().add(new ViewId("Overview"));
- }
-
+ public void renderView(ViewPath viewPath) {
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/monitoring/traits/TraitsDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsDataSource.java
index 28aee70..4be1f22 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/traits/TraitsDataSource.java
@@ -49,8 +49,8 @@ public class TraitsDataSource extends
AbstractMeasurementDataTraitDataSource {
groupIdField.setHidden(true);
fields.add(0, groupIdField);
- DataSourceTextField resourceNameField = new
DataSourceTextField(MeasurementDataTraitCriteria.SORT_FIELD_RESOURCE_NAME,
- "Resource Name");
+ DataSourceTextField resourceNameField =
+ new
DataSourceTextField(MeasurementDataTraitCriteria.SORT_FIELD_RESOURCE_NAME, "Member
Resource");
fields.add(0, resourceNameField);
return fields;
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 731711e..c31881c 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
@@ -111,7 +111,7 @@ public class InventoryView extends LocatableHLayout implements
BookmarkableView
grid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
- CoreGUI.goTo("Inventory/" + name + "/" +
selectionEvent.getRecord().getAttribute("name"));
+ CoreGUI.goToView("Inventory/" + name + "/" +
selectionEvent.getRecord().getAttribute("name"));
}
}
});
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 fc67739..2451e4b 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
@@ -264,7 +264,6 @@ public class ResourceDetailView extends LocatableVLayout implements
Bookmarkable
}
private void updateTabEnablement() {
-
ResourcePermission permissions = this.resourceComposite.getResourcePermission();
Set<ResourceTypeFacet> facets =
this.resourceComposite.getResourceFacets().getFacets();
@@ -277,29 +276,10 @@ public class ResourceDetailView extends LocatableVLayout implements
Bookmarkable
ResourceType type = this.resourceComposite.getResource().getResourceType();
inventoryTab.setSubTabEnabled(inventoryChildren.getLocatorId(),
!type.getChildResourceTypes().isEmpty());
- if (facets.contains(ResourceTypeFacet.OPERATION)) {
- topTabSet.enableTab(operationsTab);
- } else {
- topTabSet.disableTab(operationsTab);
- }
-
- if (facets.contains(ResourceTypeFacet.CONFIGURATION) &&
permissions.isConfigureRead()) {
- topTabSet.enableTab(configurationTab);
- } else {
- topTabSet.disableTab(configurationTab);
- }
-
- if (facets.contains(ResourceTypeFacet.EVENT)) {
- topTabSet.enableTab(eventsTab);
- } else {
- topTabSet.disableTab(eventsTab);
- }
-
- if (facets.contains(ResourceTypeFacet.CONTENT)) {
- topTabSet.enableTab(contentTab);
- } else {
- topTabSet.disableTab(contentTab);
- }
+ this.topTabSet.setTabEnabled(this.operationsTab,
facets.contains(ResourceTypeFacet.OPERATION));
+ this.topTabSet.setTabEnabled(this.configurationTab,
facets.contains(ResourceTypeFacet.CONFIGURATION) &&
permissions.isConfigureRead());
+ this.topTabSet.setTabEnabled(this.eventsTab,
facets.contains(ResourceTypeFacet.EVENT));
+ this.topTabSet.setTabEnabled(this.contentTab,
facets.contains(ResourceTypeFacet.CONTENT));
}
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
@@ -309,7 +289,7 @@ public class ResourceDetailView extends LocatableVLayout implements
Bookmarkable
// 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());
+ // selectSubTabByTitle(tabSelectedEvent.getId(),
tabSelectedEvent.getSubTabId());
String tabPath = "/" + tabSelectedEvent.getId() + "/" +
tabSelectedEvent.getSubTabId();
String path = "Resource/" + resourceId + tabPath;
@@ -324,26 +304,35 @@ public class ResourceDetailView extends LocatableVLayout implements
Bookmarkable
}
public void renderView(ViewPath viewPath) {
- // e.g. #Resource/10010/Inventory/Overview
- // ^ Current Path
+ // e.g. #Resource/10010/Summary/Overview
+ // ^ current path
int resourceId = 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 (!viewPath.isEnd()) {
+ // e.g. #Resource/10010/Summary/Overview
+ // ^ current path
+ this.tabName = viewPath.getCurrent().getPath();
+ viewPath.next();
+ if (!viewPath.isEnd()) {
+ // e.g. #Resource/10010/Summary/Overview
+ // ^ current path
+ this.subTabName = viewPath.getCurrent().getPath();
+ viewPath.next();
+ } else {
+ this.subTabName = null;
+ }
+ } else {
+ this.tabName = null;
+ }
if (this.resourceId != resourceId) {
- // A different resource or first load, go get data
+ // A different Resource or first load - go get data.
loadSelectedResource(resourceId, viewPath);
} else {
- // same resource just switch tabs
- selectTab(tabName, subTabName, viewPath);
+ // Same Resource - just switch tabs.
+ selectTab(this.tabName, this.subTabName, viewPath);
}
-
}
public void loadSelectedResource(final int resourceId, final ViewPath viewPath) {
@@ -360,7 +349,7 @@ public class ResourceDetailView extends LocatableVLayout implements
Bookmarkable
new Message("Resource with id [" + resourceId + "]
does not exist or is not accessible.",
Message.Severity.Warning));
- CoreGUI.goTo(InventoryView.VIEW_PATH);
+ CoreGUI.goToView(InventoryView.VIEW_PATH);
}
public void onSuccess(PageList<ResourceComposite> result) {
@@ -396,37 +385,45 @@ public class ResourceDetailView extends LocatableVLayout implements
Bookmarkable
});
}
- public void selectTab(String tabName, String subtabName, ViewPath viewPath) {
+ /**
+ * Select the tab/subtab with the specified titles (e.g. "Monitoring",
"Graphs").
+ *
+ * @param tabTitle the title of the tab to select - if null, the default tab (the
leftmost non-disabled one) will be selected
+ * @param subtabTitle the title of the subtab to select - if null, the default subtab
(the leftmost non-disabled one) will be selected
+ * @param viewPath the view path, which may have additional view items to be
rendered
+ */
+ public void selectTab(String tabTitle, String subtabTitle, ViewPath viewPath) {
try {
- TwoLevelTab tab = this.topTabSet.getTabByTitle(tabName);
+ TwoLevelTab tab = (tabTitle != null) ? this.topTabSet.getTabByTitle(tabTitle)
:
+ this.topTabSet.getDefaultTab();
if (tab == null || tab.getDisabled()) {
- CoreGUI.getErrorHandler().handleError("Invalid tab name: " +
tabName);
+ CoreGUI.getErrorHandler().handleError("Invalid tab name: " +
tabTitle);
// TODO: Should we fire a history event here to redirect to a valid
bookmark?
- Tab defaultTab = this.topTabSet.getTab(0);
- tab = (TwoLevelTab) defaultTab;
+ tab = this.topTabSet.getDefaultTab();
+ subtabTitle = null;
}
- SubTab subTab = null;
- if (subtabName != null) {
- if (!tab.getLayout().selectTab(subtabName)) {
- CoreGUI.getErrorHandler().handleError("Invalid subtab name:
" + subtabName);
- // TODO: Should we fire a history event here to redirect to a valid
bookmark?
- SubTab defaultSubtab = tab.getLayout().getDefaultSubTab();
- tab.getLayout().selectTab(defaultSubtab.getTitle());
- }
- subTab = tab.getLayout().getCurrentSubTab();
+ // Do *not* select the tab and trigger the tab selected event until the
subtab has been selected first.
+
+ SubTab subtab = (subtabTitle != null) ? tab.getSubTabByTitle(subtabTitle) :
tab.getDefaultSubTab();
+ if (subtab == null || tab.getLayout().isDisabled()) {
+ CoreGUI.getErrorHandler().handleError("Invalid subtab name: " +
subtabTitle);
+ // TODO: Should we fire a history event here to redirect to a valid
bookmark?
+ subtab = tab.getLayout().getDefaultSubTab();
}
+ tab.getLayout().selectSubTab(subtab);
+
+ // Now that the subtab has been selected, select the tab (this will cause a
tab selected event to fire).
this.topTabSet.selectTab(tab);
- if (subTab != null) {
- tab.updateSubTab(subTab);
- Canvas subView = subTab.getCanvas();
- if (subView instanceof BookmarkableView) {
- ((BookmarkableView) subView).renderView(viewPath);
- }
+
+ // Handle any remaining view items (e.g. id of a selected item in a subtab
that contains a Master-Details view).
+ Canvas subView = subtab.getCanvas();
+ if (subView instanceof BookmarkableView) {
+ ((BookmarkableView) subView).renderView(viewPath);
}
- tab.getLayout().markForRedraw();
+
this.topTabSet.markForRedraw();
} catch (Exception e) {
- System.err.println("Failed to select tab " + tabName +
"/" + subtabName + ": " + e);
+ System.err.println("Failed to select tab " + tabTitle +
"/" + subtabTitle + ": " + e);
}
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
index 83c5352..7fae500 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTopView.java
@@ -62,14 +62,7 @@ public class ResourceTopView extends LocatableHLayout implements
BookmarkableVie
}
public void renderView(ViewPath viewPath) {
- if (viewPath.isEnd()) {
- // default detail view
- viewPath.getViewPath().add(new ViewId("Summary"));
- viewPath.getViewPath().add(new ViewId("Overview"));
- }
-
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/resource/detail/ResourceTreeView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index 8566975..57ba8f2 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -91,7 +91,7 @@ public class ResourceTreeView extends LocatableVLayout {
private ViewId currentViewId;
- private ArrayList<ResourceSelectListener> selectListeners = new
ArrayList<ResourceSelectListener>();
+ private List<ResourceSelectListener> selectListeners = new
ArrayList<ResourceSelectListener>();
private boolean initialSelect = false;
@@ -105,6 +105,7 @@ public class ResourceTreeView extends LocatableVLayout {
}
public void onInit() {
+ // TODO (ips): Are we intentionally avoiding calling super.onInit() here? If so,
why?
}
private void buildTree() {
@@ -124,7 +125,6 @@ public class ResourceTreeView extends LocatableVLayout {
treeGrid.setLeaveScrollbarGap(false);
contextMenu = new Menu();
- MenuItem item = new MenuItem("Expand node");
treeGrid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
@@ -132,16 +132,11 @@ public class ResourceTreeView extends LocatableVLayout {
if (treeGrid.getSelectedRecord() instanceof
ResourceTreeDatasource.ResourceTreeNode) {
ResourceTreeDatasource.ResourceTreeNode node =
(ResourceTreeDatasource.ResourceTreeNode) treeGrid
.getSelectedRecord();
- System.out.println("Resource selected in tree: " +
node.getResource());
-
- String newToken = "Resource/" +
node.getResource().getId();
- String currentToken = History.getToken();
- if (!currentToken.startsWith(newToken)) {
-
- String ending =
currentToken.replaceFirst("^[^\\/]*\\/[^\\/]*", "");
-
- History.newItem("Resource/" +
node.getResource().getId() + ending);
-
+ //System.out.println("Resource selected in tree: " +
node.getResource());
+ String viewPath = "Resource/" +
node.getResource().getId();
+ String currentViewPath = History.getToken();
+ if (!currentViewPath.startsWith(viewPath)) {
+ CoreGUI.goToView(viewPath);
}
}
}
@@ -167,13 +162,13 @@ public class ResourceTreeView extends LocatableVLayout {
treeGrid.addDataArrivedHandler(new DataArrivedHandler() {
public void onDataArrived(DataArrivedEvent dataArrivedEvent) {
if (!initialSelect) {
-
updateBreadcrumb();
}
}
});
}
+
private void updateBreadcrumb() {
TreeNode selectedNode =
treeGrid.getTree().findById(String.valueOf(selectedResourceId));
// System.out.println("Trying to preopen:
" + selectedNode);
@@ -455,7 +450,7 @@ public class ResourceTreeView extends LocatableVLayout {
public void setSelectedResource(final int selectedResourceId) {
this.selectedResourceId = selectedResourceId;
- TreeNode node = null;
+ TreeNode node;
if (treeGrid != null && treeGrid.getTree() != null
&& (node =
treeGrid.getTree().findById(String.valueOf(selectedResourceId))) != null) {
@@ -466,8 +461,10 @@ public class ResourceTreeView extends LocatableVLayout {
treeGrid.getTree().openFolders(parents);
treeGrid.getTree().openFolder(node);
- treeGrid.deselectAllRecords();
- treeGrid.selectRecord(node);
+ if (!treeGrid.getSelectedRecord().equals(node)) {
+ treeGrid.deselectAllRecords();
+ treeGrid.selectRecord(node);
+ }
updateBreadcrumb();
/*
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 9d56dc2..c507395 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
@@ -100,7 +100,7 @@ public class ReportTopView extends LocatableHLayout implements
BookmarkableView
grid.addSelectionChangedHandler(new SelectionChangedHandler() {
public void onSelectionChanged(SelectionEvent selectionEvent) {
if (selectionEvent.getState()) {
- CoreGUI.goTo("Reports/" + name + "/" +
selectionEvent.getRecord().getAttribute("name"));
+ CoreGUI.goToView("Reports/" + name + "/" +
selectionEvent.getRecord().getAttribute("name"));
}
}
});
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RPCManager.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RPCManager.java
index 37f553d..10213f4 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RPCManager.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/rpc/RPCManager.java
@@ -21,20 +21,22 @@ package org.rhq.enterprise.gui.coregui.client.util.rpc;
import com.smartgwt.client.widgets.Img;
import java.util.HashSet;
+import java.util.Set;
/**
* @author Greg Hinkle
*/
public class RPCManager {
+ private static final RPCManager INSTANCE = new RPCManager();
- int nextCallId = 0;
+ private int nextCallId = 0;
- HashSet<MonitoringRequestCallback> inProgress = new
HashSet<MonitoringRequestCallback>();
+ private Set<MonitoringRequestCallback> inProgress = new
HashSet<MonitoringRequestCallback>();
- Img activityIndicator;
+ private Img activityIndicator;
- public RPCManager() {
+ private RPCManager() {
activityIndicator = new Img("/coregui/images/ajax-loader.gif", 16,
16);
activityIndicator.setZIndex(10000);
activityIndicator.setLeft(10);
@@ -43,6 +45,10 @@ public class RPCManager {
activityIndicator.draw();
}
+ public static RPCManager getInstance() {
+ return INSTANCE;
+ }
+
public int register(MonitoringRequestCallback callback) {
inProgress.add(callback);
refresh();
@@ -50,13 +56,13 @@ public class RPCManager {
}
public void failCall(MonitoringRequestCallback callback) {
- System.out.println("RPC [" + callback.getName() + "] failed in
[" + callback.age() + "]");
+ //System.err.println("RPC [" + callback.getName() + "] failed in
[" + callback.age() + "] ms.");
inProgress.remove(callback);
refresh();
}
public void succeedCall(MonitoringRequestCallback callback) {
- System.out.println("RPC [" + callback.getName() + "] succeeded in
[" + callback.age() + "]");
+ //System.out.println("RPC [" + callback.getName() + "] succeeded
in [" + callback.age() + "] ms.");
inProgress.remove(callback);
refresh();
}
@@ -76,17 +82,8 @@ public class RPCManager {
}
activityIndicator.setTooltip(buf.toString());
-
} else {
activityIndicator.hide();
}
}
-
-
- public static RPCManager INSTANCE = new RPCManager();
-
- public static RPCManager getInstance() {
- return INSTANCE;
- }
-
}