modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java | 36 ++++++---- 1 file changed, 24 insertions(+), 12 deletions(-)
New commits: commit 0a979fb7c481d111dab06cdf06833bc5366fb9d4 Author: John Mazzitelli mazz@redhat.com Date: Fri Oct 22 11:30:15 2010 -0400
this doesn't fix anything but it refactors it to look like what AdministrationView code will look like. because the authz check is async, the treeGrids collection isn't populated at the time we need it. this should be fixed in the future
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 d913229..5ade636 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 @@ -286,18 +286,8 @@ public class InventoryView extends LocatableHLayout implements BookmarkableView } }
- for (String name : treeGrids.keySet()) { - TreeGrid treeGrid = treeGrids.get(name); - if (name.equals(sectionName)) { - for (TreeNode node : treeGrid.getTree().getAllNodes()) { - if (pageName.equals(node.getName())) { - treeGrid.selectSingleRecord(node); - } - } - } else { - treeGrid.deselectAllRecords(); - } - } + // when changing sections make sure the previous section's selection is deselected + selectSectionPageTreeGridNode(sectionName, pageName);
// ignore clicks on subsection folder nodes if (null != content) { @@ -309,6 +299,28 @@ public class InventoryView extends LocatableHLayout implements BookmarkableView } }
+ private void selectSectionPageTreeGridNode(String sectionName, String pageName) { + // TODO this method works, however, its getting invoked prior to treeGrids getting populated due to async authz check. need to fix that + for (String name : treeGrids.keySet()) { + TreeGrid treeGrid = treeGrids.get(name); + if (!name.equals(sectionName)) { + treeGrid.deselectAllRecords(); + } else { + boolean gotIt = false; + for (TreeNode node : treeGrid.getTree().getAllNodes()) { + if (node.getName().equals(pageName)) { + treeGrid.selectSingleRecord(node); + gotIt = true; + break; + } + } + if (!gotIt) { + CoreGUI.getErrorHandler().handleError("Unknown page name - URL is incorrect"); + } + } + } + } + public void renderView(ViewPath viewPath) { if (!viewPath.isCurrent(currentSectionViewId) || !viewPath.isNext(currentPageViewId)) { if (viewPath.isEnd()) {
rhq-commits@lists.fedorahosted.org